summaryrefslogtreecommitdiff
path: root/src/cpu/simple
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@ARM.com>2013-01-07 13:05:44 -0500
committerAndreas Sandberg <Andreas.Sandberg@ARM.com>2013-01-07 13:05:44 -0500
commit901258c22b631cd7c14e564bd5f1cde36347515e (patch)
tree0f60293252ffd01829c88800363c11f716e88677 /src/cpu/simple
parent4ae02295d59036fa2f9d272ee288e0321bb8257a (diff)
downloadgem5-901258c22b631cd7c14e564bd5f1cde36347515e.tar.xz
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 (limited to 'src/cpu/simple')
-rw-r--r--src/cpu/simple/atomic.cc4
-rw-r--r--src/cpu/simple/timing.cc4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc
index fffbb55d6..2d026e733 100644
--- a/src/cpu/simple/atomic.cc
+++ b/src/cpu/simple/atomic.cc
@@ -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());
diff --git a/src/cpu/simple/timing.cc b/src/cpu/simple/timing.cc
index d3959c895..121db090b 100644
--- a/src/cpu/simple/timing.cc
+++ b/src/cpu/simple/timing.cc
@@ -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.