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