From d6b532b50f83b5fe353792fb4b8d91b2191c1850 Mon Sep 17 00:00:00 2001 From: Antonio Nino Diaz Date: Wed, 15 Nov 2017 10:36:21 +0000 Subject: [PATCH] SPM: Fix SP_COMMUNICATE_AARCH32/64 parameters The parameters passed to the Secure world from the Secure Partition Manager when invoking SP_COMMUNICATE_AARCH32/64 were incorrect, as well as the checks done on them. Change-Id: I26e8c80cad0b83437db7aaada3d0d9add1c53a78 Signed-off-by: Antonio Nino Diaz --- services/std_svc/spm/spm_main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/std_svc/spm/spm_main.c b/services/std_svc/spm/spm_main.c index 1b40d81dc..de657a2f9 100644 --- a/services/std_svc/spm/spm_main.c +++ b/services/std_svc/spm/spm_main.c @@ -431,12 +431,14 @@ uint64_t spm_smc_handler(uint32_t smc_fid, cm_el1_sysregs_context_restore(SECURE); cm_set_next_eret_context(SECURE); - if (x2 != 0) { - VERBOSE("SP_COMMUNICATE_AARCH32/64: X2 is not 0 as recommended."); + /* Cookie. Reserved for future use. It must be zero. */ + assert(x1 == 0); + + if (x3 != 0) { + VERBOSE("SP_COMMUNICATE_AARCH32/64: X3 is not 0 as recommended.\n"); } - SMC_RET4(&sp_ctx.cpu_ctx, - smc_fid, x2, x3, plat_my_core_pos()); + SMC_RET4(&sp_ctx.cpu_ctx, smc_fid, x1, x2, x3); case SP_MEM_ATTRIBUTES_GET_AARCH64: case SP_MEM_ATTRIBUTES_SET_AARCH64: -- 2.39.5