aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Linton <jeremy.linton@arm.com>2021-04-01 13:10:24 -0500
committerManish Pandey <manish.pandey2@arm.com>2021-05-25 14:48:56 +0200
commit475333c8a9bf027dfb64dff7fe61fd0729548d2a (patch)
tree823caea181a38bf3f1399d2ac69ca57a3cac8310
parent09e153a9a84bc05b41bc40116372b10ef21308c0 (diff)
downloadtrusted-firmware-a-475333c8a9bf027dfb64dff7fe61fd0729548d2a.tar.gz
SMCCC: Hoist SMC_32 sanitization
The SMCCC, part 3 indicates that only the bottom 32-bits of a 32-bit SMC call are valid. The upper bits must be zero. Lets enforce that so standard service code can assume its been called that way. Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> Change-Id: I1bac50fbdc3b6ddca5fe2d1d1f96166a65ac4eb4
-rw-r--r--services/std_svc/std_svc_setup.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/services/std_svc/std_svc_setup.c b/services/std_svc/std_svc_setup.c
index 23f13ab823..540bb86a96 100644
--- a/services/std_svc/std_svc_setup.c
+++ b/services/std_svc/std_svc_setup.c
@@ -82,6 +82,15 @@ static uintptr_t std_svc_smc_handler(uint32_t smc_fid,
void *handle,
u_register_t flags)
{
+ if (((smc_fid >> FUNCID_CC_SHIFT) & FUNCID_CC_MASK) == SMC_32) {
+ /* 32-bit SMC function, clear top parameter bits */
+
+ x1 &= UINT32_MAX;
+ x2 &= UINT32_MAX;
+ x3 &= UINT32_MAX;
+ x4 &= UINT32_MAX;
+ }
+
/*
* Dispatch PSCI calls to PSCI SMC handler and return its return
* value