Minor tweaks to make a switchover at tick N match
authorSteve Reinhardt <stever@eecs.umich.edu>
Tue, 9 Dec 2003 22:21:38 +0000 (14:21 -0800)
committerSteve Reinhardt <stever@eecs.umich.edu>
Tue, 9 Dec 2003 22:21:38 +0000 (14:21 -0800)
restarting from a checkpoint at tick N.

cpu/simple_cpu/simple_cpu.cc:
    On a CPU switchover, schedule the new CPU's first tick event
    for curTick+1 instead of curTick.

--HG--
extra : convert_revision : f0757d6f028214d36c1cff992db688fd6e8a6fdc

cpu/simple_cpu/simple_cpu.cc

index 476f28ea003aea0d207c1ce9f43a959bb7c0e3a5..8b99a0105ad6214ab92931aba8792dc237b658fc 100644 (file)
@@ -193,7 +193,11 @@ SimpleCPU::takeOverFrom(BaseCPU *oldCPU)
         ExecContext *xc = execContexts[i];
         if (xc->status() == ExecContext::Active && _status != Running) {
             _status = Running;
-            tickEvent.schedule(curTick);
+            // the CpuSwitchEvent has a low priority, so it's
+            // scheduled *after* the current cycle's tick event.  Thus
+            // the first tick event for the new context should take
+            // place on the *next* cycle.
+            tickEvent.schedule(curTick+1);
         }
     }
 
@@ -790,3 +794,4 @@ CREATE_SIM_OBJECT(SimpleCPU)
 }
 
 REGISTER_SIM_OBJECT("SimpleCPU", SimpleCPU)
+