aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/wfi.h
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/insns/wfi.h')
-rw-r--r--riscv/insns/wfi.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/riscv/insns/wfi.h b/riscv/insns/wfi.h
index 299cb01..3411da0 100644
--- a/riscv/insns/wfi.h
+++ b/riscv/insns/wfi.h
@@ -5,7 +5,9 @@ if (STATE.v && STATE.prv == PRV_U) {
} else if (STATE.v) { // VS-mode
if (get_field(STATE.hstatus->read(), HSTATUS_VTW))
require_novirt();
-} else {
+} else if (p->extension_enabled('S')) {
+ // When S-mode is implemented, then executing WFI in
+ // U-mode causes an illegal instruction exception.
require_privilege(PRV_S);
}
wfi();