kernel/arch/riscv64: restore SSTATUS register first

It cause to disable interrupts needed for correct trap frame restore.

Change-Id: I8b60023c9a878eb147796e76adb344c377cfcf11
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5255
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: X512 <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: Alex von Gluck IV <[email protected]>
This commit is contained in:
X512
2023-04-30 23:46:57 +00:00
committed by Alex von Gluck IV
parent 997adc7e61
commit b01b40745e
+3 -3
View File
@@ -64,14 +64,14 @@ FUNCTION(SVecU):
call STrap
FUNCTION(SVecURet):
ld t0, IFRAME_status(sp)
csrw sstatus, t0
csrw sscratch, fp # save kernel SP
la t0, SVecU
csrw stvec, t0
ld t0, IFRAME_status(sp)
csrw sstatus, t0
ld tp, IFRAME_tp(sp)
ld t0, IFRAME_epc(sp)
csrw sepc, t0