diff options
Diffstat (limited to 'riscv')
-rw-r--r-- | riscv/csrs.cc | 3 | ||||
-rw-r--r-- | riscv/csrs.h | 1 | ||||
-rw-r--r-- | riscv/mmu.h | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/riscv/csrs.cc b/riscv/csrs.cc index 49717e5..3a32712 100644 --- a/riscv/csrs.cc +++ b/riscv/csrs.cc @@ -1421,6 +1421,7 @@ dcsr_csr_t::dcsr_csr_t(processor_t* const proc, const reg_t addr): ebreakvs(false), ebreakvu(false), v(false), + mprven(false), cause(0), ext_cause(0), cetrig(0), @@ -1450,6 +1451,7 @@ reg_t dcsr_csr_t::read() const noexcept { result = set_field(result, DCSR_STEP, step); result = set_field(result, DCSR_PRV, prv); result = set_field(result, CSR_DCSR_V, v); + result = set_field(result, DCSR_MPRVEN, mprven); result = set_field(result, DCSR_PELP, pelp); return result; } @@ -1464,6 +1466,7 @@ bool dcsr_csr_t::unlogged_write(const reg_t val) noexcept { ebreakvs = proc->extension_enabled('H') ? get_field(val, CSR_DCSR_EBREAKVS) : false; ebreakvu = proc->extension_enabled('H') ? get_field(val, CSR_DCSR_EBREAKVU) : false; v = proc->extension_enabled('H') ? get_field(val, CSR_DCSR_V) : false; + mprven = get_field(val, CSR_DCSR_MPRVEN); pelp = proc->extension_enabled(EXT_ZICFILP) ? static_cast<elp_t>(get_field(val, DCSR_PELP)) : elp_t::NO_LP_EXPECTED; cetrig = proc->extension_enabled(EXT_SMDBLTRP) ? get_field(val, DCSR_CETRIG) : false; diff --git a/riscv/csrs.h b/riscv/csrs.h index 97fd0f1..f076aaa 100644 --- a/riscv/csrs.h +++ b/riscv/csrs.h @@ -725,6 +725,7 @@ class dcsr_csr_t: public csr_t { bool ebreakvs; bool ebreakvu; bool v; + bool mprven; uint8_t cause; uint8_t ext_cause; bool cetrig; diff --git a/riscv/mmu.h b/riscv/mmu.h index 305d502..94f3a97 100644 --- a/riscv/mmu.h +++ b/riscv/mmu.h @@ -508,7 +508,7 @@ private: { return proc != nullptr && !(proc->state.mnstatus && !get_field(proc->state.mnstatus->read(), MNSTATUS_NMIE)) - && !proc->state.debug_mode + && (!proc->state.debug_mode || get_field(proc->state.dcsr->read(), DCSR_MPRVEN)) && get_field(proc->state.mstatus->read(), MSTATUS_MPRV); } |