ARM: Make undefined instructions obey predication.
authorGabe Black <gblack@eecs.umich.edu>
Wed, 2 Jun 2010 17:58:16 +0000 (12:58 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Wed, 2 Jun 2010 17:58:16 +0000 (12:58 -0500)
src/arch/arm/insts/misc.cc
src/arch/arm/insts/misc.hh
src/arch/arm/isa/formats/unknown.isa
src/arch/arm/isa/insts/misc.isa

index 0eae37de075d8ab4c1fb850e6e0a091b16f460ea..a0af4fc2f36b3fe25cf6a479caf878e8b0b40ae1 100644 (file)
@@ -261,3 +261,11 @@ RegImmRegShiftOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
     printReg(ss, op1);
     return ss.str();
 }
+
+std::string
+UnknownOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
+{
+    return csprintf("%-10s (inst 0x%x, opcode 0x%x, binary:%s)",
+                    "unknown", machInst, machInst.opcode,
+                    inst2string(machInst));
+}
index 6d78b311ac7bfea7df27a11c954413d41147f9f3..c9e114f85742376f57f950bbfca8ac6316521e0d 100644 (file)
@@ -258,4 +258,15 @@ class RegImmRegShiftOp : public PredOp
     std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
 };
 
+class UnknownOp : public PredOp
+{
+  protected:
+
+    UnknownOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
+        PredOp(mnem, _machInst, __opClass)
+    {}
+
+    std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
+};
+
 #endif
index e4bb948992e794e5c3e3f14ff45aa073083b544c..90770301554a3b6fd96a9b762fd9cd85b57e356b 100644 (file)
 //
 // Authors: Stephen Hines
 
-////////////////////////////////////////////////////////////////////
-//
-// Unknown instructions
-//
-
-output header {{
-    /**
-     * Static instruction class for unknown (illegal) instructions.
-     * These cause simulator termination if they are executed in a
-     * non-speculative mode.  This is a leaf class.
-     */
-    class Unknown : public ArmStaticInst
-    {
-      public:
-        /// Constructor
-        Unknown(ExtMachInst _machInst)
-            : ArmStaticInst("unknown", _machInst, No_OpClass)
-        {
-            // don't call execute() (which panics) if we're on a
-            // speculative path
-            flags[IsNonSpeculative] = true;
-        }
-
-        %(BasicExecDeclare)s
-
-        std::string
-        generateDisassembly(Addr pc, const SymbolTable *symtab) const;
-    };
-}};
-
-output decoder {{
-    std::string
-    Unknown::generateDisassembly(Addr pc, const SymbolTable *symtab) const
-    {
-        return csprintf("%-10s (inst 0x%x, opcode 0x%x, binary:%s)",
-                        "unknown", machInst, OPCODE, inst2string(machInst));
-    }
-}};
-
-output exec {{
-    Fault
-    Unknown::execute(%(CPU_exec_context)s *xc,
-                     Trace::InstRecord *traceData) const
-    {
-#if FULL_SYSTEM
-        return new UndefinedInstruction;
-#else
-        return new UndefinedInstruction(machInst, true);
-#endif
-    }
-}};
-
 def format Unknown() {{
     decode_block = 'return new Unknown(machInst);\n'
 }};
index ee6330f48f8da39aff49f49328adc0376c4fe6c7..ddf548a1976999cfb8223c72a114d2c708d874ec 100644 (file)
@@ -468,6 +468,19 @@ let {{
     header_output += BasicDeclare.subst(itIop)
     decoder_output += BasicConstructor.subst(itIop)
     exec_output += PredOpExecute.subst(itIop)
+    unknownCode = '''
+#if FULL_SYSTEM
+            return new UndefinedInstruction;
+#else
+            return new UndefinedInstruction(machInst, true);
+#endif
+    '''
+    unknownIop = InstObjParams("unknown", "Unknown", "UnknownOp", \
+                               { "code": unknownCode,
+                                 "predicate_test": predicateTest })
+    header_output += BasicDeclare.subst(unknownIop)
+    decoder_output += BasicConstructor.subst(unknownIop)
+    exec_output += PredOpExecute.subst(unknownIop)
 
     ubfxCode = '''
         Dest = bits(Op1, imm2, imm1);