diff options
Diffstat (limited to 'src/cpu/o3/thread_context_impl.hh')
-rwxr-xr-x | src/cpu/o3/thread_context_impl.hh | 79 |
1 files changed, 26 insertions, 53 deletions
diff --git a/src/cpu/o3/thread_context_impl.hh b/src/cpu/o3/thread_context_impl.hh index 5a412c161..2ea39f3eb 100755 --- a/src/cpu/o3/thread_context_impl.hh +++ b/src/cpu/o3/thread_context_impl.hh @@ -41,6 +41,7 @@ * Korey Sewell */ +#include "arch/kernel_stats.hh" #include "arch/registers.hh" #include "config/the_isa.hh" #include "config/use_checker.hh" @@ -48,7 +49,6 @@ #include "cpu/quiesce_event.hh" #include "debug/O3CPU.hh" -#if FULL_SYSTEM template <class Impl> FSTranslatingPortProxy* O3ThreadContext<Impl>::getVirtProxy() @@ -62,18 +62,14 @@ O3ThreadContext<Impl>::dumpFuncProfile() { thread->dumpFuncProfile(); } -#endif template <class Impl> void O3ThreadContext<Impl>::takeOverFrom(ThreadContext *old_context) { // some things should already be set up -#if FULL_SYSTEM assert(getSystemPtr() == old_context->getSystemPtr()); -#else assert(getProcessPtr() == old_context->getProcessPtr()); -#endif // copy over functional state setStatus(old_context->status()); @@ -81,25 +77,24 @@ O3ThreadContext<Impl>::takeOverFrom(ThreadContext *old_context) setContextId(old_context->contextId()); setThreadId(old_context->threadId()); -#if !FULL_SYSTEM - thread->funcExeInst = old_context->readFuncExeInst(); -#else - EndQuiesceEvent *other_quiesce = old_context->getQuiesceEvent(); - if (other_quiesce) { - // Point the quiesce event's TC at this TC so that it wakes up - // the proper CPU. - other_quiesce->tc = this; - } - if (thread->quiesceEvent) { - thread->quiesceEvent->tc = this; + if (FullSystem) { + EndQuiesceEvent *other_quiesce = old_context->getQuiesceEvent(); + if (other_quiesce) { + // Point the quiesce event's TC at this TC so that it wakes up + // the proper CPU. + other_quiesce->tc = this; + } + if (thread->quiesceEvent) { + thread->quiesceEvent->tc = this; + } + + // Transfer kernel stats from one CPU to the other. + thread->kernelStats = old_context->getKernelStats(); + cpu->lockFlag = false; + } else { + thread->funcExeInst = old_context->readFuncExeInst(); } - // Transfer kernel stats from one CPU to the other. - thread->kernelStats = old_context->getKernelStats(); -// storeCondFailures = 0; - cpu->lockFlag = false; -#endif - old_context->setStatus(ThreadContext::Halted); thread->inSyscall = false; @@ -116,10 +111,7 @@ O3ThreadContext<Impl>::activate(int delay) if (thread->status() == ThreadContext::Active) return; -#if FULL_SYSTEM thread->lastActivate = curTick(); -#endif - thread->setStatus(ThreadContext::Active); // status() == Suspended @@ -136,19 +128,9 @@ O3ThreadContext<Impl>::suspend(int delay) if (thread->status() == ThreadContext::Suspended) return; -#if FULL_SYSTEM thread->lastActivate = curTick(); thread->lastSuspend = curTick(); -#endif -/* -#if FULL_SYSTEM - // Don't change the status from active if there are pending interrupts - if (cpu->checkInterrupts()) { - assert(status() == ThreadContext::Active); - return; - } -#endif -*/ + thread->setStatus(ThreadContext::Suspended); cpu->suspendContext(thread->threadId()); } @@ -171,35 +153,28 @@ template <class Impl> void O3ThreadContext<Impl>::regStats(const std::string &name) { -#if FULL_SYSTEM - thread->kernelStats = new TheISA::Kernel::Statistics(cpu->system); - thread->kernelStats->regStats(name + ".kern"); -#endif + if (FullSystem) { + thread->kernelStats = new TheISA::Kernel::Statistics(cpu->system); + thread->kernelStats->regStats(name + ".kern"); + } } template <class Impl> void O3ThreadContext<Impl>::serialize(std::ostream &os) { -#if FULL_SYSTEM - if (thread->kernelStats) + if (FullSystem && thread->kernelStats) thread->kernelStats->serialize(os); -#endif - } template <class Impl> void O3ThreadContext<Impl>::unserialize(Checkpoint *cp, const std::string §ion) { -#if FULL_SYSTEM - if (thread->kernelStats) + if (FullSystem && thread->kernelStats) thread->kernelStats->unserialize(cp, section); -#endif - } -#if FULL_SYSTEM template <class Impl> Tick O3ThreadContext<Impl>::readLastActivate() @@ -227,7 +202,6 @@ O3ThreadContext<Impl>::profileSample() { thread->profileSample(); } -#endif template <class Impl> void @@ -238,9 +212,8 @@ O3ThreadContext<Impl>::copyArchRegs(ThreadContext *tc) TheISA::copyRegs(tc, this); thread->inSyscall = false; -#if !FULL_SYSTEM - this->thread->funcExeInst = tc->readFuncExeInst(); -#endif + if (!FullSystem) + this->thread->funcExeInst = tc->readFuncExeInst(); } template <class Impl> |