← Home

hcontext

Hypervisor Context

Address: 0x6A8 (1704) · Privilege: S · Length: XLEN · Writable · Defined by: Sdtrig and H

This optional register may be implemented only if the H extension is implemented. If it is implemented, `mcontext` must also be implemented.

This register is only accessible in HS-Mode, M-mode and Debug Mode. If Smstateen is implemented, then accessibility of in HS-Mode is controlled by `mstateen0[57]`.

This register is an alias of the `mcontext` register, providing access to the HCONTEXT field from HS-Mode.

Fields

RV32

31:2423:1615:87:0
—HCONTEXT

RV64

63:5655:4847:4039:3231:2423:1615:87:0
—HCONTEXT
BitsFieldAliasDescriptionTypeReset
[13:0]HCONTEXTmcontext.HCONTEXTAlias of `mcontext.HCONTEXT`.RW0

Software read

# check if mstateen0 is implemented
if (implemented?(ExtensionName::Smstateen) && CSR[mstateen0].CONTEXT != 0) {
  unimplemented_csr($encoding);
}

# check if HCONTEXT is implemented
if (!HCONTEXT_IMPLEMENTED) {
  unimplemented_csr($encoding);
}

# return the value of mcontext
return $bits(CSR[mcontext]); # might truncate if xlen() < MXLEN, but that's the expected behavior

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.