arm: Make sure UndefinedInstructions are properly initialized
authorAli Saidi <Ali.Saidi@ARM.com>
Thu, 17 Apr 2014 21:56:09 +0000 (16:56 -0500)
committerAli Saidi <Ali.Saidi@ARM.com>
Thu, 17 Apr 2014 21:56:09 +0000 (16:56 -0500)
src/arch/arm/faults.hh
src/arch/arm/isa/insts/data64.isa
src/arch/arm/isa/templates/vfp.isa

index a5720f115ec42cf69649ba70fadcbf350b31e26c..8a6f07ddec48a8320764756cbf3ecb3f2071e666 100644 (file)
@@ -257,9 +257,9 @@ class UndefinedInstruction : public ArmFaultVals<UndefinedInstruction>
 {
   protected:
     bool unknown;
-    const char *mnemonic;
     bool disabled;
     ExceptionClass overrideEc;
+    const char *mnemonic;
 
   public:
     UndefinedInstruction(ExtMachInst _machInst,
@@ -267,12 +267,14 @@ class UndefinedInstruction : public ArmFaultVals<UndefinedInstruction>
                          const char *_mnemonic = NULL,
                          bool _disabled = false) :
         ArmFaultVals<UndefinedInstruction>(_machInst),
-        unknown(_unknown), mnemonic(_mnemonic), disabled(_disabled),
-        overrideEc(EC_INVALID)
+        unknown(_unknown), disabled(_disabled),
+        overrideEc(EC_INVALID), mnemonic(_mnemonic)
     {}
-    UndefinedInstruction(ExtMachInst _machInst, uint32_t _iss, ExceptionClass _overrideEc) :
+    UndefinedInstruction(ExtMachInst _machInst, uint32_t _iss,
+            ExceptionClass _overrideEc, const char *_mnemonic = NULL) :
         ArmFaultVals<UndefinedInstruction>(_machInst, _iss),
-        overrideEc(_overrideEc)
+        unknown(false), disabled(true), overrideEc(_overrideEc),
+        mnemonic(_mnemonic)
     {}
 
     void invoke(ThreadContext *tc,
index 77d7541ca6e8e1e00cf5af15fd929a7e816bc7c3..8ec446d1690e2d7e15147a2f58845f70b115973f 100644 (file)
@@ -294,7 +294,8 @@ let {{
                 flat_idx == MISCREG_DC_CVAC_Xt ||
                 flat_idx == MISCREG_DC_CIVAC_Xt
                 )
-                return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64);
+                return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64,
+                                    mnemonic);
             return new UndefinedInstruction(machInst, false, mnemonic);
         }
 
@@ -396,7 +397,8 @@ let {{
         if (!canWriteAArch64SysReg(
                 (MiscRegIndex) xc->tcBase()->flattenMiscIndex(dest),
                 Scr64, Cpsr, xc->tcBase())) {
-            return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64);
+            return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64,
+                            mnemonic);
         }
         CPSR cpsr = Cpsr;
         cpsr.daif = cpsr.daif | imm;
@@ -407,7 +409,8 @@ let {{
         if (!canWriteAArch64SysReg(
                 (MiscRegIndex) xc->tcBase()->flattenMiscIndex(dest),
                 Scr64, Cpsr, xc->tcBase())) {
-            return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64);
+            return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64,
+                                mnemonic);
         }
         CPSR cpsr = Cpsr;
         cpsr.daif = cpsr.daif & ~imm;
index fbd7275d59a5557ecadd2eb73686ec09fa39332f..45be8a5f3fee4210b756c3c08c7b91d5bb4d810f 100644 (file)
@@ -49,7 +49,7 @@ let {{
             CPSR cpsrEnCheck = Cpsr;
             if (cpsrEnCheck.mode == MODE_HYP) {
                 return new UndefinedInstruction(machInst, issEnCheck,
-                                                EC_TRAPPED_HCPTR);
+                                                EC_TRAPPED_HCPTR, mnemonic);
             } else {
                 if (!inSecureState(Scr, Cpsr)) {
                     return new HypervisorTrap(machInst, issEnCheck,
@@ -96,7 +96,7 @@ let {{
             CPSR cpsrEnCheck = Cpsr;
             if (cpsrEnCheck.mode == MODE_HYP) {
                 return new UndefinedInstruction(machInst, issEnCheck,
-                                                EC_TRAPPED_HCPTR);
+                                                EC_TRAPPED_HCPTR, mnemonic);
             } else {
                 if (!inSecureState(Scr, Cpsr)) {
                     return new HypervisorTrap(machInst, issEnCheck,
@@ -122,7 +122,7 @@ let {{
             CPSR cpsrEnCheck = Cpsr;
             if (cpsrEnCheck.mode == MODE_HYP) {
                 return new UndefinedInstruction(machInst, issEnCheck,
-                                                EC_TRAPPED_HCPTR);
+                                                EC_TRAPPED_HCPTR, mnemonic);
             } else {
                 if (!inSecureState(Scr, Cpsr)) {
                     return new HypervisorTrap(machInst, issEnCheck,
@@ -142,7 +142,7 @@ let {{
             CPSR cpsrEnCheck = Cpsr;
             if (cpsrEnCheck.mode == MODE_HYP) {
                 return new UndefinedInstruction(machInst, issEnCheck,
-                                                EC_TRAPPED_HCPTR);
+                                                EC_TRAPPED_HCPTR, mnemonic);
             } else {
                 if (!inSecureState(Scr, Cpsr)) {
                     return new HypervisorTrap(machInst, issEnCheck,