ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 1,823 microarchs · 16,083 chips · 105 sources
Arch:
Tier:

dret

T1 riscv alu insn
Return from Debug Mode
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRV32/RV64 Sdext
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
Privilegemachine
ExtensionsSdext

Summary

Resumes execution after Debug Mode. dret is only legal in Debug Mode; executing it in any other mode raises an Illegal Instruction exception.

Syntax / Encoding

dret | 01111011001000000000000001110011 (mask=0xffffffff match=0x7b200073)

Binary Encodings (1)

WidthFormatBit PatternMask / Match
32RV011110110010000000000000011100110xffffffff / 0x7b200073

Reference Notes

Resumes execution after Debug Mode. `dret` is only legal in Debug Mode;
executing it in any other mode raises an Illegal Instruction exception.

When executed in Debug Mode, `dret`:

. Sets the PC to the value in `dpc`.
. Changes the privilege and virtualization mode to those held in
  `dcsr.PRV` and `dcsr.V`.
. If the new privilege mode is less privileged than M-mode, clears
  `mstatus.MPRV`.
. If Smdbltrp is implemented and the new privilege mode is less privileged
  than M-mode, clears `mstatus.MDT`.
. If Ssdbltrp is implemented and the new privilege mode is U, VS, or VU,
  clears `sstatus.SDT`; if the new mode is VU, also clears `vsstatus.SDT`.
. If Zicfilp is implemented, sets `ELP` to `dcsr.PELP` if Zicfilp is
  enabled (`xLPE`=1) in the new privilege mode, otherwise to
  `NO_LP_EXPECTED`, and then clears `dcsr.PELP`.
. Leaves Debug Mode.