SCR, Secure Configuration Register
The SCR characteristics are:
Purpose
When EL3 is implemented and can use AArch32, defines the configuration of the current Security state. It specifies:
- The Security state, either Secure or Non-secure.
- What mode the PE branches to if an IRQ, FIQ, or External abort occurs.
- Whether the CPSR.F or CPSR.A bits can be modified when SCR.NS==1.
Configuration
AArch32 System register SCR bits [31:0] can be mapped to AArch64 System register SCR_EL3[31:0] , but this is not architecturally mandated.
Some or all RW fields of this register have defined reset values. These apply whenever the register is accessible. This means they apply when the PE resets into EL3 using AArch32.
Attributes
SCR is a 32-bit register.
Field descriptions
The SCR bit assignments are:
31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | TERR | 0 | TWE | TWI | 0 | 0 | SIF | HCE | SCD | nET | AW | FW | EA | FIQ | IRQ | NS |
Bits [31:16]
Reserved, RES0.
TERR, bit [15]
When RAS is implemented:
When RAS is implemented:
Trap Error record accesses. Generate a Monitor Trap exception on accesses to the following registers from modes other than Monitor mode:
ERRIDR, ERRSELR, ERXADDR, ERXADDR2, ERXCTLR, ERXCTLR2, ERXFR, ERXFR2, ERXMISC0, ERXMISC1, ERXMISC2, ERXMISC3, and ERXSTATUS. When ARMv8.4-RAS is implemented, ERXMISC4, ERXMISC5, ERXMISC6, ERXMISC7.
TERR | Meaning |
---|---|
0b0 |
This control does not cause any instructions to be trapped. |
0b1 |
Accesses to the specified registers from modes other than Monitor mode generate a Monitor Trap exception. |
In a system where the PE resets into EL3, this field resets to 0.
Otherwise:
Otherwise:
Reserved, RES0.
Bit [14]
Reserved, RES0.
TWE, bit [13]
Traps WFE instructions to Monitor mode.
TWE | Meaning |
---|---|
0b0 |
This control does not cause any instructions to be trapped. |
0b1 |
Any attempt to execute a WFE instruction in any mode other than Monitor mode is trapped to Monitor mode, if the instruction would otherwise have caused the PE to enter a low-power state and the attempted execution does not generate an exception that is taken to EL1 or EL2 by SCTLR.nTWE or HCR.TWE. Any exception that is taken to EL1 or to EL2 has priority over this trap. |
The attempted execution of a conditional WFE instruction is only trapped if the instruction passes its condition code check.
Since a WFE or WFI can complete at any time, even without a Wakeup event, the traps on WFE of WFI are not guaranteed to be taken, even if the WFE or WFI is executed when there is no Wakeup event. The only guarantee is that if the instruction does not complete in finite time in the absence of a Wakeup event, the trap will be taken.
In a system where the PE resets into EL3, this field resets to 0.
TWI, bit [12]
Traps WFI instructions to Monitor mode.
TWI | Meaning |
---|---|
0b0 |
This control does not cause any instructions to be trapped. |
0b1 |
Any attempt to execute a WFI instruction in any mode other than Monitor mode is trapped to Monitor mode, if the instruction would otherwise have caused the PE to enter a low-power state and the attempted execution does not generate an exception that is taken to EL1 or EL2 by SCTLR.nTWI or HCR.TWI. Any exception that is taken to EL1 or to EL2 has priority over this trap. |
The attempted execution of a conditional WFI instruction is only trapped if the instruction passes its condition code check.
Since a WFE or WFI can complete at any time, even without a Wakeup event, the traps on WFE of WFI are not guaranteed to be taken, even if the WFE or WFI is executed when there is no Wakeup event. The only guarantee is that if the instruction does not complete in finite time in the absence of a Wakeup event, the trap will be taken.
In a system where the PE resets into EL3, this field resets to 0.
Bits [11:10]
Reserved, RES0.
SIF, bit [9]
Secure instruction fetch. When the PE is in Secure state, this bit disables instruction fetch from Non-secure memory. The possible values for this bit are:
SIF | Meaning |
---|---|
0b0 |
Secure state instruction fetches from Non-secure memory are permitted. |
0b1 |
Secure state instruction fetches from Non-secure memory are not permitted. |
This bit is permitted to be cached in a TLB.
In a system where the PE resets into EL3, this field resets to 0.
HCE, bit [8]
Hypervisor Call instruction enable. If EL2 is implemented, enables execution of HVC instructions at Non-secure EL1 and EL2.
HCE | Meaning |
---|---|
0b0 |
HVC instructions are:
|
0b1 |
HVC instructions are enabled at Non-secure EL1 and EL2. |
HVC instructions are always UNDEFINED at EL0 and in Secure state.
If EL2 is not implemented, this bit is RES0 and HVC is UNDEFINED.
In a system where the PE resets into EL3, this field resets to 0.
SCD, bit [7]
Secure Monitor Call disable. Disables SMC instructions.
SCD | Meaning |
---|---|
0b0 |
SMC instructions are enabled. |
0b1 |
In Non-secure state, SMC instructions are UNDEFINED. The Undefined Instruction exception is taken from the current Exception level to the current Exception level. In Secure state, behavior is one of the following:
|
SMC instructions are always UNDEFINED at PL0.
In a system where the PE resets into EL3, this field resets to 0.
nET, bit [6]
Not Early Termination. This bit disables early termination. The possible values of this bit are:
nET | Meaning |
---|---|
0b0 |
Early termination permitted. Execution time of data operations can depend on the data values. |
0b1 |
Disable early termination. The number of cycles required for data operations is forced to be independent of the data values. |
This IMPLEMENTATION DEFINED mechanism can disable data dependent timing optimizations from multiplies and data operations. It can provide system support against information leakage that might be exploited by timing correlation types of attack.
On implementations that do not support early termination or do not support disabling early termination, this bit is RES0.
In a system where the PE resets into EL3, this field resets to 0.
AW, bit [5]
When the value of SCR.EA is 1 and the value of HCR.AMO is 0, this bit controls whether CPSR.A masks an External abort taken from Non-secure state, and the possible values of this bit are:
AW | Meaning |
---|---|
0b0 |
External aborts taken from Non-secure state are not masked by CPSR.A, and are taken to EL3. External aborts taken from Secure state are masked by CPSR.A. |
0b1 |
External aborts taken from either Security state are masked by CPSR.A. When CPSR.A is 0, the abort is taken to EL3. |
When SCR.EA is 0 or HCR.AMO is 1, this bit has no effect.
In a system where the PE resets into EL3, this field resets to 0.
FW, bit [4]
When the value of SCR.FIQ is 1 and the value of HCR.FMO is 0, this bit controls whether CPSR.F masks an FIQ interrupt taken from Non-secure state, and the possible values of this bit are:
FW | Meaning |
---|---|
0b0 |
An FIQ taken from Non-secure state is not masked by CPSR.F, and is taken to EL3. An FIQ taken from Secure state is masked by CPSR.F. |
0b1 |
An FIQ taken from either Security state is masked by CPSR.F. When CPSR.F is 0, the FIQ is taken to EL3. |
When SCR.FIQ is 0 or HCR.FMO is 1, this bit has no effect.
In a system where the PE resets into EL3, this field resets to 0.
EA, bit [3]
External Abort handler. This bit controls which mode takes External aborts. The possible values of this bit are:
EA | Meaning |
---|---|
0b0 |
External aborts taken to Abort mode. |
0b1 |
External aborts taken to Monitor mode. |
In a system where the PE resets into EL3, this field resets to 0.
FIQ, bit [2]
FIQ handler. This bit controls which mode takes FIQ exceptions. The possible values of this bit are:
FIQ | Meaning |
---|---|
0b0 |
FIQs taken to FIQ mode. |
0b1 |
FIQs taken to Monitor mode. |
In a system where the PE resets into EL3, this field resets to 0.
IRQ, bit [1]
IRQ handler. This bit controls which mode takes IRQ exceptions. The possible values of this bit are:
IRQ | Meaning |
---|---|
0b0 |
IRQs taken to IRQ mode. |
0b1 |
IRQs taken to Monitor mode. |
In a system where the PE resets into EL3, this field resets to 0.
NS, bit [0]
Non-secure bit. Except when the PE is in Monitor mode, this bit determines the Security state of the PE:
NS | Meaning |
---|---|
0b0 |
PE is in Secure state. |
0b1 |
PE is in Non-secure state. |
If the HCR.TGE bit is set, an attempt to change from a Secure PL1 mode to a Non-secure EL1 mode by changing the SCR.NS bit from 0 to 1 results in the SCR.NS bit remaining as 0.
In a system where the PE resets into EL3, this field resets to 0.
Accessing the SCR
Accesses to this register use the following encodings:
MRC{<c>}{<q>} <coproc>, {#}<opc1>, <Rt>, <CRn>, <CRm>{, {#}<opc2>}
opc1 | opc2 | CRn | coproc | CRm |
---|---|---|---|---|
0b000 | 0b000 | 0b0001 | 0b1111 | 0b0001 |
if PSTATE.EL == EL0 then UNDEFINED; elsif PSTATE.EL == EL1 then if EL2Enabled() && !ELUsingAArch32(EL2) && HSTR_EL2.T1 == '1' then AArch64.AArch32SystemAccessTrap(EL2, 0x03); elsif EL2Enabled() && ELUsingAArch32(EL2) && HSTR.T1 == '1' then AArch32.TakeHypTrapException(0x03); elsif !ELUsingAArch32(EL2) && SCR_EL3.<NS,EEL2> == '01' then AArch64.AArch32SystemAccessTrap(EL2, 0x03); elsif !ELUsingAArch32(EL3) && SCR_EL3.NS == '0' then AArch64.AArch32SystemAccessTrap(EL3, 0x03); else UNDEFINED; elsif PSTATE.EL == EL2 then UNDEFINED; elsif PSTATE.EL == EL3 then return SCR;
MCR{<c>}{<q>} <coproc>, {#}<opc1>, <Rt>, <CRn>, <CRm>{, {#}<opc2>}
opc1 | opc2 | CRn | coproc | CRm |
---|---|---|---|---|
0b000 | 0b000 | 0b0001 | 0b1111 | 0b0001 |
if PSTATE.EL == EL0 then UNDEFINED; elsif PSTATE.EL == EL1 then if EL2Enabled() && !ELUsingAArch32(EL2) && HSTR_EL2.T1 == '1' then AArch64.AArch32SystemAccessTrap(EL2, 0x03); elsif EL2Enabled() && ELUsingAArch32(EL2) && HSTR.T1 == '1' then AArch32.TakeHypTrapException(0x03); elsif !ELUsingAArch32(EL2) && SCR_EL3.<NS,EEL2> == '01' then AArch64.AArch32SystemAccessTrap(EL2, 0x03); elsif !ELUsingAArch32(EL3) && SCR_EL3.NS == '0' then AArch64.AArch32SystemAccessTrap(EL3, 0x03); else UNDEFINED; elsif PSTATE.EL == EL2 then UNDEFINED; elsif PSTATE.EL == EL3 then SCR = R[t];