mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-05-01 16:13:16 +00:00
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
This commit is contained in:
parent
0d35873c8f
commit
bb9549babc
2 changed files with 17 additions and 4 deletions
|
@ -102,9 +102,11 @@ func enter_lower_el_sync_ea
|
||||||
/* Setup exception class and syndrome arguments for platform handler */
|
/* Setup exception class and syndrome arguments for platform handler */
|
||||||
mov x0, #ERROR_EA_SYNC
|
mov x0, #ERROR_EA_SYNC
|
||||||
mrs x1, esr_el3
|
mrs x1, esr_el3
|
||||||
adr x30, el3_exit
|
bl delegate_sync_ea
|
||||||
b delegate_sync_ea
|
|
||||||
|
|
||||||
|
/* el3_exit assumes SP_EL0 on entry */
|
||||||
|
msr spsel, #MODE_SP_EL0
|
||||||
|
b el3_exit
|
||||||
2:
|
2:
|
||||||
ldp x0, x1, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X0]
|
ldp x0, x1, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X0]
|
||||||
ldp x2, x3, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X2]
|
ldp x2, x3, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X2]
|
||||||
|
@ -146,8 +148,11 @@ func enter_lower_el_async_ea
|
||||||
/* Setup exception class and syndrome arguments for platform handler */
|
/* Setup exception class and syndrome arguments for platform handler */
|
||||||
mov x0, #ERROR_EA_ASYNC
|
mov x0, #ERROR_EA_ASYNC
|
||||||
mrs x1, esr_el3
|
mrs x1, esr_el3
|
||||||
adr x30, el3_exit
|
bl delegate_async_ea
|
||||||
b delegate_async_ea
|
|
||||||
|
/* el3_exit assumes SP_EL0 on entry */
|
||||||
|
msr spsel, #MODE_SP_EL0
|
||||||
|
b el3_exit
|
||||||
endfunc enter_lower_el_async_ea
|
endfunc enter_lower_el_async_ea
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <arch.h>
|
#include <arch.h>
|
||||||
#include <asm_macros.S>
|
#include <asm_macros.S>
|
||||||
|
#include <assert_macros.S>
|
||||||
#include <context.h>
|
#include <context.h>
|
||||||
|
|
||||||
.global el1_sysregs_context_save
|
.global el1_sysregs_context_save
|
||||||
|
@ -477,6 +478,13 @@ endfunc restore_gp_pmcr_pauth_regs
|
||||||
* ------------------------------------------------------------------
|
* ------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
func el3_exit
|
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
|
* Save the current SP_EL0 i.e. the EL3 runtime stack which
|
||||||
* will be used for handling the next SMC.
|
* will be used for handling the next SMC.
|
||||||
|
|
Loading…
Add table
Reference in a new issue