From 7617dcf736b5b96d44aedccd51550be037e7b937 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Wed, 15 Apr 2009 13:18:24 -0700 Subject: [PATCH] ThreadState: initialize status to Halted in constructor. This provides a common initial status for all threads independent of CPU model (unlike the prior situation where CPUs initialized threads to inconsistent states). This mostly matters for SE mode; in FS mode, ISA-specific startupCPU() methods generally handle boot-time initialization of thread contexts (since the right thing to do is ISA-dependent). --- src/cpu/checker/cpu.cc | 2 -- src/cpu/inorder/cpu.cc | 4 ---- src/cpu/o3/cpu.cc | 3 --- src/cpu/ozone/cpu_impl.hh | 1 - src/cpu/thread_state.cc | 16 ++++++++-------- src/cpu/thread_state.hh | 3 +-- 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/cpu/checker/cpu.cc b/src/cpu/checker/cpu.cc index 14777bc12..1c36ad22d 100644 --- a/src/cpu/checker/cpu.cc +++ b/src/cpu/checker/cpu.cc @@ -75,7 +75,6 @@ CheckerCPU::CheckerCPU(Params *p) thread = new SimpleThread(this, /* thread_num */ 0, process, /* asid */ 0); - thread->setStatus(ThreadContext::Suspended); tc = thread->getTC(); threadContexts.push_back(tc); #endif @@ -95,7 +94,6 @@ CheckerCPU::setSystem(System *system) thread = new SimpleThread(this, 0, systemPtr, itb, dtb, false); - thread->setStatus(ThreadContext::Suspended); tc = thread->getTC(); threadContexts.push_back(tc); delete thread->kernelStats; diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc index 70877aae4..9e3843e20 100644 --- a/src/cpu/inorder/cpu.cc +++ b/src/cpu/inorder/cpu.cc @@ -193,10 +193,6 @@ InOrderCPU::InOrderCPU(Params *params) i, this->thread[i]); this->thread[i] = new Thread(this, i, params->workload[i], i); - - // Start thread's off in "Suspended" status - this->thread[i]->setStatus(ThreadContext::Suspended); - } else { //Allocate Empty thread so M5 can use later //when scheduling threads to CPU diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index 1d7fb97c0..6a39f07be 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -356,7 +356,6 @@ FullO3CPU::FullO3CPU(DerivO3CPUParams *params) // SMT is not supported in FS mode yet. assert(this->numThreads == 1); this->thread[i] = new Thread(this, 0); - this->thread[i]->setStatus(ThreadContext::Suspended); #else if (i < params->workload.size()) { DPRINTF(O3CPU, "Workload[%i] process is %#x", @@ -365,8 +364,6 @@ FullO3CPU::FullO3CPU(DerivO3CPUParams *params) (typename Impl::O3CPU *)(this), i, params->workload[i], i); - this->thread[i]->setStatus(ThreadContext::Suspended); - //usedTids[i] = true; //threadMap[i] = i; } else { diff --git a/src/cpu/ozone/cpu_impl.hh b/src/cpu/ozone/cpu_impl.hh index 060ea6d78..ba1205010 100644 --- a/src/cpu/ozone/cpu_impl.hh +++ b/src/cpu/ozone/cpu_impl.hh @@ -131,7 +131,6 @@ OzoneCPU::OzoneCPU(Params *p) thread.inSyscall = false; - thread.setStatus(ThreadContext::Suspended); itb = p->itb; dtb = p->dtb; #if FULL_SYSTEM diff --git a/src/cpu/thread_state.cc b/src/cpu/thread_state.cc index b0e719ddf..09af2725a 100644 --- a/src/cpu/thread_state.cc +++ b/src/cpu/thread_state.cc @@ -44,20 +44,20 @@ #if FULL_SYSTEM ThreadState::ThreadState(BaseCPU *cpu, int _tid) - : baseCpu(cpu), _threadId(_tid), lastActivate(0), lastSuspend(0), +#else +ThreadState::ThreadState(BaseCPU *cpu, int _tid, + Process *_process, short _asid) +#endif + : numInst(0), numLoad(0), _status(ThreadContext::Halted), + baseCpu(cpu), _threadId(_tid), lastActivate(0), lastSuspend(0), +#if FULL_SYSTEM profile(NULL), profileNode(NULL), profilePC(0), quiesceEvent(NULL), kernelStats(NULL), physPort(NULL), virtPort(NULL), - microPC(0), nextMicroPC(1), funcExeInst(0), storeCondFailures(0) #else -ThreadState::ThreadState(BaseCPU *cpu, int _tid, Process *_process, - short _asid) - : baseCpu(cpu), _threadId(_tid), lastActivate(0), lastSuspend(0), port(NULL), process(_process), asid(_asid), - microPC(0), nextMicroPC(1), funcExeInst(0), storeCondFailures(0) #endif + microPC(0), nextMicroPC(1), funcExeInst(0), storeCondFailures(0) { - numInst = 0; - numLoad = 0; } ThreadState::~ThreadState() diff --git a/src/cpu/thread_state.hh b/src/cpu/thread_state.hh index 99f0c2a87..dbae85998 100644 --- a/src/cpu/thread_state.hh +++ b/src/cpu/thread_state.hh @@ -68,8 +68,7 @@ struct ThreadState { #if FULL_SYSTEM ThreadState(BaseCPU *cpu, int _tid); #else - ThreadState(BaseCPU *cpu, int _tid, Process *_process, - short _asid); + ThreadState(BaseCPU *cpu, int _tid, Process *_process, short _asid); #endif ~ThreadState(); -- 2.30.2