inorder: set thread status'

set Active/Suspended/Halted status for threads.  useful for system when determining
if/when to exit simulation
This commit is contained in:
Korey Sewell 2010-01-31 18:28:12 -05:00
parent 5e0b8337ed
commit b4e0ef7837
2 changed files with 10 additions and 3 deletions

View file

@ -711,6 +711,8 @@ InOrderCPU::activateThread(ThreadID tid)
thread[tid]->lastActivate = curTick; thread[tid]->lastActivate = curTick;
tcBase(tid)->setStatus(ThreadContext::Active);
wakeCPU(); wakeCPU();
} }
} }
@ -750,9 +752,11 @@ InOrderCPU::deactivateThread(ThreadID tid)
removePipelineStalls(*thread_it); removePipelineStalls(*thread_it);
//@TODO: change stage status' to Idle?
activeThreads.erase(thread_it); activeThreads.erase(thread_it);
// Ideally, this should be triggered from the
// suspendContext/Thread functions
tcBase(tid)->setStatus(ThreadContext::Suspended);
} }
assert(!isThreadActive(tid)); assert(!isThreadActive(tid));
@ -854,6 +858,8 @@ InOrderCPU::haltThread(ThreadID tid)
squashThreadInPipeline(tid); squashThreadInPipeline(tid);
haltedThreads.push_back(tid); haltedThreads.push_back(tid);
tcBase(tid)->setStatus(ThreadContext::Halted);
if (threadModel == SwitchOnCacheMiss) { if (threadModel == SwitchOnCacheMiss) {
activateNextReadyContext(); activateNextReadyContext();
} }
@ -872,6 +878,8 @@ InOrderCPU::suspendThread(ThreadID tid)
deactivateThread(tid); deactivateThread(tid);
suspendedThreads.push_back(tid); suspendedThreads.push_back(tid);
thread[tid]->lastSuspend = curTick; thread[tid]->lastSuspend = curTick;
tcBase(tid)->setStatus(ThreadContext::Suspended);
} }
void void

View file

@ -64,7 +64,6 @@ class InOrderThreadContext : public ThreadContext
/** Pointer to the thread state that this TC corrseponds to. */ /** Pointer to the thread state that this TC corrseponds to. */
InOrderThreadState *thread; InOrderThreadState *thread;
/** Returns a pointer to the ITB. */ /** Returns a pointer to the ITB. */
/** @TODO: PERF: Should we bind this to a pointer in constructor? */ /** @TODO: PERF: Should we bind this to a pointer in constructor? */
TheISA::TLB *getITBPtr() { return cpu->getITBPtr(); } TheISA::TLB *getITBPtr() { return cpu->getITBPtr(); }