Skip to content

Commit

Permalink
Merge pull request #1859 from ved-rivos/issue_1857
Browse files Browse the repository at this point in the history
Add missing priv qualification to prev_virt
  • Loading branch information
aswaterman authored Nov 14, 2024
2 parents 4156e07 + 64972b7 commit 2c67071
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion riscv/insns/mret.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (ZICFILP_xLPE(prev_virt, prev_prv)) {
}
s = set_field(s, MSTATUS_MPELP, elp_t::NO_LP_EXPECTED);
s = set_field(s, MSTATUS_MDT, 0);
if (prev_prv == PRV_U || prev_virt)
if (prev_prv == PRV_U || (prev_virt && prev_prv != PRV_M))
s = set_field(s, MSTATUS_SDT, 0);
if (prev_virt && prev_prv == PRV_U)
STATE.vsstatus->write(STATE.vsstatus->read() & ~SSTATUS_SDT);
Expand Down

0 comments on commit 2c67071

Please sign in to comment.