aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/dret.h
blob: bdcf3dbb609fe66745ca0bc2fead9d6ddfc2eccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require(STATE.debug_mode);
set_pc_and_serialize(STATE.dpc->read());
if (ZICFILP_xLPE(STATE.dcsr->v, STATE.dcsr->prv)) {
  STATE.elp = STATE.dcsr->pelp;
}
p->set_privilege(STATE.dcsr->prv, STATE.dcsr->v);
if (STATE.prv < PRV_M)
  STATE.mstatus->write(STATE.mstatus->read() & ~MSTATUS_MPRV);

/* We're not in Debug Mode anymore. */
STATE.debug_mode = false;

if (STATE.dcsr->step)
  STATE.single_step = STATE.STEP_STEPPING;