hedeleg
Hypervisor exception delegation register
- Address
0x602- Group
- Hypervisor and VS CSRs
- Privilege
HRW(privileged spec CSR listing, Hypervisor Trap Setup)- Access
- read/write; lowest privilege H (hypervisor, including VS CSRs)
- Address range
- Standard read/write
- Name in riscv-unified-db
- Hypervisor Exception Delegation
Privileged spec: Hypervisor exception delegation register
Description
Controls exception delegation from HS-mode to VS-mode.
By default, all traps at any privilege level are handled in M-mode, though M-mode usually uses
the medeleg and mideleg CSRs to delegate some traps to HS-mode. The hedeleg and hideleg
CSRs allow these traps to be further delegated to a VS-mode guest; their layout is the same as
medeleg and mideleg.
A synchronous trap that has been delegated to HS-mode (using medeleg)
is further delegated to VS-mode if V=1 before the trap and the
corresponding hedeleg bit is set. Each bit of hedeleg shall be
either writable or read-only zero. Many bits of hedeleg are required
specifically to be writable or zero. Bit 0, corresponding to
instruction address misaligned exceptions, must be writable if
IALIGN=32.
Note
Requiring that certain bits of hedeleg be writable reduces some of the
burden on a hypervisor to handle variations of implementation.
When XLEN=32, hedelegh is a 32-bit read/write register
that aliases bits 63:32 of hedeleg.
Register hedelegh does not exist when XLEN=64.
From riscv-unified-db, reformatted.
Fields
| Field | Bits | Type | Description |
|---|---|---|---|
IAM | 0 | Instruction Address Misaligned Controls delegation of Instruction Address Misaligned exceptions to VS-mode. See This field must be writable if IALIGN=32. | |
IAF | 1 | RW | Instruction Access Fault Controls delegation of Instruction Access Fault exceptions to VS-mode. See |
II | 2 | RW | Illegal Instruction Controls delegation of Illegal Instruction exceptions to VS-mode. See |
B | 3 | RW | Breakpoint Controls delegation of Breakpoint exceptions to VS-mode. See |
LAM | 4 | RW | Load Address Misaligned Controls delegation of Load Address Misaligned exceptions to VS-mode. See |
LAF | 5 | RW | Load Access Fault Controls delegation of Load Access Fault exceptions to VS-mode. See |
SAM | 6 | RW | Store/AMO Address Misaligned Controls delegation of Store/AMO Address Misaligned exceptions to VS-mode. See |
SAF | 7 | RW | Store/AMO Access Fault Controls delegation of Store/AMO Access Fault exceptions to VS-mode. See |
EU | 8 | RW | Environment Call from VU-mode Controls delegation of Environment Call from VU-mode exceptions to VS-mode. See |
ES | 9 | RO | Environment Call from HS-mode Environment Call from HS-mode exceptions cannot be delegated to VS-mode, so this field is read-only 0. See |
EVS | 10 | RO | Environment Call from VS-mode Environment Call from VS-mode exceptions cannot be delegated to VS-mode, so this field is read-only 0. See |
EM | 11 | RO | Environment Call from M-mode Environment Call from M-mode exceptions cannot be delegated to VS-mode, so this field is read-only 0. See |
IPF | 12 | RW | Instruction Page Fault Controls delegation of Instruction Page Fault exceptions to VS-mode. See |
LPF | 13 | RW | Load Page Fault Controls delegation of Load Page Fault exceptions to VS-mode. See |
SPF | 15 | RW | Store/AMO Page Fault Controls delegation of Store/AMO Page Fault exceptions to VS-mode. See |
DT | 16 | RO | Double Trap Double Trap exceptions cannot be delegated to VS-mode, so this field is read-only 0. |
SWC | 18 | RW | Software Check Controls delegation of Software Check exceptions to VS-mode. |
HWE | 19 | RW | Hardware Error Controls delegation of Hardware Error exceptions to VS-mode. |
IGPF | 20 | RO | Instruction Guest Page Fault Instruction Guest Page Fault exceptions cannot be delegated to VS-mode, so this field is read-only 0. See |
LGPF | 21 | RO | Load Guest Page Fault Load Guest Page Fault exceptions cannot be delegated to VS-mode, so this field is read-only 0. See |
VI | 22 | RO | Virtual Instruction Virtual Instruction exceptions cannot be delegated to VS-mode, so this field is read-only 0. See |
SGPF | 23 | RO | Store/AMO Guest Page Fault Store/AMO Guest Page Fault exceptions cannot be delegated to VS-mode, so this field is read-only 0. See |
Fields from riscv-unified-db; field types computed by IDL functions there are not shown.
Specification and related pages
- The RISC-V Instruction Set Manual, Volume II: CSR listing (src/priv/csrs.adoc)
- riscv-opcodes csrs.csv
- riscv-unified-db: spec/std/isa/csr/hedeleg.yaml
- csrrw, csrrs, csrrc (Zicsr instructions that access CSRs)