summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-11-08 10:46:41 -0500
committerAli Saidi <saidi@eecs.umich.edu>2007-11-08 10:46:41 -0500
commitcf1c25dbcc22e2baddb78592df515081c4800a65 (patch)
tree0e58073c4b9230b047fac4a878a6313daf2b3408
parentf4222610ea1106b60deb2fa659e580168a8ce511 (diff)
downloadgem5-cf1c25dbcc22e2baddb78592df515081c4800a65.tar.xz
AtomicSimpleCPU: Refactor resume() code to have a cleaner control path.
--HG-- extra : convert_revision : f27bb96850e7fb0252fb1f47c3d0860705c32884
-rw-r--r--src/cpu/simple/atomic.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc
index 4e52f9b33..9d7181cea 100644
--- a/src/cpu/simple/atomic.cc
+++ b/src/cpu/simple/atomic.cc
@@ -194,15 +194,16 @@ AtomicSimpleCPU::unserialize(Checkpoint *cp, const string &section)
void
AtomicSimpleCPU::resume()
{
+ if (_status == Idle || _status == SwitchedOut)
+ return;
+
DPRINTF(SimpleCPU, "Resume\n");
- if (_status != SwitchedOut && _status != Idle) {
- assert(system->getMemoryMode() == Enums::atomic);
+ assert(system->getMemoryMode() == Enums::atomic);
- changeState(SimObject::Running);
- if (thread->status() == ThreadContext::Active) {
- if (!tickEvent.scheduled()) {
- tickEvent.schedule(nextCycle());
- }
+ changeState(SimObject::Running);
+ if (thread->status() == ThreadContext::Active) {
+ if (!tickEvent.scheduled()) {
+ tickEvent.schedule(nextCycle());
}
}
}