← Home

hstatus

Hypervisor Status

Address: 0x600 (1536) · Privilege: S · Length: SXLEN · Writable · Defined by: H

The hstatus register tracks and controls a VS-mode guest.

Unlike fields in `sstatus`, which are all aliases of fields `mstatus`, bits in `hstatus` are independent bits and do not have aliases.

Fields

RV32

31:2423:1615:87:0
—HUKTE—VTSRVTWVTVM—VGEIN—HUSPVPSPVGVAVSBE—

RV64

63:5655:4847:4039:3231:2423:1615:87:0
—VSXL—HUKTE—VTSRVTWVTVM—VGEIN—HUSPVPSPVGVAVSBE—
BitsFieldAliasDescriptionTypeReset
[33:32]VSXL[{'text': 'Determines the effective XLEN in VS-mode. Valid values are:\n\n[separator="!"]\n!===\n! Value ! VSXLEN\n\n! 0 ! 32\n! 1 ! 64\n!===\n', 'when()': 'return $array_size(VSXLEN) > 1;'}, {'text': 'Because the implementation only supports a single VSXLEN == 32, this field is read-only-0.\n', 'when()': 'return $array_size(VSXLEN) == 1 && $array_includes?(VSXLEN, 32);'}, {'text': 'Because the implementation only supports a single VSXLEN == 64, this field is read-only-1.\n', 'when()': 'return $array_size(VSXLEN) == 1 && $array_includes?(VSXLEN, 64);'}]
if ($array_size(VSXLEN) == 1) {
  return CsrFieldType::RO;
} else {
  return CsrFieldType::RW;
}
if ($array_size(VSXLEN) == 1 && VSXLEN[0] == 32) {
  # immutable, always 0
  return 0;
} else if ($array_size(VSXLEN) == 1 && VSXLEN[0] == 64) {
  # immutable, always 1
  return 1;
} else {
  # mutable, undefined reset state
  return UNDEFINED_LEGAL;
}
[24]HUKTEIf the Svukte extension is implemented, the HUKTE field determines whether the HLV, HLVX, and HSV instructions, when executed in U-mode, are Svukte-qualified. When one of these instructions is executed in U-mode, it behaves as though `senvcfg`.UKTE were set to the value of HUKTE. If Svukte is not implemented, HUKTE is read-only zero.RWUNDEFINED_LEGAL
[22]VTSRWhen `hstatus.VTSR` is set, executing the `sret` instruction in VS-mode raises a `Virtual Instruction` exception. When `hstatus.VTSR` is clear, an `sret` instruction in VS-mode returns control to the mode stored in `vsstatus.SPP`.RWUNDEFINED_LEGAL
[21]VTWWhen `hstatus.VTW` is set, a `wfi` instruction executed in VS-mode raises a `Virtual Instruction` exception after waiting an implementation-defined amount of time (which can be 0). When both `hstatus.VTW` and `mstatus.TW` are clear, a `wfi` instruction executes in VS-mode without a timeout period. The `wfi` instruction is also affected by `mstatus.TW`, as shown below: .2+! [.rotate]#`mstatus.TW`# .2+! [.rotate]#`hstatus.VTW`# 4+^.>! `wfi` behavior h! HS-mode h! U-mode h! VS-mode h! VU-mode ! 0 ! 0 ! Wait ! Trap (I) ! Wait ! Trap (V) ! 0 ! 1 ! Wait ! Trap (I) ! Trap (V) ! Trap (V) ! 1 ! - ! Trap (I) ! Trap (I) ! Trap (I) ! Trap (I) 6+! Trap (I) - Trap with `Illegal Instruction` code + Trap (V) - Trap with `Virtual Instruction` codeRWUNDEFINED_LEGAL
[20]VTVMWhen set, a 'Virtual Instruction` trap occurs when executing an `sfence.vma`, `sinval.vma`, or an explicit CSR access of the `satp` (really `vsatp`) register when in VS-mode. When clear, the instructions execute as normal in VS-mode. Notably, `hstatus.VTVM` does *not* cause `hfence.vvma`, `sfence.w.inval`, or `sfence.inval.ir` to trap. `mstatus.TVM` does not affect the VS-mode instructions controlled by `hstatus.VTVM`.RWUNDEFINED_LEGAL
[17:12]VGEINSelects the guest external interrupt source for VS-level external interrupts. When `hstatus.VGEIN` == 0, no external interrupt source is selected. When `hstatus.VGEIN` != 0, it selects which bit of `hgeip` is currently active in VS-mode.
# if NUM_EXTERNAL_GUEST_INTERRUPTS+1 is 63 (because indexing in `hgeip` starts at 1),
# then the field accepts any value.
# Otherwise, it accepts a restricted set of values
if (NUM_EXTERNAL_GUEST_INTERRUPTS == 63) {
  return CsrFieldType::RW;
} else {
  return CsrFieldType::RWR;
}
UNDEFINED_LEGAL
[9]HUWhen set, the hypervisor load/store instructions (`hlv`, `hlvx`, and `hsv`) can be executed in U-mode. When clear, the hypervisor load/store instructions cause an `Illegal Instruction` trap.RWUNDEFINED_LEGAL
[8]SPVPWritten by hardware: * When taking a trap into HS-mode from VS-mode or VU-mode, `hstatus.SPVP` is written with the nominal privilege mode Notably, unlike its analog `mstatus.SPP`, `hstatus.SPVP` is *not* cleared when returning from a trap. Can also be written by software without immediate side-effect. Affects execution by: * Controls the effective privilege level applied to the hypervisor load/store instructions, `hlv`, `hlvx`, and `hsv`.RWUNDEFINED_LEGAL
[7]SPVWritten by hardware: * On a trap into HS-mode, hardware writes 1 when the prior mode was VS-mode or VU-mode, and 0 otherwise. Can also be written by software without immediate side-effect. Affects execution by: * When an `sret` instruction in executed in HS-mode or M-mode, control returns to VS-mode or VU-mode (as selected by `mstatus.SPP`) when `hstatus.SPV` is 1 and to HS-mode or U-mode otherwise.RWUNDEFINED_LEGAL
[6]GVAWritten by hardware whenever a trap is taken into HS-mode: * Writes 1 when a trap causes a guest virtual address to be written into `stval` (`Breakpoint`, `* Address Misaligned`, `* Access Fault`, `* Page Fault`, or `* Guest-Page Fault`). * Writes 0 otherwise Does not affect execution.RWUNDEFINED_LEGAL
[5]VSBE
if (VS_MODE_ENDIANNESS == "dynamic") {
  # mode is mutable
  return CsrFieldType::RW;
} else {
  # mode is fixed as either little or big endian
  return CsrFieldType::RO;
}
if (VS_MODE_ENDIANNESS == "little") {
  # little endian
  return 0;
} else if (VS_MODE_ENDIANNESS == "big") {
  # big endian
  return 1;
} else {
  # mutable
  return UNDEFINED_LEGAL;
}

Version af3eaf9+cheriot.f635218

Data from the RISC-V Unified Database, copyright RISC-V International and contributors.

CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.

This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.