# Node ID 4d871ca1c568e005c9e7591ec3559ac399bcfc33 # Parent b1e725a7a8bdeec8f65081911080593169e01625 diff --git a/src/cpu/base.hh b/src/cpu/base.hh --- a/src/cpu/base.hh +++ b/src/cpu/base.hh @@ -217,6 +217,7 @@ } virtual void wakeup() = 0; + virtual void wakeupThread(ThreadContext *tc) {} void postInterrupt(int int_num, int index) diff --git a/src/cpu/o3/cpu.hh b/src/cpu/o3/cpu.hh --- a/src/cpu/o3/cpu.hh +++ b/src/cpu/o3/cpu.hh @@ -643,6 +643,9 @@ virtual void wakeup(); + /** Wakes the thread, rescheduling the CPU if it's not already active. */ + virtual void wakeupThread(ThreadContext *tc); + /** Gets a free thread id. Use if thread ids change across system. */ ThreadID getFreeTid(); diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -1642,6 +1642,23 @@ template void +FullO3CPU::wakeupThread(ThreadContext *tc) +{ + if (tc != this->threadContexts[tc->threadId()]) { + fatal("This thread does not belong to this CPU"); + } + if (tc->status() != ThreadContext::Suspended) + return; + + this->wakeCPU(); + + DPRINTF(Quiesce, "Suspended Processor woken\n"); + + tc->activate(); +} + +template +void FullO3CPU::wakeup() { if (this->thread[0]->status() != ThreadContext::Suspended) diff --git a/src/cpu/simple/base.hh b/src/cpu/simple/base.hh --- a/src/cpu/simple/base.hh +++ b/src/cpu/simple/base.hh @@ -104,6 +104,7 @@ public: void wakeup(); + void wakeupThread(ThreadContext *tc); void zero_fill_64(Addr addr) { static int warned = 0; diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc --- a/src/cpu/simple/base.cc +++ b/src/cpu/simple/base.cc @@ -334,6 +334,15 @@ } void +BaseSimpleCPU::wakeupThread(ThreadContext *tc) +{ + if (this->thread->getTC() != tc) { + fatal("This thread does not belong to this CPU"); + } + this->wakeup(); +} + +void BaseSimpleCPU::wakeup() { getAddrMonitor()->gotWakeup = true;