Skip to content

Commit

Permalink
Remove incorrect privilege assert
Browse files Browse the repository at this point in the history
The condition checks whether it's possible for a mode other than
machine mode to take interrupts, but just because it can't, that
doesn't mean we can never call this function while in another
mode.
In particular, this causes a crash if you run with S mode disabled
but U mode enabled, then mret to U mode without NExt.
  • Loading branch information
PeterRugg committed Sep 4, 2024
1 parent a58c58c commit 6288a9b
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion model/riscv_sys_control.sail
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ function dispatchInterrupt(priv : Privilege) -> option((InterruptType, Privilege
* Absence of U-mode implies absence of S-mode.
*/
if not(extensionEnabled(Ext_U)) | (not(extensionEnabled(Ext_S)) & not(extensionEnabled(Ext_N))) then {
assert(priv == Machine, "invalid current privilege");
let enabled_pending = mip.bits & mie.bits;
match findPendingInterrupt(enabled_pending) {
Some(i) => let r = (i, Machine) in Some(r),
Expand Down

0 comments on commit 6288a9b

Please sign in to comment.