Webcentive RISC-V Reference

mnstatus

Resumable NMI status

Address
0x744
Group
Machine-level CSRs
Privilege
MRW (privileged spec CSR listing, Machine Non-Maskable Interrupt Handling)
Access
read/write; lowest privilege M (machine)
Address range
Standard read/write
Name in riscv-unified-db
Machine NMI Status

Privileged spec: Resumable NMI status

Description

The mnstatus register tracks and controls the hart's current NMI operating state.

From riscv-unified-db, reformatted.

Fields

FieldBitsTypeDescription
MNPP12-11RW-H

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.MNPRV is set, loads and stores behave as if the current privilege level were MNPP.
MNPELP9RW-H

M-mode NMI Previous Expected Landing Pad state.

Defined by the Zicfilp extension. Holds the previous Expected Landing Pad (ELP) state when entering M-mode NMI.

MNPV7RW-H

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.

NMIE3RW-H

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.

Fields from riscv-unified-db; field types computed by IDL functions there are not shown.

Specification and related pages