aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJan Dabros <jsd@semihalf.com>2019-12-02 13:30:03 +0100
committerJan Dabros <jsd@semihalf.com>2019-12-18 08:47:10 +0100
commitbb9549babc17631f7c7b944ad3213c5a8d173bdd (patch)
tree11e28161b6ef73c8d83412734b45fcb959ad7759 /lib
parent0d35873c8fbe3a1f9682044bd060e18a567f4e74 (diff)
downloadplatform_external_arm-trusted-firmware-bb9549babc17631f7c7b944ad3213c5a8d173bdd.tar.gz
platform_external_arm-trusted-firmware-bb9549babc17631f7c7b944ad3213c5a8d173bdd.tar.bz2
platform_external_arm-trusted-firmware-bb9549babc17631f7c7b944ad3213c5a8d173bdd.zip
aarch64: Fix stack pointer maintenance on EA handling path
EA handlers for exceptions taken from lower ELs at the end invokes el3_exit function. However there was a bug with sp maintenance which resulted in el3_exit setting runtime stack to context. This in turn caused memory corruption on consecutive EL3 entries. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I0424245c27c369c864506f4baa719968890ce659
Diffstat (limited to 'lib')
-rw-r--r--lib/el3_runtime/aarch64/context.S8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/el3_runtime/aarch64/context.S b/lib/el3_runtime/aarch64/context.S
index 110142520..1bbd61005 100644
--- a/lib/el3_runtime/aarch64/context.S
+++ b/lib/el3_runtime/aarch64/context.S
@@ -6,6 +6,7 @@
#include <arch.h>
#include <asm_macros.S>
+#include <assert_macros.S>
#include <context.h>
.global el1_sysregs_context_save
@@ -477,6 +478,13 @@ endfunc restore_gp_pmcr_pauth_regs
* ------------------------------------------------------------------
*/
func el3_exit
+#if ENABLE_ASSERTIONS
+ /* el3_exit assumes SP_EL0 on entry */
+ mrs x17, spsel
+ cmp x17, #MODE_SP_EL0
+ ASM_ASSERT(eq)
+#endif
+
/* ----------------------------------------------------------
* Save the current SP_EL0 i.e. the EL3 runtime stack which
* will be used for handling the next SMC.