diff options
author | Xiang W <wxjstz@126.com> | 2024-03-04 20:15:49 +0800 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2024-03-09 18:04:39 +0530 |
commit | b27b7c6d8829d7e59cc68583129a6dfda930ea2e (patch) | |
tree | aaec695050a6fc1557170a78098897e50c427927 /firmware | |
parent | fdf5589f049f144eeb7d28484ad9a8444bf8410f (diff) | |
download | opensbi-b27b7c6d8829d7e59cc68583129a6dfda930ea2e.zip opensbi-b27b7c6d8829d7e59cc68583129a6dfda930ea2e.tar.gz opensbi-b27b7c6d8829d7e59cc68583129a6dfda930ea2e.tar.bz2 |
firmware: fw_base: Simplified setup trap handler
The same detection was done twice when setting mtvec and trap_exit.
Merging can reduce code size.
Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/fw_base.S | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/firmware/fw_base.S b/firmware/fw_base.S index c657bd9..d87c0a5 100644 --- a/firmware/fw_base.S +++ b/firmware/fw_base.S @@ -456,22 +456,14 @@ _start_warm: srli a5, a5, ('H' - 'A') andi a5, a5, 0x1 beq a5, zero, _skip_trap_handler_rv32_hyp - lla a4, _trap_handler_rv32_hyp -_skip_trap_handler_rv32_hyp: -#endif - csrw CSR_MTVEC, a4 - -#if __riscv_xlen == 32 /* Override trap exit for H-extension */ - csrr a5, CSR_MISA - srli a5, a5, ('H' - 'A') - andi a5, a5, 0x1 - beq a5, zero, _skip_trap_exit_rv32_hyp - lla a4, _trap_exit_rv32_hyp csrr a5, CSR_MSCRATCH + lla a4, _trap_exit_rv32_hyp REG_S a4, SBI_SCRATCH_TRAP_EXIT_OFFSET(a5) -_skip_trap_exit_rv32_hyp: + lla a4, _trap_handler_rv32_hyp +_skip_trap_handler_rv32_hyp: #endif + csrw CSR_MTVEC, a4 /* Initialize SBI runtime */ csrr a0, CSR_MSCRATCH |