scontext
Supervisor-mode context register
- Address
0x5A8- Group
- Supervisor-level CSRs
- Privilege
SRW(privileged spec CSR listing, Debug/Trace Registers)- Access
- read/write; lowest privilege S (supervisor)
- Address range
- Standard read/write
- Name in riscv-unified-db
- Supervisor Context
Privileged spec: Supervisor-mode context register
Description
This optional register is only accessible in S/HS-mode, VS-mode, M-mode and Debug Mode.
Accessibility of this CSR is controlled by mstateen0[57] and hstateen0[57] in the
Smstateen extension. Enabling scontext can be a security risk in a virtualized system
with a hypervisor that does not swap scontext.
From riscv-unified-db, reformatted.
Fields
| Field | Bits | Type | Description |
|---|---|---|---|
DATA | 31-0 | RW | Supervisor mode 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 high bits in this field to 0. It’s recommended to implement 16 bits on RV32 and 32 bits on RV64. |
Fields from riscv-unified-db; field types computed by IDL functions there are not shown.
Specification and related pages
- The RISC-V Instruction Set Manual, Volume II: CSR listing (src/priv/csrs.adoc)
- riscv-opcodes csrs.csv
- riscv-unified-db: spec/std/isa/csr/scontext.yaml
- csrrw, csrrs, csrrc (Zicsr instructions that access CSRs)