ThreadState: initialize status to Halted in constructor.
authorSteve Reinhardt <steve.reinhardt@amd.com>
Wed, 15 Apr 2009 20:18:24 +0000 (13:18 -0700)
committerSteve Reinhardt <steve.reinhardt@amd.com>
Wed, 15 Apr 2009 20:18:24 +0000 (13:18 -0700)
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
src/cpu/inorder/cpu.cc
src/cpu/o3/cpu.cc
src/cpu/ozone/cpu_impl.hh
src/cpu/thread_state.cc
src/cpu/thread_state.hh

index 14777bc126de5a95c96f205353219b9c8843706f..1c36ad22d5309f59df55bb3f70e8bcf5bcb001dd 100644 (file)
@@ -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;
index 70877aae4b218ec7b75ae76263e29c6203a9988e..9e3843e2042a698a8fccac67bc8c3e4b680a7f30 100644 (file)
@@ -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
index 1d7fb97c06c801470c067df314fc9733c9019a16..6a39f07be8d8e1bb640f3211c94ad0644e352a1d 100644 (file)
@@ -356,7 +356,6 @@ FullO3CPU<Impl>::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<Impl>::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 {
index 060ea6d7894746a519befe982f2b123609cdddc3..ba1205010443f6937b14c452924d35775413385b 100644 (file)
@@ -131,7 +131,6 @@ OzoneCPU<Impl>::OzoneCPU(Params *p)
 
     thread.inSyscall = false;
 
-    thread.setStatus(ThreadContext::Suspended);
     itb = p->itb;
     dtb = p->dtb;
 #if FULL_SYSTEM
index b0e719ddfea2ad578c6705ce3bbca60b4c868826..09af2725a2da2d3b3acfd184465fb5f8ee36b449 100644 (file)
 
 #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()
index 99f0c2a873a05367a5469b119fc0613da1340ec4..dbae859983c4e1f68e15d5ae1c722c2789318136 100644 (file)
@@ -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();