arch/riscv: Unify trap return
Change-Id: I9de0c92b3f925e8f4db00d7281222a07db68b2ae Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-on: https://review.coreboot.org/21763 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
parent
0baad61a4e
commit
3f75f5da42
|
@ -69,7 +69,7 @@ void handle_supervisor_call(trapframe *tf) {
|
||||||
}
|
}
|
||||||
tf->gpr[10] = returnValue;
|
tf->gpr[10] = returnValue;
|
||||||
write_csr(mepc, read_csr(mepc) + 4);
|
write_csr(mepc, read_csr(mepc) + 4);
|
||||||
asm volatile("j supervisor_call_return");
|
asm volatile("j trap_return");
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *const exception_names[] = {
|
static const char *const exception_names[] = {
|
||||||
|
@ -264,7 +264,7 @@ void handle_misaligned_load(trapframe *tf) {
|
||||||
|
|
||||||
// return to where we came from
|
// return to where we came from
|
||||||
write_csr(mepc, read_csr(mepc) + 4);
|
write_csr(mepc, read_csr(mepc) + 4);
|
||||||
asm volatile("j machine_call_return");
|
asm volatile("j trap_return");
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_misaligned_store(trapframe *tf) {
|
void handle_misaligned_store(trapframe *tf) {
|
||||||
|
@ -292,5 +292,5 @@ void handle_misaligned_store(trapframe *tf) {
|
||||||
|
|
||||||
// return to where we came from
|
// return to where we came from
|
||||||
write_csr(mepc, read_csr(mepc) + 4);
|
write_csr(mepc, read_csr(mepc) + 4);
|
||||||
asm volatile("j machine_call_return");
|
asm volatile("j trap_return");
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,15 +140,10 @@ trap_entry:
|
||||||
save_tf
|
save_tf
|
||||||
move a0,sp
|
move a0,sp
|
||||||
jal trap_handler
|
jal trap_handler
|
||||||
.global supervisor_call_return
|
|
||||||
supervisor_call_return:
|
.global trap_return
|
||||||
csrr a0, mscratch
|
trap_return:
|
||||||
restore_regs
|
csrr a0, mscratch
|
||||||
# go back into supervisor call
|
restore_regs
|
||||||
mret
|
# go back to the previous mode
|
||||||
.global machine_call_return
|
mret
|
||||||
machine_call_return:
|
|
||||||
csrr a0, mscratch
|
|
||||||
restore_regs
|
|
||||||
# go back into machine call
|
|
||||||
mret
|
|
||||||
|
|
Loading…
Reference in New Issue