changeset 7c787b8030c6 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=7c787b8030c6
description:
        cpu: Correctly call parent on switchOut() and takeOverFrom()

        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.

diffstat:

 src/cpu/o3/cpu.cc        |  4 ++--
 src/cpu/simple/atomic.cc |  4 +++-
 src/cpu/simple/timing.cc |  4 +++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diffs (63 lines):

diff -r 029dfe6324d3 -r 7c787b8030c6 src/cpu/o3/cpu.cc
--- a/src/cpu/o3/cpu.cc Mon Jan 07 13:05:44 2013 -0500
+++ b/src/cpu/o3/cpu.cc Mon Jan 07 13:05:44 2013 -0500
@@ -1192,8 +1192,6 @@
 
         setDrainState(Drainable::Drained);
 
-        BaseCPU::switchOut();
-
         if (drainManager) {
             DPRINTF(Drain, "CPU done draining, processing drain event\n");
             drainManager->signalDrainDone();
@@ -1207,6 +1205,8 @@
 void
 FullO3CPU<Impl>::switchOut()
 {
+    BaseCPU::switchOut();
+
     fetch.switchOut();
     rename.switchOut();
     iew.switchOut();
diff -r 029dfe6324d3 -r 7c787b8030c6 src/cpu/simple/atomic.cc
--- a/src/cpu/simple/atomic.cc  Mon Jan 07 13:05:44 2013 -0500
+++ b/src/cpu/simple/atomic.cc  Mon Jan 07 13:05:44 2013 -0500
@@ -177,6 +177,8 @@
 void
 AtomicSimpleCPU::switchOut()
 {
+    BaseSimpleCPU::switchOut();
+
     assert(_status == BaseSimpleCPU::Running || _status == Idle);
     _status = SwitchedOut;
 
@@ -187,7 +189,7 @@
 void
 AtomicSimpleCPU::takeOverFrom(BaseCPU *oldCPU)
 {
-    BaseCPU::takeOverFrom(oldCPU);
+    BaseSimpleCPU::takeOverFrom(oldCPU);
 
     assert(!tickEvent.scheduled());
 
diff -r 029dfe6324d3 -r 7c787b8030c6 src/cpu/simple/timing.cc
--- a/src/cpu/simple/timing.cc  Mon Jan 07 13:05:44 2013 -0500
+++ b/src/cpu/simple/timing.cc  Mon Jan 07 13:05:44 2013 -0500
@@ -163,6 +163,8 @@
 void
 TimingSimpleCPU::switchOut()
 {
+    BaseSimpleCPU::switchOut();
+
     assert(_status == BaseSimpleCPU::Running || _status == Idle);
     _status = SwitchedOut;
     numCycles += curCycle() - previousCycle;
@@ -177,7 +179,7 @@
 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.
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to