Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion arch/inst/I/mret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ access:
encoding:
match: "00110000001000000000000001110011"
operation(): |
if (implemented?(ExtensionName::S) && CSR[mstatus].MPP != 2'b11) {
if (CSR[mstatus].MPP != 2'b11) {
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) {
Expand Down
18 changes: 15 additions & 3 deletions arch/inst/Smrnmi/mnret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
$schema: inst_schema.json#
kind: instruction
name: mnret
long_name: No synopsis available.
long_name: Machine mode resume from the RNMI or Double Trap handler.
description: |
No description available.
MNRET is an M-mode-only instruction that uses the values in mnepc and mnstatus to return to the
program counter, privilege mode, and virtualization mode of the interrupted context. This instruction
also sets mnstatus.NMIE. If MNRET changes the privilege mode to a mode less privileged than M, it
also sets mstatus.MPRV to 0. If the Zicfilp extension is implemented, then if the new privileged mode is
y, MNRET sets ELP to the logical AND of yLPE (see Section 22.1.1) and mnstatus.MNPELP.
definedBy: Smrnmi
assembly: mnret
encoding:
Expand All @@ -18,9 +22,17 @@ access:
vu: always
data_independent_timing: false
operation(): |
if (implemented?(ExtensionName::S) && CSR[mstatus].MPP != 2'b11) {
if (CSR[mnstatus].MNPP != 2'b11) {
CSR[mstatus].MPRV = 0;
if (implemented?(ExtensionName::Smdbltrp)) {
if (xlen() == 64) {
CSR[mstatus].MDT = 1'b0;
} else {
CSR[mstatush].MDT = 1'b0;
}
}
}
CSR[mnstatus].NMIE = 1'b1;
if (CSR[mnstatus].MNPP == 2'b00) {
set_mode(PrivilegeMode::U);
} else if (CSR[mnstatus].MNPP == 2'b01) {
Expand Down
Loading