CSR Bit Fields

RISC-V vsscratch CSR Register

Address 0x240Privilege Hypervisor direct / VS aliasAccess HRW / VSXLENHypervisor and virtualization CSRs

vsscratch holds VS trap-handler scratch value as the VS copy of the corresponding supervisor CSR.

Field Map

Understand vsscratch By Bit Fields

1 key fields
VSXLEN-1:0

SCRATCH

RW

vsscratch VS trap-handler scratch value; exact fields follow the corresponding supervisor CSR semantics for the VS copy.

SCRATCH (bits VSXLEN-1:0) — vsscratch VS trap-handler scratch value; exact fields follow the corresponding supervisor CSR semantics for the VS copy.

What This Field Controls

  • - vsscratch VS trap-handler scratch value; exact fields follow the corresponding supervisor CSR semantics for the VS copy.

Common Values

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

Open Official Manual
Official Basis & Search Notes

vsscratch is a VS supervisor state or trap CSR. The separate CSR address is for M/HS-side management; when V=1, guest access to the corresponding supervisor CSR is substituted with VS state unless an extension specifies otherwise.

vsscratch address, access class, and width are checked against the official CSR tables: 0x240, HRW, VSXLEN.
The H extension specifies that, when V=1, access to the corresponding supervisor CSR is substituted with the VS CSR.
When writing, modify only officially defined fields; handle WARL, WLRL, WPRI, and reserved fields according to the official specification and implementation behavior.

What To Check First When Reading This CSR

  • - vsscratch's separate CSR address is in the official HRW access class; a VS/VU guest normally reaches VS state through the corresponding supervisor CSR alias.
  • - Before reading it, confirm that the defining extension such as H, AIA, Sstc, Smstateen, or Smcsrind is implemented.

Risk Checks Before Writing

  • - When writing vsscratch, modify only officially defined target fields and preserve WPRI, reserved, and unchanged fields.

Put It Back Into A Real Flow

1

M/HS software may access the VS copy through the separate CSR address.

2

When V=1, guest access to the corresponding supervisor CSR aliases to VS state; direct access to the separate VS CSR address raises a virtual-instruction exception.

3

Update only official fields and do not treat VS state as ordinary HS supervisor state.

FAQ

Can VS-mode directly access vsscratch's separate CSR address?

No. The H extension substitutes VS state for the corresponding supervisor CSR when V=1; direct access to the separate VS CSR address raises a virtual-instruction exception.

What does vsscratch mainly hold?

vsscratch holds VS trap-handler scratch value, allowing the hypervisor to manage guest-supervisor trap, status, or execution context.