mscontext

Machine Supervisor Context

This optional register is an alias for scontext. It is only accessible in S/HS-mode, M-mode and Debug Mode. It is included for backward compatibility with version 0.13.

The encoding of this CSR does not conform to the CSR Address Mapping Convention in the Privileged Spec. It is expected that new implementations will not support this encoding and that new debuggers will not use this CSR if scontext is available.

Attributes

Defining Extension

allOf: * Sdtrig, version >= Sdtrig@1.0.0 * S, version >= S@1.11.0

CSR Address

0x7aa

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.

mscontext Format when (priv_mode() == PrivilegeMode::M && CSR[misa].MXL == 0) || (priv_mode() == PrivilegeMode::S && CSR[mstatus].SXL == 0) || (priv_mode() == PrivilegeMode::VS && CSR[hstatus].VSXL == 0)
Figure 1. mscontext Format when (priv_mode() == PrivilegeMode::M && CSR[misa].MXL == 0) || (priv_mode() == PrivilegeMode::S && CSR[mstatus].SXL == 0) || (priv_mode() == PrivilegeMode::VS && CSR[hstatus].VSXL == 0)
mscontext Format when (priv_mode() == PrivilegeMode::M && CSR[misa].MXL == 1) || (priv_mode() == PrivilegeMode::S && CSR[mstatus].SXL == 1) || (priv_mode() == PrivilegeMode::VS && CSR[hstatus].VSXL == 1)
Figure 2. mscontext Format when (priv_mode() == PrivilegeMode::M && CSR[misa].MXL == 1) || (priv_mode() == PrivilegeMode::S && CSR[mstatus].SXL == 1) || (priv_mode() == PrivilegeMode::VS && CSR[hstatus].VSXL == 1)

Field Summary

Name Location Type Reset Value

mscontext.DATA

* 31:0 when CSR[mstatus].SXL == 0 * 63:0 when CSR[mstatus].SXL == 1

RW

0

Fields

DATA

Location
  • 31:0 when CSR[mstatus].SXL == 0

  • 63:0 when CSR[mstatus].SXL == 1

Description

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.

Type

RW

Reset value

0