arch/riscv: Use a separate trap stack
This is the lazy solution, as explained in the comment, but it works for now. Change-Id: I46e18b6d633280d6409e42462500fbe7c6823b4d Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-on: https://review.coreboot.org/21689 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
parent
c90f1d7be0
commit
5a6e389747
|
@ -128,10 +128,14 @@ trap_entry:
|
|||
.Lsmp_hang:
|
||||
bnez sp, .Lsmp_hang
|
||||
|
||||
# TODO: Use the old stack pointer (plus an offset) for exceptions in machine
|
||||
# mode, to avoid overwriting stack data.
|
||||
la sp, _estack
|
||||
addi sp,sp,-MENTRY_FRAME_SIZE
|
||||
# Use a different stack than in the main context, to to avoid overwriting
|
||||
# stack data.
|
||||
# TODO: Maybe use the old stack pointer (plus an offset) instead. But only if
|
||||
# the previous mode was M, because it would be a very bad idea to use a stack
|
||||
# pointer provided by unprivileged code!
|
||||
la sp, _estack
|
||||
addi sp, sp, -2048 # 2 KiB is half of the stack space
|
||||
addi sp, sp, -MENTRY_FRAME_SIZE
|
||||
|
||||
save_tf
|
||||
move a0,sp
|
||||
|
|
Loading…
Reference in New Issue