inorder: stall signal handling
[gem5.git] / src / cpu / thread_state.cc
index 8d519c563df89df67abbcd598f6007183c744074..c62a7a3beba1957f6b9ada599f861b903674dfa4 100644 (file)
 #endif
 
 #if FULL_SYSTEM
-ThreadState::ThreadState(BaseCPU *cpu, int _cpuId, int _tid)
-    : baseCpu(cpu), cpuId(_cpuId), tid(_tid), lastActivate(0), lastSuspend(0),
+ThreadState::ThreadState(BaseCPU *cpu, ThreadID _tid)
+#else
+ThreadState::ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
+#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 _cpuId, int _tid, Process *_process,
-                         short _asid)
-    : baseCpu(cpu), cpuId(_cpuId), tid(_tid), lastActivate(0), lastSuspend(0),
-      port(NULL), process(_process), asid(_asid),
-      microPC(0), nextMicroPC(1), funcExeInst(0), storeCondFailures(0)
+      port(NULL), process(_process),
 #endif
+      funcExeInst(0), storeCondFailures(0)
 {
-    numInst = 0;
-    numLoad = 0;
 }
 
 ThreadState::~ThreadState()
@@ -77,8 +76,6 @@ ThreadState::serialize(std::ostream &os)
     // thread_num and cpu_id are deterministic from the config
     SERIALIZE_SCALAR(funcExeInst);
     SERIALIZE_SCALAR(inst);
-    SERIALIZE_SCALAR(microPC);
-    SERIALIZE_SCALAR(nextMicroPC);
 
 #if FULL_SYSTEM
     Tick quiesceEndTick = 0;
@@ -98,8 +95,6 @@ ThreadState::unserialize(Checkpoint *cp, const std::string &section)
     // thread_num and cpu_id are deterministic from the config
     UNSERIALIZE_SCALAR(funcExeInst);
     UNSERIALIZE_SCALAR(inst);
-    UNSERIALIZE_SCALAR(microPC);
-    UNSERIALIZE_SCALAR(nextMicroPC);
 
 #if FULL_SYSTEM
     Tick quiesceEndTick;
@@ -129,7 +124,7 @@ ThreadState::connectPhysPort()
         physPort->removeConn();
     else
         physPort = new FunctionalPort(csprintf("%s-%d-funcport",
-                                           baseCpu->name(), tid));
+                                           baseCpu->name(), _threadId));
     connectToMemFunc(physPort);
 }
 
@@ -143,7 +138,7 @@ ThreadState::connectVirtPort(ThreadContext *tc)
         virtPort->removeConn();
     else
         virtPort = new VirtualPort(csprintf("%s-%d-vport",
-                                        baseCpu->name(), tid), tc);
+                                        baseCpu->name(), _threadId), tc);
     connectToMemFunc(virtPort);
 }
 
@@ -169,7 +164,7 @@ ThreadState::getMemPort()
         return port;
 
     /* Use this port to for syscall emulation writes to memory. */
-    port = new TranslatingPort(csprintf("%s-%d-funcport", baseCpu->name(), tid),
+    port = new TranslatingPort(csprintf("%s-%d-funcport", baseCpu->name(), _threadId),
                                process, TranslatingPort::NextPage);
 
     connectToMemFunc(port);