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

scontext

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

Summary

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.

Syntax / Encoding

CSR 0x5a8 (S-mode, RW)

Bitfields (1)

BitsFieldDescription
31:0DATASupervisor 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.

Reference Notes

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`.