AtomicSimpleCPU: Refactor resume() code to have a cleaner control path.

--HG--
extra : convert_revision : f27bb96850e7fb0252fb1f47c3d0860705c32884
This commit is contained in:
Ali Saidi 2007-11-08 10:46:41 -05:00
parent f4222610ea
commit cf1c25dbcc

View file

@ -194,15 +194,16 @@ AtomicSimpleCPU::unserialize(Checkpoint *cp, const string &section)
void
AtomicSimpleCPU::resume()
{
DPRINTF(SimpleCPU, "Resume\n");
if (_status != SwitchedOut && _status != Idle) {
assert(system->getMemoryMode() == Enums::atomic);
if (_status == Idle || _status == SwitchedOut)
return;
changeState(SimObject::Running);
if (thread->status() == ThreadContext::Active) {
if (!tickEvent.scheduled()) {
tickEvent.schedule(nextCycle());
}
DPRINTF(SimpleCPU, "Resume\n");
assert(system->getMemoryMode() == Enums::atomic);
changeState(SimObject::Running);
if (thread->status() == ThreadContext::Active) {
if (!tickEvent.scheduled()) {
tickEvent.schedule(nextCycle());
}
}
}