Machine Context
This register must be implemented if `hcontext` is implemented, and is optional otherwise. It is only accessible in M-mode and Debug mode.
`hcontext` is primarily useful to set triggers on hypervisor systems that only fire when a given VM is executing. It is also useful in systems where M-Mode implements something like a hypervisor directly.
| 31:24 | 23:16 | 15:8 | 7:0 | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| — | HCONTEXT | ||||||||||||||||||||||||||||||
| 63:56 | 55:48 | 47:40 | 39:32 | 31:24 | 23:16 | 15:8 | 7:0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| — | HCONTEXT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Bits | Field | Alias | Description | Type | Reset |
|---|---|---|---|---|---|
| [13:0] | HCONTEXT | M-Mode or HS-Mode (using `hcontext`) software can write a context number to this register, which can be used to set triggers that only fire in that specific context. An implementation may tie any number of upper bits in this field to 0. If the H extension is not implemented, it’s recommended to implement 6 bits on RV32 and 13 bits on RV64 (as visible through the `mcontext` register). If the H extension is implemented, it’s recommended to implement 7 bits on RV32 and 14 bits on RV64. | RW | 0 |
# check if MCONTEXT is implemented
if (!MCONTEXT_IMPLEMENTED) {
unimplemented_csr($encoding);
}
return $bits(CSR[mcontext]);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.