diff options
Diffstat (limited to 'riscv')
-rw-r--r-- | riscv/csrs.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/riscv/csrs.cc b/riscv/csrs.cc index f2511e7..ea535f6 100644 --- a/riscv/csrs.cc +++ b/riscv/csrs.cc @@ -556,9 +556,8 @@ bool mstatus_csr_t::unlogged_write(const reg_t val) noexcept { const reg_t requested_mpp = proc->legalize_privilege(get_field(val, MSTATUS_MPP)); const reg_t adjusted_val = set_field(val, MSTATUS_MPP, requested_mpp); reg_t new_mstatus = (read() & ~mask) | (adjusted_val & mask); - if (new_mstatus & MSTATUS_MDT) { - new_mstatus = new_mstatus & ~MSTATUS_MIE; - } + new_mstatus = (new_mstatus & MSTATUS_MDT) ? (new_mstatus & ~MSTATUS_MIE) : new_mstatus; + new_mstatus = (new_mstatus & MSTATUS_SDT) ? (new_mstatus & ~MSTATUS_SIE) : new_mstatus; maybe_flush_tlb(new_mstatus); this->val = adjust_sd(new_mstatus); return true; |