aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/wfi.h
blob: 3411da0ce11651a76b4af010323f9275b3d1253e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
if (STATE.v && STATE.prv == PRV_U) {
  require_novirt();
} else if (get_field(STATE.mstatus->read(), MSTATUS_TW)) {
  require_privilege(PRV_M);
} else if (STATE.v) { // VS-mode
  if (get_field(STATE.hstatus->read(), HSTATUS_VTW))
    require_novirt();
} 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();