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).
This commit is contained in:
Steve Reinhardt 2009-04-15 13:18:24 -07:00
parent 48d4ca522a
commit 7617dcf736
6 changed files with 9 additions and 20 deletions

View file

@ -75,7 +75,6 @@ CheckerCPU::CheckerCPU(Params *p)
thread = new SimpleThread(this, /* thread_num */ 0, process, thread = new SimpleThread(this, /* thread_num */ 0, process,
/* asid */ 0); /* asid */ 0);
thread->setStatus(ThreadContext::Suspended);
tc = thread->getTC(); tc = thread->getTC();
threadContexts.push_back(tc); threadContexts.push_back(tc);
#endif #endif
@ -95,7 +94,6 @@ CheckerCPU::setSystem(System *system)
thread = new SimpleThread(this, 0, systemPtr, itb, dtb, false); thread = new SimpleThread(this, 0, systemPtr, itb, dtb, false);
thread->setStatus(ThreadContext::Suspended);
tc = thread->getTC(); tc = thread->getTC();
threadContexts.push_back(tc); threadContexts.push_back(tc);
delete thread->kernelStats; delete thread->kernelStats;

View file

@ -193,10 +193,6 @@ InOrderCPU::InOrderCPU(Params *params)
i, this->thread[i]); i, this->thread[i]);
this->thread[i] = new Thread(this, i, params->workload[i], this->thread[i] = new Thread(this, i, params->workload[i],
i); i);
// Start thread's off in "Suspended" status
this->thread[i]->setStatus(ThreadContext::Suspended);
} else { } else {
//Allocate Empty thread so M5 can use later //Allocate Empty thread so M5 can use later
//when scheduling threads to CPU //when scheduling threads to CPU

View file

@ -356,7 +356,6 @@ FullO3CPU<Impl>::FullO3CPU(DerivO3CPUParams *params)
// SMT is not supported in FS mode yet. // SMT is not supported in FS mode yet.
assert(this->numThreads == 1); assert(this->numThreads == 1);
this->thread[i] = new Thread(this, 0); this->thread[i] = new Thread(this, 0);
this->thread[i]->setStatus(ThreadContext::Suspended);
#else #else
if (i < params->workload.size()) { if (i < params->workload.size()) {
DPRINTF(O3CPU, "Workload[%i] process is %#x", DPRINTF(O3CPU, "Workload[%i] process is %#x",
@ -365,8 +364,6 @@ FullO3CPU<Impl>::FullO3CPU(DerivO3CPUParams *params)
(typename Impl::O3CPU *)(this), (typename Impl::O3CPU *)(this),
i, params->workload[i], i); i, params->workload[i], i);
this->thread[i]->setStatus(ThreadContext::Suspended);
//usedTids[i] = true; //usedTids[i] = true;
//threadMap[i] = i; //threadMap[i] = i;
} else { } else {

View file

@ -131,7 +131,6 @@ OzoneCPU<Impl>::OzoneCPU(Params *p)
thread.inSyscall = false; thread.inSyscall = false;
thread.setStatus(ThreadContext::Suspended);
itb = p->itb; itb = p->itb;
dtb = p->dtb; dtb = p->dtb;
#if FULL_SYSTEM #if FULL_SYSTEM

View file

@ -44,20 +44,20 @@
#if FULL_SYSTEM #if FULL_SYSTEM
ThreadState::ThreadState(BaseCPU *cpu, int _tid) 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), profile(NULL), profileNode(NULL), profilePC(0), quiesceEvent(NULL),
kernelStats(NULL), physPort(NULL), virtPort(NULL), kernelStats(NULL), physPort(NULL), virtPort(NULL),
microPC(0), nextMicroPC(1), funcExeInst(0), storeCondFailures(0)
#else #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), port(NULL), process(_process), asid(_asid),
microPC(0), nextMicroPC(1), funcExeInst(0), storeCondFailures(0)
#endif #endif
microPC(0), nextMicroPC(1), funcExeInst(0), storeCondFailures(0)
{ {
numInst = 0;
numLoad = 0;
} }
ThreadState::~ThreadState() ThreadState::~ThreadState()

View file

@ -68,8 +68,7 @@ struct ThreadState {
#if FULL_SYSTEM #if FULL_SYSTEM
ThreadState(BaseCPU *cpu, int _tid); ThreadState(BaseCPU *cpu, int _tid);
#else #else
ThreadState(BaseCPU *cpu, int _tid, Process *_process, ThreadState(BaseCPU *cpu, int _tid, Process *_process, short _asid);
short _asid);
#endif #endif
~ThreadState(); ~ThreadState();