jvt
Table Jump Base Vector and Control Register
The jvt register is an XLEN-bit WARL read/write register that holds the jump table configuration, consisting of the jump table base address (BASE) and the jump table mode (MODE).
jvt CSR adds architectural state to the system software context (such as an OS process), therefore must be saved/restored on context switches.
Attributes
Requirement |
|||
|---|---|---|---|
Defining extensions |
|
||
CSR Address |
0x17 |
||
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 |
U |
Format
This CSR format changes dynamically.
Fields
BASE
- Location
-
-
31:6 when CSR[mstatus].UXL == 0
-
63:6 when CSR[mstatus].UXL == 1
-
- Description
-
The value in the BASE field must always be aligned on a 64-byte boundary. Note that the CSR contains only bits XLEN-1 through 6 of the address base. When computing jump-table accesses, the lower six bits of base are filled with zeroes to obtain an XLEN-bit jump-table base address jvt that is always aligned on a 64-byte boundary.
jvt is a virtual address, whenever virtual memory is enabled.
The memory pointed to by jvt is treated as instruction memory for the purpose of executing table jump instructions, implying execute access permission.
- Type
RO
RW
- Reset value
-
UNDEFINED_LEGAL
MODE
- Location
-
5:0
- Description
-
jvt is a WARL field, so can only be programmed to modes which are implemented. Therefore the discovery mechanism is to attempt to program different modes and read back the values to see which are available. Jump table mode must be implemented.
- Type
RO
RW
- Reset value
-
0
Software write
This CSR may store a value that is different from what software attempts to write.
When a software write occurs (e.g., through csrrw), the following determines the written value:
BASE = if (( mode() != PrivilegeMode::M && implemented?(ExtensionName::Smstateen)
&& CSR[mstateen0].JVT == 1'b0 )
||
( mode() == PrivilegeMode::U && implemented?(ExtensionName::Ssstateen)
&& CSR[sstateen0].JVT == 1'b0 )
||
( mode() == PrivilegeMode::VS && implemented?(ExtensionName::Ssstateen)
&& CSR[hstateen0].JVT == 1'b0 )
||
( mode() == PrivilegeMode::VU && implemented?(ExtensionName::Ssstateen)
&& (CSR[sstateen0].JVT == 1'b0 || CSR[hstateen0].JVT == 1'b0) )) {
unimplemented_csr($encoding);
}
else {
if (JVT_BASE_TYPE == "custom") {
unpredictable("jvt.BASE has custom behavior");
} else {
return csr_value.BASE & (JVT_BASE_MASK >> 6);
}
return csr_value.BASE == 0 ? 0 : UNDEFINED_LEGAL_DETERMINISTIC;
}
MODE = if (JVT_READ_ONLY || (csr_value.MODE != 0)) {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
return 0;
Software read
This CSR may return a value that is different from what is stored in hardware.
check_zcmt_enabled($encoding);
return $bits(CSR[CSR[jvt]]);