Machine-mode Return from Trap
Return from machine mode after handling a trap.
mret
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 00 | 11 | 000000 | 1 | 00000000000000 | 111 | 00 | 11 | ||||||||||||||||||||||||
if (CSR[mstatus].MPP != 2'b11) {
if (implemented?(ExtensionName::U)) {
CSR[mstatus].MPRV = 0;
}
}
if (implemented?(ExtensionName::Smdbltrp)) {
if (xlen() == 64) {
CSR[mstatus].MDT = 1'b0;
} else {
CSR[mstatush].MDT = 1'b0;
}
}
CSR[mstatus].MIE = CSR[mstatus].MPIE;
CSR[mstatus].MPIE = 1;
if (CSR[mstatus].MPP == 2'b00) {
set_mode(PrivilegeMode::U);
} else if (CSR[mstatus].MPP == 2'b01) {
set_mode(PrivilegeMode::S);
} else if (CSR[mstatus].MPP == 2'b11) {
set_mode(PrivilegeMode::M);
}
CSR[mstatus].MPP = implemented?(ExtensionName::U) ? 2'b00 : 2'b11;
$pc = CSR[mepc].sw_read();
Sm
| S | U | VS | VU |
|---|---|---|---|
| Never | Never | Never | Never |
Version af3eaf9+cheriot.f635218
Data from the RISC-V Unified Database, copyright RISC-V International and contributors.
CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.
This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.