Simple CPU: Don't trace instructions that fault. Otherwise they show up twice.
authorGabe Black <gblack@eecs.umich.edu>
Mon, 27 Aug 2007 03:29:09 +0000 (20:29 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Mon, 27 Aug 2007 03:29:09 +0000 (20:29 -0700)
--HG--
extra : convert_revision : 4446d9544d58bdadbd24d8322bb63016a32aa2b8

src/cpu/simple/atomic.cc
src/cpu/simple/timing.cc

index 8a05d800eeaf69c492aab9fdd9e9c05ad91047bc..234803be5b09f0d77259618818391607e67d1e9b 100644 (file)
@@ -618,13 +618,17 @@ AtomicSimpleCPU::tick()
 
             preExecute();
 
-            if(curStaticInst)
-            {
+            if (curStaticInst) {
                 fault = curStaticInst->execute(this, traceData);
 
                 // keep an instruction count
                 if (fault == NoFault)
                     countInst();
+                else if (traceData) {
+                    // If there was a fault, we should trace this instruction.
+                    delete traceData;
+                    traceData = NULL;
+                }
 
                 postExecute();
             }
index 046b2fe3b23b88cb1d0e621e73f1ddcddf11c106..1e1f43f7d5002797bd76859357c57b35ada007b1 100644 (file)
@@ -544,6 +544,10 @@ TimingSimpleCPU::completeIfetch(PacketPtr pkt)
                 // keep an instruction count
                 if (fault == NoFault)
                     countInst();
+            } else if (traceData) {
+                // If there was a fault, we shouldn't trace this instruction.
+                delete traceData;
+                traceData = NULL;
             }
 
             postExecute();
@@ -556,6 +560,11 @@ TimingSimpleCPU::completeIfetch(PacketPtr pkt)
         // keep an instruction count
         if (fault == NoFault)
             countInst();
+        else if (traceData) {
+            // If there was a fault, we shouldn't trace this instruction.
+            delete traceData;
+            traceData = NULL;
+        }
 
         postExecute();
         advanceInst(fault);
@@ -628,6 +637,11 @@ TimingSimpleCPU::completeDataAccess(PacketPtr pkt)
     // keep an instruction count
     if (fault == NoFault)
         countInst();
+    else if (traceData) {
+        // If there was a fault, we shouldn't trace this instruction.
+        delete traceData;
+        traceData = NULL;
+    }
 
     if (pkt->isRead() && pkt->isLocked()) {
         TheISA::handleLockedRead(thread, pkt->req);