Webcentive RISC-V Reference

stval

Supervisor trap value

Address
0x143
Group
Supervisor-level CSRs
Privilege
SRW (privileged spec CSR listing, Supervisor Trap Handling)
Access
read/write; lowest privilege S (supervisor)
Address range
Standard read/write
Name in riscv-unified-db
Supervisor Trap Value

Privileged spec: Supervisor trap value

Description

Holds trap-specific information

From riscv-unified-db, reformatted.

Fields

FieldBitsTypeDescription
VALUERV32 31-0 / RV64 63-0RW-H

Written with trap-specific information when a trap is taken into S-mode.

The values are:

Exception typeValue
[0] Instruction address misalignedThe misaligned virtual PC (same as the value written to mepc).
[1] Instruction access faultThe (when C is implemented: portion of the) virtual PC causing the access fault (when C is not implemented: (same as the value written to mepc)).
[2] Illegal InstructionThe encoding of the illegal instruction.
[3] Breakpoint
[when,"REPORT_VA_IN_STVAL_ON_BREAKPOINT == true"] When caused by an EBREAK instruction, the virtual PC of the breakpoint instruction. [when,"REPORT_VA_IN_STVAL_ON_BREAKPOINT == false"] When caused by an EBREAK instruction, zero. When caused by a data address (i.e., watchpoint) breakpoint, the faulting virtual address. When caused by an instruction address breakpoint, the faulting virtual PC.
[4] Load address misalignedThe misaligned virtual load address.
[5] Load access fault
The part of virtual load address causing in the access fault. When the load is misaligned, the reported value is the smallest address on the page causing a fault (e.g., if an 8-byte load is equally split across a page and the fault occurs on the second page, address + 4 is reported). (Even though the access fault arises on a physical address, the virtual address is reported)
[6] Store/AMO address misalignedThe misaligned virtual store/AMO address.
[7] Store/AMO access fault
The virtual store/AMO address causing the access fault. When the store/AMO is misaligned, the reported value is the smallest address on the page causing a fault (e.g., if an 8-byte store is equally split across a page and the fault occurs on the second page, address + 4 is reported). (Even though the access fault arises on a physical address, the virtual address is reported)
[8] Environment call from U-mode (when H is implemented: or VU-mode)Zero
[9] Environment call from (H)S-modeZero When H is implemented:
[10] Environment call from VS-modeZero
[12] Instruction page fault
The (when C is implemented: portion of the) virtual PC causing the page fault (when C is not implemented: (same as the value written to mepc)).
[13] Load page fault
The part of the virtual load address causing in the page fault. When the load is misaligned, the reported value is the smallest address on the page causing a fault (e.g., if an 8-byte load is equally split across a page and the fault occurs on the second page, address + 4 is reported).
[15] Store/AMO page fault
The virtual store/AMO address causing in the page fault. When the store/AMO is misaligned, the reported value is the smallest address on the page causing a fault (e.g., if an 8-byte store is equally split across a page and the fault occurs on the second page, address + 4 is reported). When H is implemented:
[20] Instruction guest-page fault
The (when C is implemented: portion of the) virtual PC causing the fault (when C is not implemented: (same as the value written to mepc)). The guest physical address is reported in mtval2.
[21] Load guest-page fault
The part of the virtual address causing the fault. When the load is misaligned, the reported value is the smallest address on the page causing a fault (e.g., if an 8-byte load is equally split across a page and the fault occurs on the second page, address + 4 is reported). The guest physical address is reported in mtval2.
[22] Virtual instruction
The encoding of the faulting virtual instruction.
[23] Store/AMO guest-page fault
The part of the virtual address causing the fault. When the store/AMO is misaligned, the reported value is the smallest address on the page causing a fault (e.g., if an 8-byte store is equally split across a page and the fault occurs on the second page, address + 4 is reported). The guest physical address is reported in htval.

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

Specification and related pages