aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/dret.h
blob: ffbe0ae5111136510ac2449657027d72f31b0566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
require(STATE.debug_mode);
p->stash_privilege();
set_pc_and_serialize(STATE.dpc->read());
p->set_privilege(STATE.dcsr->prv);
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;