Commit 83a393ba authored by Antonio Nino Diaz's avatar Antonio Nino Diaz
Browse files

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: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
parent 42be6fc5
...@@ -33,16 +33,11 @@ void spm_sp_setup(sp_context_t *sp_ctx) ...@@ -33,16 +33,11 @@ void spm_sp_setup(sp_context_t *sp_ctx)
entry_point_info_t ep_info = {0}; entry_point_info_t ep_info = {0};
SET_PARAM_HEAD(&ep_info, PARAM_EP, VERSION_1, SECURE | EP_ST_ENABLE); SET_PARAM_HEAD(&ep_info, PARAM_EP, VERSION_1, SECURE | EP_ST_ENABLE);
/* Setup entrypoint and SPSR */
ep_info.pc = BL32_BASE; ep_info.pc = BL32_BASE;
ep_info.spsr = SPSR_64(MODE_EL0, MODE_SP_EL0, DISABLE_ALL_EXCEPTIONS); 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. * X0: Virtual address of a buffer shared between EL3 and Secure EL0.
* The buffer will be mapped in the Secure EL1 translation regime * The buffer will be mapped in the Secure EL1 translation regime
...@@ -55,12 +50,14 @@ void spm_sp_setup(sp_context_t *sp_ctx) ...@@ -55,12 +50,14 @@ void spm_sp_setup(sp_context_t *sp_ctx)
* *
* X3: cookie value (Implementation Defined) * 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); ep_info.args.arg0 = PLAT_SPM_BUF_BASE;
write_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X1, PLAT_SPM_BUF_SIZE); ep_info.args.arg1 = PLAT_SPM_BUF_SIZE;
write_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X2, PLAT_SPM_COOKIE_0); ep_info.args.arg2 = PLAT_SPM_COOKIE_0;
write_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X3, PLAT_SPM_COOKIE_1); 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 * SP_EL0: A non-zero value will indicate to the SP that the SPM has
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment