.section .entry, "ax", %progbits
.align 3
.globl _trap_handler
+ .globl _trap_exit
_trap_handler:
TRAP_SAVE_AND_SETUP_SP_T0
TRAP_CALL_C_ROUTINE
- TRAP_RESTORE_GENERAL_REGS_EXCEPT_SP_T0
-
- TRAP_RESTORE_MEPC_MSTATUS 0
-
- TRAP_RESTORE_SP_T0
-
- mret
-
- .section .entry, "ax", %progbits
- .align 3
- .globl _trap_exit
_trap_exit:
add sp, a0, zero
.section .entry, "ax", %progbits
.align 3
.globl _trap_handler_rv32_hyp
+ .globl _trap_exit_rv32_hyp
_trap_handler_rv32_hyp:
TRAP_SAVE_AND_SETUP_SP_T0
TRAP_CALL_C_ROUTINE
- TRAP_RESTORE_GENERAL_REGS_EXCEPT_SP_T0
-
- TRAP_RESTORE_MEPC_MSTATUS 1
-
- TRAP_RESTORE_SP_T0
-
- mret
-
- .section .entry, "ax", %progbits
- .align 3
- .globl _trap_exit_rv32_hyp
_trap_exit_rv32_hyp:
add sp, a0, zero
int sbi_trap_redirect(struct sbi_trap_regs *regs,
struct sbi_trap_info *trap);
-void sbi_trap_handler(struct sbi_trap_regs *regs);
+struct sbi_trap_regs *sbi_trap_handler(struct sbi_trap_regs *regs);
void __noreturn sbi_trap_exit(const struct sbi_trap_regs *regs);
*
* @param regs pointer to register state
*/
-void sbi_trap_handler(struct sbi_trap_regs *regs)
+struct sbi_trap_regs *sbi_trap_handler(struct sbi_trap_regs *regs)
{
int rc = SBI_ENOTSUPP;
const char *msg = "trap handler failed";
msg = "unhandled external interrupt";
goto trap_error;
};
- return;
+ return regs;
}
switch (mcause) {
trap_error:
if (rc)
sbi_trap_error(msg, rc, mcause, mtval, mtval2, mtinst, regs);
+ return regs;
}
typedef void (*trap_exit_t)(const struct sbi_trap_regs *regs);