mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
firware: optimize the exception exit code
There are two copies of the same abnormal exit code, this patch deletes one Signed-off-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
@@ -711,6 +711,7 @@ fw_platform_init:
|
|||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
.align 3
|
.align 3
|
||||||
.globl _trap_handler
|
.globl _trap_handler
|
||||||
|
.globl _trap_exit
|
||||||
_trap_handler:
|
_trap_handler:
|
||||||
TRAP_SAVE_AND_SETUP_SP_T0
|
TRAP_SAVE_AND_SETUP_SP_T0
|
||||||
|
|
||||||
@@ -720,17 +721,6 @@ _trap_handler:
|
|||||||
|
|
||||||
TRAP_CALL_C_ROUTINE
|
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:
|
_trap_exit:
|
||||||
add sp, a0, zero
|
add sp, a0, zero
|
||||||
|
|
||||||
@@ -746,6 +736,7 @@ _trap_exit:
|
|||||||
.section .entry, "ax", %progbits
|
.section .entry, "ax", %progbits
|
||||||
.align 3
|
.align 3
|
||||||
.globl _trap_handler_rv32_hyp
|
.globl _trap_handler_rv32_hyp
|
||||||
|
.globl _trap_exit_rv32_hyp
|
||||||
_trap_handler_rv32_hyp:
|
_trap_handler_rv32_hyp:
|
||||||
TRAP_SAVE_AND_SETUP_SP_T0
|
TRAP_SAVE_AND_SETUP_SP_T0
|
||||||
|
|
||||||
@@ -755,17 +746,6 @@ _trap_handler_rv32_hyp:
|
|||||||
|
|
||||||
TRAP_CALL_C_ROUTINE
|
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:
|
_trap_exit_rv32_hyp:
|
||||||
add sp, a0, zero
|
add sp, a0, zero
|
||||||
|
|
||||||
|
@@ -205,7 +205,7 @@ struct sbi_trap_info {
|
|||||||
int sbi_trap_redirect(struct sbi_trap_regs *regs,
|
int sbi_trap_redirect(struct sbi_trap_regs *regs,
|
||||||
struct sbi_trap_info *trap);
|
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);
|
void __noreturn sbi_trap_exit(const struct sbi_trap_regs *regs);
|
||||||
|
|
||||||
|
@@ -210,7 +210,7 @@ int sbi_trap_redirect(struct sbi_trap_regs *regs,
|
|||||||
*
|
*
|
||||||
* @param regs pointer to register state
|
* @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;
|
int rc = SBI_ENOTSUPP;
|
||||||
const char *msg = "trap handler failed";
|
const char *msg = "trap handler failed";
|
||||||
@@ -236,7 +236,7 @@ void sbi_trap_handler(struct sbi_trap_regs *regs)
|
|||||||
msg = "unhandled external interrupt";
|
msg = "unhandled external interrupt";
|
||||||
goto trap_error;
|
goto trap_error;
|
||||||
};
|
};
|
||||||
return;
|
return regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mcause) {
|
switch (mcause) {
|
||||||
@@ -271,6 +271,7 @@ void sbi_trap_handler(struct sbi_trap_regs *regs)
|
|||||||
trap_error:
|
trap_error:
|
||||||
if (rc)
|
if (rc)
|
||||||
sbi_trap_error(msg, rc, mcause, mtval, mtval2, mtinst, regs);
|
sbi_trap_error(msg, rc, mcause, mtval, mtval2, mtinst, regs);
|
||||||
|
return regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (*trap_exit_t)(const struct sbi_trap_regs *regs);
|
typedef void (*trap_exit_t)(const struct sbi_trap_regs *regs);
|
||||||
|
Reference in New Issue
Block a user