diff options
author | Sean Anderson <sean.anderson@seco.com> | 2023-10-27 16:40:13 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-11-10 11:55:17 -0500 |
commit | 298c26c5c7f4105f4e421d227009baeba5c59678 (patch) | |
tree | 8b4aaa1b1a972c02969f200d54b18d4a1d8fb619 | |
parent | b630f8b3aefc2d11cdc73314743a6fb16deaf4c5 (diff) | |
download | u-boot-298c26c5c7f4105f4e421d227009baeba5c59678.zip u-boot-298c26c5c7f4105f4e421d227009baeba5c59678.tar.gz u-boot-298c26c5c7f4105f4e421d227009baeba5c59678.tar.bz2 |
arm: Fix software interrupt handler
When we take a software interrupt, we are already in supervisor mode.
get_bad_stack assumes we are not in supervisor mode so it can clobber
the stack pointer. This causes us to have an invalid stack once that
macro finishes. Revert back to the get_bad_stack_swi macro which was
previously removed.
Fixes: 41623c91b09 ("arm: move exception handling out of start.S files")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
-rw-r--r-- | arch/arm/lib/vectors.S | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/arm/lib/vectors.S b/arch/arm/lib/vectors.S index 7cf7d16..fe8ca40 100644 --- a/arch/arm/lib/vectors.S +++ b/arch/arm/lib/vectors.S @@ -240,6 +240,18 @@ IRQ_STACK_START_IN: movs pc, lr @ jump to next instruction & switch modes. .endm + .macro get_bad_stack_swi + sub r13, r13, #4 @ space on current stack for scratch reg. + str r0, [r13] @ save R0's value. + ldr r0, IRQ_STACK_START_IN @ get data regions start + str lr, [r0] @ save caller lr in position 0 of saved stack + mrs lr, spsr @ get the spsr + str lr, [r0, #4] @ save spsr in position 1 of saved stack + ldr lr, [r0] @ restore lr + ldr r0, [r13] @ restore r0 + add r13, r13, #4 @ pop stack entry + .endm + .macro get_irq_stack @ setup IRQ stack ldr sp, IRQ_STACK_START .endm @@ -260,7 +272,7 @@ undefined_instruction: .align 5 software_interrupt: - get_bad_stack + get_bad_stack_swi bad_save_user_regs bl do_software_interrupt |