summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-06-11 11:01:54 +0100
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-06-13 09:19:41 +0100
commit83a393ba3e15a8198520247a25e61c5c04c89ead (patch)
treed3aa4263dfd1b42bb77f18e9edd6142ba0ca56d7 /services
parent42be6fc57e4f543a6a5a79f3a3d13192fb346fe2 (diff)
SPM: Initialize SP args as expected by cm library
In the context management library, cm_setup_context() takes the information in ep_info to fill the registers x0-x7. This patch replaces the current code that sets them manually by the correct initialization code. Change-Id: Id1fdf4681b154026c2e3af1f9b05b19582b7d16d Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'services')
-rw-r--r--services/std_svc/spm/sp_setup.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/services/std_svc/spm/sp_setup.c b/services/std_svc/spm/sp_setup.c
index de27e3e9..13dede7c 100644
--- a/services/std_svc/spm/sp_setup.c
+++ b/services/std_svc/spm/sp_setup.c
@@ -33,16 +33,11 @@ void spm_sp_setup(sp_context_t *sp_ctx)
entry_point_info_t ep_info = {0};
SET_PARAM_HEAD(&ep_info, PARAM_EP, VERSION_1, SECURE | EP_ST_ENABLE);
+
+ /* Setup entrypoint and SPSR */
ep_info.pc = BL32_BASE;
ep_info.spsr = SPSR_64(MODE_EL0, MODE_SP_EL0, DISABLE_ALL_EXCEPTIONS);
- cm_setup_context(ctx, &ep_info);
-
- /*
- * General-Purpose registers
- * -------------------------
- */
-
/*
* X0: Virtual address of a buffer shared between EL3 and Secure EL0.
* The buffer will be mapped in the Secure EL1 translation regime
@@ -55,12 +50,14 @@ void spm_sp_setup(sp_context_t *sp_ctx)
*
* X3: cookie value (Implementation Defined)
*
- * X4 to X30 = 0 (already done by cm_init_my_context())
+ * X4 to X7 = 0
*/
- write_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X0, PLAT_SPM_BUF_BASE);
- write_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X1, PLAT_SPM_BUF_SIZE);
- write_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X2, PLAT_SPM_COOKIE_0);
- write_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X3, PLAT_SPM_COOKIE_1);
+ ep_info.args.arg0 = PLAT_SPM_BUF_BASE;
+ ep_info.args.arg1 = PLAT_SPM_BUF_SIZE;
+ ep_info.args.arg2 = PLAT_SPM_COOKIE_0;
+ ep_info.args.arg3 = PLAT_SPM_COOKIE_1;
+
+ cm_setup_context(ctx, &ep_info);
/*
* SP_EL0: A non-zero value will indicate to the SP that the SPM has