cpu: Correctly call parent on switchOut() and takeOverFrom()
authorAndreas Sandberg <Andreas.Sandberg@ARM.com>
Mon, 7 Jan 2013 18:05:44 +0000 (13:05 -0500)
committerAndreas Sandberg <Andreas.Sandberg@ARM.com>
Mon, 7 Jan 2013 18:05:44 +0000 (13:05 -0500)
This patch cleans up the CPU switching functionality by making sure
that CPU models consistently call the parent on switchOut() and
takeOverFrom(). This has the following implications that might alter
current functionality:

 * The call to BaseCPU::switchout() in the O3 CPU is moved from
   signalDrained() (!) to switchOut().

 * A call to BaseSimpleCPU::switchOut() is introduced in the simple
   CPUs.

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

index 2613a8da3ec5e95bb867aea4d4591b95c956c092..78fbd6694e71412386004a6cd7687371a7189f68 100644 (file)
@@ -1192,8 +1192,6 @@ FullO3CPU<Impl>::signalDrained()
 
         setDrainState(Drainable::Drained);
 
-        BaseCPU::switchOut();
-
         if (drainManager) {
             DPRINTF(Drain, "CPU done draining, processing drain event\n");
             drainManager->signalDrainDone();
@@ -1207,6 +1205,8 @@ template <class Impl>
 void
 FullO3CPU<Impl>::switchOut()
 {
+    BaseCPU::switchOut();
+
     fetch.switchOut();
     rename.switchOut();
     iew.switchOut();
index fffbb55d6c51ce84f124fe3afb37f178efbd84f4..2d026e7335881a8567618ba855cac98a3731df02 100644 (file)
@@ -177,6 +177,8 @@ AtomicSimpleCPU::drainResume()
 void
 AtomicSimpleCPU::switchOut()
 {
+    BaseSimpleCPU::switchOut();
+
     assert(_status == BaseSimpleCPU::Running || _status == Idle);
     _status = SwitchedOut;
 
@@ -187,7 +189,7 @@ AtomicSimpleCPU::switchOut()
 void
 AtomicSimpleCPU::takeOverFrom(BaseCPU *oldCPU)
 {
-    BaseCPU::takeOverFrom(oldCPU);
+    BaseSimpleCPU::takeOverFrom(oldCPU);
 
     assert(!tickEvent.scheduled());
 
index d3959c8958127514a86242f27eae9e1e145df2e4..121db090bbe1689130dca1d2d5b14186cacb6575 100644 (file)
@@ -163,6 +163,8 @@ TimingSimpleCPU::drainResume()
 void
 TimingSimpleCPU::switchOut()
 {
+    BaseSimpleCPU::switchOut();
+
     assert(_status == BaseSimpleCPU::Running || _status == Idle);
     _status = SwitchedOut;
     numCycles += curCycle() - previousCycle;
@@ -177,7 +179,7 @@ TimingSimpleCPU::switchOut()
 void
 TimingSimpleCPU::takeOverFrom(BaseCPU *oldCPU)
 {
-    BaseCPU::takeOverFrom(oldCPU);
+    BaseSimpleCPU::takeOverFrom(oldCPU);
 
     // if any of this CPU's ThreadContexts are active, mark the CPU as
     // running and schedule its tick event.