hcontext
Hypervisor Context
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.
Attributes
Defining Extension |
allOf: * Sdtrig, version >= Sdtrig@1.0.0 * H, version >= H@1.0.0 |
---|---|
CSR Address |
0x6a8 |
Length |
* 32 when (priv_mode() == PrivilegeMode::M && CSR[misa].MXL == 0) |
(priv_mode() == PrivilegeMode::S && CSR[mstatus].SXL == %%) |
|
(priv_mode() == PrivilegeMode::VS && CSR[hstatus].VSXL == %%) * 64 when (priv_mode() == PrivilegeMode::M && CSR[misa].MXL == 1) |
|
(priv_mode() == PrivilegeMode::S && CSR[mstatus].SXL == %%) |
|
(priv_mode() == PrivilegeMode::VS && CSR[hstatus].VSXL == %%) |
|
Privilege Mode |
S |
Format
This CSR format changes dynamically.
Software write
This CSR may store a value that is different from what software attempts to write.
When a software write occurs (e.g., through csrrw), the following determines the written value:
HCONTEXT = # check if mstateen0 is implemented if (implemented?(ExtensionName::Smstateen) && CSR[mstateen0].CONTEXT != 0) { unimplemented_csr($encoding); } # check if HCONTEXT is available if (!HCONTEXT_AVAILABLE) { unimplemented_csr($encoding); } # enforce width of HCONTEXT Bits<14> hcontext_value = csr_value.HCONTEXT & ((14'1 << DBG_HCONTEXT_WIDTH) - 1); # forward the write to mcontext.HCONTEXT CSR[mcontext].HCONTEXT = hcontext_value; return CSR[mcontext].HCONTEXT;
Software read
This CSR may return a value that is different from what is stored in hardware.
if (implemented?(ExtensionName::Smstateen) && mstateen0.CONTEXT != 0) {
unimplemented_csr($encoding);
}
if (!HCONTEXT_AVAILABLE) {
unimplemented_csr($encoding);
}
return $bits(mcontext);