ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 1,823 microarchs · 16,083 chips · 105 sources
Arch:
Tier:

mcontext

T1 riscv register register
Machine Context
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRISC-V Privileged (Sdtrig)
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
PrivilegeM
ExtensionsSdtrig

Summary

This register must be implemented if hcontext is implemented, and is optional otherwise. It is only accessible in M-mode and Debug mode.

Syntax / Encoding

CSR 0x7a8 (M-mode, RW)

Bitfields (1)

BitsFieldDescription
13:0HCONTEXTM-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

Reference Notes

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.