mnstatus
Machine NMI Status
The mnstatus register tracks and controls the hart’s current NMI operating state.
Attributes
Requirement |
|||
|---|---|---|---|
Defining extensions |
|
||
CSR Address |
0x744 |
||
Length |
* 32 when CSR[misa].MXL == 0 * 64 when CSR[misa].MXL == 1 |
||
Privilege Mode |
M |
Format
This CSR format changes dynamically.
Field Summary
| Name | Location | Type | Reset Value |
|---|---|---|---|
12:11 |
RW-H |
UNDEFINED_LEGAL |
|
7 |
RW-H |
UNDEFINED_LEGAL |
|
3 |
RW-H |
0 |
Fields
MNPP
- Location
-
12:11
- Description
-
M-mode NMI Previous Privilege.
Written by hardware in two cases:
-
Written with the prior nominal privilege level when entering M-mode NMI from an exception/interrupt.
-
Written with 0 when executing an mnret instruction to return from a double exception / NMI in M-mode.
Can also be written by software without immediate side-effect.
Affects execution in two cases:
-
On a return from a double exception / NMI from M-mode, the machine will enter the privilege level stored in MNPP before clearing the field.
-
When mnstatus is set, loads and stores behave as if the current privilege level were MNPP.
- Type
-
RW-H
- Reset value
-
UNDEFINED_LEGAL
MNPV
- Location
-
7
- Description
-
Machine Previous NMI Virtualization mode
Written with the prior virtualization mode when entering M-mode from an exception/interrupt. When returning via an MRET instruction, the virtualization mode becomes the value of MPV unless MPP=3, in which case the virtualization mode is always 0. Can also be written by software.
- Type
-
RW-H
- Reset value
-
UNDEFINED_LEGAL
NMIE
- Location
-
3
- Description
-
M-mode NMI Enable
Written by hardware in two cases:
-
Written with the value 0 when entering M-mode NMI.
-
Written with the value 0 when entering M-mode double trap.
Written by software in one case only:
-
The NMIE is 0 on reset for boot code to initialize system to service NMIs. Once SW writes NMIE to 1, it cannot be changed anymore by SW.
Affects execution by:
-
When 0, all non-maskable interrupts and exceptions are disabled when the current privilege level is M.
-
When 1, NMI or double trap is possible.
- Type
-
RW-H
- Reset value
-
0
Software write
This CSR may store a value that is different from what software attempts to write.
When a software write occurs (e.g., through csrrw), the following determines the written value:
MNPP = if (csr_value.MNPP == 2'b01 && !implemented?(ExtensionName::S)) {
return UNDEFINED_LEGAL_DETERMINISTIC;
} else if (csr_value.MNPP == 2'b00 && !implemented?(ExtensionName::U)) {
return UNDEFINED_LEGAL_DETERMINISTIC;
} else if (csr_value.MNPP == 2'b10) {
# never a valid value
return UNDEFINED_LEGAL_DETERMINISTIC;
} else {
return csr_value.MNPP;
}
MNPV = csr_value.MNPV
NMIE = csr_value.NMIE