ARM: Implement CLREX init/complete acc methods
authorGene Wu <Gene.Wu@arm.com>
Mon, 23 Aug 2010 16:18:41 +0000 (11:18 -0500)
committerGene Wu <Gene.Wu@arm.com>
Mon, 23 Aug 2010 16:18:41 +0000 (11:18 -0500)
src/arch/arm/isa/insts/misc.isa
src/arch/arm/isa/templates/misc.isa

index 5a28a9dba76cf0eb60dcb9f00c08ca0fe2913c0a..2228a0f247ad0970ae9258e143d8c716f2ee06f9 100644 (file)
@@ -675,9 +675,11 @@ let {{
     clrexIop = InstObjParams("clrex", "Clrex","PredOp",
                              { "code": clrexCode,
                                "predicate_test": predicateTest },[])
-    header_output += BasicDeclare.subst(clrexIop)
+    header_output += ClrexDeclare.subst(clrexIop)
     decoder_output += BasicConstructor.subst(clrexIop)
     exec_output += PredOpExecute.subst(clrexIop)
+    exec_output += ClrexInitiateAcc.subst(clrexIop)
+    exec_output += ClrexCompleteAcc.subst(clrexIop)
 
     isbCode = '''
     '''
index 87c6e430c227f7d72cd4594884d336590c66ea33..d2224dc6dbd5c363a67768044dc44ab49552e2db 100644 (file)
@@ -336,3 +336,67 @@ def template RegImmRegShiftOpConstructor {{
         %(constructor)s;
     }
 }};
+
+def template ClrexDeclare {{
+    /**
+     * Static instruction class for "%(mnemonic)s".
+     */
+    class %(class_name)s : public %(base_class)s
+    {
+      public:
+
+        /// Constructor.
+        %(class_name)s(ExtMachInst machInst);
+
+        %(BasicExecDeclare)s
+
+        %(InitiateAccDeclare)s
+
+        %(CompleteAccDeclare)s
+    };
+}};
+
+def template ClrexInitiateAcc {{
+    Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s *xc,
+                                      Trace::InstRecord *traceData) const
+    {
+        Fault fault = NoFault;
+        %(op_decl)s;
+        %(op_rd)s;
+
+        if (%(predicate_test)s)
+        {
+            if (fault == NoFault) {
+                unsigned memAccessFlags = ArmISA::TLB::Clrex|3|Request::LLSC;
+                fault = xc->read(0, (uint32_t&)Mem, memAccessFlags);
+            }
+        } else {
+            xc->setPredicate(false);
+            if (fault == NoFault && machInst.itstateMask != 0) {
+                xc->setMiscReg(MISCREG_ITSTATE, machInst.newItstate);
+            }
+        }
+
+        return fault;
+    }
+}};
+
+def template ClrexCompleteAcc {{
+    Fault %(class_name)s::completeAcc(PacketPtr pkt,
+                                      %(CPU_exec_context)s *xc,
+                                      Trace::InstRecord *traceData) const
+    {
+        Fault fault = NoFault;
+
+        %(op_decl)s;
+        %(op_rd)s;
+
+
+        if (fault == NoFault && machInst.itstateMask != 0) {
+            xc->setMiscReg(MISCREG_ITSTATE, machInst.newItstate);
+        }
+
+        return fault;
+    }
+}};
+