mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
lib: sbi_trap: Restore redirect for access faults
commit764a17d852
("lib: sbi: Implement firmware counters") added switch cases for CAUSE_LOAD_ACCESS and CAUSE_STORE_ACCESS. This caused them to stop being redirected to U or S mode, as that is handled in the default switch case. As a result, an error in userspace could cause the system to hang. Fix this by allowing the acces fault case to fall through to the default case. Fixes:764a17d852
("lib: sbi: Implement firmware counters") Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:

committed by
Anup Patel

parent
33eac764f2
commit
ee274377b2
@@ -259,11 +259,10 @@ struct sbi_trap_regs *sbi_trap_handler(struct sbi_trap_regs *regs)
|
||||
msg = "ecall handler failed";
|
||||
break;
|
||||
case CAUSE_LOAD_ACCESS:
|
||||
sbi_pmu_ctr_incr_fw(SBI_PMU_FW_ACCESS_LOAD);
|
||||
break;
|
||||
case CAUSE_STORE_ACCESS:
|
||||
sbi_pmu_ctr_incr_fw(SBI_PMU_FW_ACCESS_STORE);
|
||||
break;
|
||||
sbi_pmu_ctr_incr_fw(mcause == CAUSE_LOAD_ACCESS ?
|
||||
SBI_PMU_FW_ACCESS_LOAD : SBI_PMU_FW_ACCESS_STORE);
|
||||
/* fallthrough */
|
||||
default:
|
||||
/* If the trap came from S or U mode, redirect it there */
|
||||
trap.epc = regs->mepc;
|
||||
|
Reference in New Issue
Block a user