CSR Bit Fields

RISC-V mnscratch CSR Register

Address 0x740Privilege MachineAccess MRW (Smrnmi) / MXLENReserved, custom, or uncategorized CSRs

An Smrnmi Machine-mode scratch CSR that lets an RNMI handler save and restore the interrupted context.

Field Map

Understand mnscratch By Bit Fields

1 key fields
MXLEN-1:0

VALUE

RW

The complete MXLEN-bit mnscratch value, used by an RNMI handler to save and restore the interrupted context.

VALUE (bits MXLEN-1:0) — The complete MXLEN-bit mnscratch value, used by an RNMI handler to save and restore the interrupted context.

What This Field Controls

  • - The complete MXLEN-bit mnscratch value, used by an RNMI handler to save and restore the interrupted context.

Common Values

This field is better understood together with surrounding context than as a fixed memorized enumeration.

Official Basis & Search Notes

Smrnmi mnscratch is an MXLEN-bit read-write register for an RNMI handler to save and restore the interrupted context.

Section 8.3 defines it as an MXLEN-bit read-write register.
It lets the RNMI handler save and restore the interrupted context.

What To Check First When Reading This CSR

  • - mnscratch is added only by Smrnmi; the CSR listing classifies it as MRW.
  • - It is one complete MXLEN-bit read-write scratch value; reserved-bit and concurrent-hardware-update templates do not apply.

Risk Checks Before Writing

  • - The RNMI handler must arrange saving and restoring this scratch value itself; the manual specifies no field-level write side effect.

Put It Back Into A Real Flow

1

Confirm that the hart implements Smrnmi.

2

Use mnscratch for scratch state needed to save or restore the interrupted context in the RNMI handler.

3

Resume from the RNMI handler with MNRET.

FAQ

Is mnscratch always present?

No. It is added by the Smrnmi extension.