EndBitUnion(NSACR)
BitUnion32(SCR)
+ Bitfield<18> eel2; // AArch64 (Armv8.4-SecEL2)
Bitfield<13> twe;
Bitfield<12> twi;
- Bitfield<11> st; // AArch64
- Bitfield<10> rw; // AArch64
+ Bitfield<11> st; // AArch64
+ Bitfield<10> rw; // AArch64
Bitfield<9> sif;
Bitfield<8> hce;
Bitfield<7> scd;
- Bitfield<7> smd; // AArch64
+ Bitfield<7> smd; // AArch64
Bitfield<6> nEt;
Bitfield<5> aw;
Bitfield<4> fw;
}
}
+bool
+HaveSecureEL2Ext(ThreadContext *tc)
+{
+ AA64PFR0 id_aa64pfr0 = tc->readMiscReg(MISCREG_ID_AA64PFR0_EL1);
+ return id_aa64pfr0.sel2;
+}
+
+bool
+IsSecureEL2Enabled(ThreadContext *tc)
+{
+ SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
+ if (ArmSystem::haveEL(tc, EL2) && HaveSecureEL2Ext(tc)) {
+ if (ArmSystem::haveEL(tc, EL3))
+ return !ELIs32(tc, EL3) && scr.eel2;
+ else
+ return inSecureState(tc);
+ }
+ return false;
+}
+
+bool
+EL2Enabled(ThreadContext *tc)
+{
+ SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
+ return ArmSystem::haveEL(tc, EL2) &&
+ (!ArmSystem::haveEL(tc, EL3) || scr.ns || IsSecureEL2Enabled(tc));
+}
+
bool
ELIs64(ThreadContext *tc, ExceptionLevel el)
{
return opModeToEL((OperatingMode) (uint8_t)cpsr.mode);
}
+bool HaveSecureEL2Ext(ThreadContext *tc);
+bool IsSecureEL2Enabled(ThreadContext *tc);
+bool EL2Enabled(ThreadContext *tc);
+
/**
* This function checks whether selected EL provided as an argument
* is using the AArch32 ISA. This information might be unavailable