From cf1c25dbcc22e2baddb78592df515081c4800a65 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 8 Nov 2007 10:46:41 -0500 Subject: AtomicSimpleCPU: Refactor resume() code to have a cleaner control path. --HG-- extra : convert_revision : f27bb96850e7fb0252fb1f47c3d0860705c32884 --- src/cpu/simple/atomic.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') 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 §ion) 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()); } } } -- cgit v1.2.3