What happens if the related CFI feature is inactive for SSRDP?
With xSSE=0, SSRDP's MOP behavior writes zero to its destination register; it writes ssp only when xSSE=1.
SSRDP reads ssp when xSSE=1 and writes zero to a non-x0 destination when xSSE=0.
RV32/RV64 Zicfiss (depends on Zicsr, Zimop, Zaamo); ssrdp rd, rd must not be x0.
32-bit SYSTEM: bits31:20=110011011100, funct3=100, opcode=1110011; rs1=00000, rd is the destination.
With xSSE=1, rd=ssp; with xSSE=0, rd=0. Reading changes neither ssp nor shadow-stack memory.
With S-mode implemented, xSSE is 0 for M, menvcfg.SSE for S/HS, henvcfg.SSE for VS and senvcfg.SSE for U/VU; without S-mode, it is 0 for M/U. Compatibility requires Zimop support. For detecting inactivity from zero, operating systems and runtimes must not locate shadow stacks at address 0.
SSRDP copies the XLEN-wide ssp to a non-x0 destination, or writes zero when xSSE=0. With Zimop support it also writes zero if Zicfiss is absent. Runtimes can use a zero result to detect inactivity; to support this, operating systems and runtimes must not locate shadow stacks at address 0.
Shows only specification-defined encodings, conditions, and architectural state.
Assumes Zicfiss and Zimop are implemented; xSSE is the enable state determined for the current mode. ssp low two bits must be zero; RV64 inputs with bit2=1 assume 32-bit modes are also supported. complete means shadow-stack access protections pass. Steps are not processor cycles.
SSRDP reads the Zicfiss ssp and writes zero under the Zimop behavior when inactive.
Assume RV64 Zicfiss, S-mode, menvcfg.SSE=1 (xSSE=1), and ssp=0x2000. ssrdp t0 gives t0=0x2000, leaving ssp unchanged; xSSE=0 instead writes zero.
Assume RV64 Zicfiss, S-mode, menvcfg.SSE=1 (xSSE=1), and ssp=0x2000. ssrdp t0 gives t0=0x2000, leaving ssp unchanged; xSSE=0 instead writes zero.
With xSSE=0, SSRDP's MOP behavior writes zero to its destination register; it writes ssp only when xSSE=1.
The RISC-V Instruction Set Manual, Volume I: Unprivileged Architecture defines this instruction in Control-flow Integrity; Volume II: Privileged Architecture defines enable state and shadow-stack memory protection.