summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/riscv/trap_handler.c2
-rw-r--r--src/arch/riscv/trap_util.S2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/arch/riscv/trap_handler.c b/src/arch/riscv/trap_handler.c
index f5953d32ed..8cb27de045 100644
--- a/src/arch/riscv/trap_handler.c
+++ b/src/arch/riscv/trap_handler.c
@@ -150,7 +150,7 @@ void trap_handler(trapframe *tf)
/* This function used to redirect trap to s-mode. */
void redirect_trap(void)
{
- write_csr(sbadaddr, read_csr(mbadaddr));
+ write_csr(stval, read_csr(mtval));
write_csr(sepc, read_csr(mepc));
write_csr(scause, read_csr(mcause));
write_csr(mepc, read_csr(stvec));
diff --git a/src/arch/riscv/trap_util.S b/src/arch/riscv/trap_util.S
index 6b03eb5512..c5691c595f 100644
--- a/src/arch/riscv/trap_util.S
+++ b/src/arch/riscv/trap_util.S
@@ -80,7 +80,7 @@
csrrw t0,mscratch,x0
csrr s0,mstatus
csrr t1,mepc
- csrr t2,mbadaddr
+ csrr t2,mtval
csrr t3,mcause
STORE t0,2*REGBYTES(x2)
STORE s0,32*REGBYTES(x2)