aboutsummaryrefslogtreecommitdiff
path: root/riscv/mmu.h
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/mmu.h')
-rw-r--r--riscv/mmu.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/riscv/mmu.h b/riscv/mmu.h
index 56789e0..ef054cf 100644
--- a/riscv/mmu.h
+++ b/riscv/mmu.h
@@ -403,6 +403,14 @@ private:
return (uint16_t*)(translate_insn_addr(addr).host_offset + addr);
}
+ inline bool in_mprv()
+ {
+ return proc != nullptr
+ && !(proc->state.mnstatus && !get_field(proc->state.mnstatus->read(), MNSTATUS_NMIE))
+ && !proc->state.debug_mode
+ && get_field(proc->state.mstatus->read(), MSTATUS_MPRV);
+ }
+
reg_t pmp_homogeneous(reg_t addr, reg_t len);
bool pmp_ok(reg_t addr, reg_t len, access_type type, reg_t mode);