CSR Bit Fields

RISC-V vsepc CSR Register

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

vsepc holds VS exception program counter as the VS copy of the corresponding supervisor CSR.

Field Map

Understand vsepc By Bit Fields

1 key fields
VSXLEN-1:0

EPC

RW

vsepc VS exception program counter; exact fields follow the corresponding supervisor CSR semantics for the VS copy.

EPC (bits VSXLEN-1:0) — vsepc VS exception program counter; exact fields follow the corresponding supervisor CSR semantics for the VS copy.

What This Field Controls

  • - vsepc VS exception program counter; 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

vsepc 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.

vsepc address, access class, and width are checked against the official CSR tables: 0x241, 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

  • - vsepc'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 vsepc, 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 vsepc'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 vsepc mainly hold?

vsepc holds VS exception program counter, allowing the hypervisor to manage guest-supervisor trap, status, or execution context.