arch-arm: Replace occ of opModeToEL(currOpMode/cpsr) with currEL
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Fri, 16 Aug 2019 13:20:50 +0000 (14:20 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Tue, 20 Aug 2019 14:23:19 +0000 (14:23 +0000)
Change-Id: I739a9be03ea5caa63540c62fd110eee86a058c4c
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20252
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/arm/insts/static_inst.cc
src/arch/arm/isa/insts/branch64.isa
src/arch/arm/isa/insts/str.isa
src/arch/arm/miscregs.cc
src/arch/arm/pmu.cc
src/arch/arm/tlb.cc
src/arch/arm/utility.cc

index 03a758ff95e03d7ed12384567bf3c61df9da5fea..1f849b9710c1d04cac640698baaa111a412a509b 100644 (file)
@@ -703,7 +703,7 @@ ArmStaticInst::checkAdvSIMDOrFPEnabled32(ThreadContext *tc,
     const bool have_virtualization = ArmSystem::haveVirtualization(tc);
     const bool have_security = ArmSystem::haveSecurity(tc);
     const bool is_secure = inSecureState(tc);
-    const ExceptionLevel cur_el = opModeToEL(currOpMode(tc));
+    const ExceptionLevel cur_el = currEL(tc);
 
     if (cur_el == EL0 && ELIs64(tc, EL1))
         return checkFPAdvSIMDEnabled64(tc, cpsr, cpacr);
index 8ef9f934e437e382f0936209ce5e7cf4b1c04d36..356114ec79139b6fbcd06d2525fb12e7a4cefab6 100644 (file)
@@ -103,7 +103,7 @@ let {{
                 CPSR cpsr = Cpsr;
                 CPSR spsr = Spsr;
 
-                ExceptionLevel curr_el = opModeToEL((OperatingMode) (uint8_t) cpsr.mode);
+                ExceptionLevel curr_el = currEL(cpsr);
                 switch (curr_el) {
                   case EL3:
                     newPc = xc->tcBase()->readMiscReg(MISCREG_ELR_EL3);
@@ -145,7 +145,7 @@ let {{
                 NextAArch64 = !new_cpsr.width;
                 NextItState = itState(new_cpsr);
                 NPC = purifyTaggedAddr(newPc, xc->tcBase(),
-                    opModeToEL((OperatingMode) (uint8_t) new_cpsr.mode));
+                    currEL(new_cpsr));
 
                 LLSCLock = 0;  // Clear exclusive monitor
                 SevMailbox = 1; //Set Event Register
index 6b2e8cc7766b53c88d89c6389c7c4f0bf7f882c8..cc8e6844cabdd4e078bb2f3c64125ccdc3161c05 100644 (file)
@@ -114,7 +114,7 @@ let {{
 
             auto tc = xc->tcBase();
             if (badMode32(tc, static_cast<OperatingMode>(regMode))) {
-                return undefinedFault32(tc, opModeToEL(currOpMode(tc)));
+                return undefinedFault32(tc, currEL(tc));
             }
 
             CPSR cpsr = Cpsr;
index 7283b205f7679203420947c70e653c83fd6779e9..87cc3fde375f5f475f20dab7e7b374f2c436ccf1 100644 (file)
@@ -1117,7 +1117,7 @@ canReadAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr, ThreadContext *tc)
 
     bool secure = ArmSystem::haveSecurity(tc) && !scr.ns;
 
-    switch (opModeToEL((OperatingMode) (uint8_t) cpsr.mode)) {
+    switch (currEL(cpsr)) {
       case EL0:
         return secure ? miscRegInfo[reg][MISCREG_USR_S_RD] :
             miscRegInfo[reg][MISCREG_USR_NS_RD];
@@ -1140,7 +1140,7 @@ canWriteAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr, ThreadContext *tc)
     // Check for SP_EL0 access while SPSEL == 0
     if ((reg == MISCREG_SP_EL0) && (tc->readMiscReg(MISCREG_SPSEL) == 0))
         return false;
-    ExceptionLevel el = opModeToEL((OperatingMode) (uint8_t) cpsr.mode);
+    ExceptionLevel el = currEL(cpsr);
     if (reg == MISCREG_DAIF) {
         SCTLR sctlr = tc->readMiscReg(MISCREG_SCTLR_EL1);
         if (el == EL0 && !sctlr.uma)
index 93d4f5efb5f52c204e53a10dd217de831966e7db..d5c0eccdd7a092de9400b26119192991f376f893 100644 (file)
@@ -499,7 +499,7 @@ PMU::CounterState::isFiltered() const
     const PMEVTYPER_t filter(this->filter);
     const SCR scr(pmu.isa->readMiscRegNoEffect(MISCREG_SCR));
     const CPSR cpsr(pmu.isa->readMiscRegNoEffect(MISCREG_CPSR));
-    const ExceptionLevel el(opModeToEL((OperatingMode)(uint8_t)cpsr.mode));
+    const ExceptionLevel el(currEL(cpsr));
     const bool secure(inSecureState(scr, cpsr));
 
     switch (el) {
index 848bd5b26527a24c382db53ae58dc77753799644..a2737b94671a3f25fba5b522111907458c46a23a 100644 (file)
@@ -1428,7 +1428,7 @@ TLB::tranTypeEL(CPSR cpsr, ArmTranslationType type)
       case S1CTran:
       case S1S2NsTran:
       case HypMode:
-        return opModeToEL((OperatingMode)(uint8_t)cpsr.mode);
+        return currEL(cpsr);
 
       default:
         panic("Unknown translation mode!\n");
index 73537a89c1f0b0ca748389af848fee32005a8a0b..924024d0e8fe65fdd88ac8b55ee8774e6c480a2c 100644 (file)
@@ -225,9 +225,7 @@ longDescFormatInUse(ThreadContext *tc)
 RegVal
 readMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
 {
-    CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
-    const ExceptionLevel current_el =
-        opModeToEL((OperatingMode) (uint8_t) cpsr.mode);
+    const ExceptionLevel current_el = currEL(tc);
 
     const bool is_secure = isSecureBelowEL3(tc);
 
@@ -356,7 +354,7 @@ ELUsingAArch32K(ThreadContext *tc, ExceptionLevel el)
 bool
 isBigEndian64(ThreadContext *tc)
 {
-    switch (opModeToEL(currOpMode(tc))) {
+    switch (currEL(tc)) {
       case EL3:
         return ((SCTLR) tc->readMiscReg(MISCREG_SCTLR_EL3)).ee;
       case EL2:
@@ -820,7 +818,7 @@ decodeMrsMsrBankedReg(uint8_t sysM, bool r, bool &isIntReg, int &regIdx,
 bool
 SPAlignmentCheckEnabled(ThreadContext* tc)
 {
-    switch (opModeToEL(currOpMode(tc))) {
+    switch (currEL(tc)) {
       case EL3:
         return ((SCTLR) tc->readMiscReg(MISCREG_SCTLR_EL3)).sa;
       case EL2: