From 53d94b12bd9a7ef0d003f8b57b81f75a9e4527e6 Mon Sep 17 00:00:00 2001 From: jameshippisley Date: Fri, 5 Mar 2021 18:35:38 -0500 Subject: Don't make MPRV load/store virtual if MPV=1, MPP=3 (#666) * Don't make MPRV load/store virtual if MPV=1, MPP=3 * Use PRV_M instead of the value "3" --- riscv/mmu.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'riscv/mmu.cc') diff --git a/riscv/mmu.cc b/riscv/mmu.cc index 431dd44..a394e63 100644 --- a/riscv/mmu.cc +++ b/riscv/mmu.cc @@ -59,7 +59,7 @@ reg_t mmu_t::translate(reg_t addr, reg_t len, access_type type, uint32_t xlate_f if (type != FETCH) { if (!proc->state.debug_mode && get_field(proc->state.mstatus, MSTATUS_MPRV)) { mode = get_field(proc->state.mstatus, MSTATUS_MPP); - if (get_field(proc->state.mstatus, MSTATUS_MPV)) + if (get_field(proc->state.mstatus, MSTATUS_MPV) && mode != PRV_M) virt = true; } if (!proc->state.debug_mode && (xlate_flags & RISCV_XLATE_VIRT)) { -- cgit v1.1