scons: Group Source-s based on what SConscript included them.
[gem5.git] / src / cpu / simple_thread.cc
index 4e2e70e637da15d811201839800bce92bec27328..7c3568cb3bb64ce1229037fbc89c31f96809bf2e 100644 (file)
@@ -31,6 +31,8 @@
  *          Kevin Lim
  */
 
+#include "cpu/simple_thread.hh"
+
 #include <string>
 
 #include "arch/isa_traits.hh"
@@ -45,7 +47,6 @@
 #include "cpu/base.hh"
 #include "cpu/profile.hh"
 #include "cpu/quiesce_event.hh"
-#include "cpu/simple_thread.hh"
 #include "cpu/thread_context.hh"
 #include "mem/fs_translating_port_proxy.hh"
 #include "mem/se_translating_port_proxy.hh"
@@ -63,11 +64,13 @@ using namespace std;
 SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys,
                            Process *_process, TheISA::TLB *_itb,
                            TheISA::TLB *_dtb, TheISA::ISA *_isa)
-    : ThreadState(_cpu, _thread_num, _process), isa(_isa), system(_sys),
+    : ThreadState(_cpu, _thread_num, _process), isa(_isa),
+      predicate(false), system(_sys),
       itb(_itb), dtb(_dtb)
 {
     clearArchRegs();
     tc = new ProxyThreadContext<SimpleThread>(this);
+    quiesceEvent = new EndQuiesceEvent(tc);
 }
 
 SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys,
@@ -130,18 +133,18 @@ SimpleThread::copyState(ThreadContext *oldContext)
 }
 
 void
-SimpleThread::serialize(ostream &os)
+SimpleThread::serialize(CheckpointOut &cp) const
 {
-    ThreadState::serialize(os);
-    ::serialize(*tc, os);
+    ThreadState::serialize(cp);
+    ::serialize(*tc, cp);
 }
 
 
 void
-SimpleThread::unserialize(Checkpoint *cp, const std::string &section)
+SimpleThread::unserialize(CheckpointIn &cp)
 {
-    ThreadState::unserialize(cp, section);
-    ::unserialize(*tc, cp, section);
+    ThreadState::unserialize(cp);
+    ::unserialize(*tc, cp);
 }
 
 void
@@ -153,28 +156,20 @@ SimpleThread::startup()
 void
 SimpleThread::dumpFuncProfile()
 {
-    std::ostream *os = simout.create(csprintf("profile.%s.dat",
-                                              baseCpu->name()));
-    profile->dump(tc, *os);
+    OutputStream *os(simout.create(csprintf("profile.%s.dat", baseCpu->name())));
+    profile->dump(tc, *os->stream());
+    simout.close(os);
 }
 
 void
-SimpleThread::activate(Cycles delay)
+SimpleThread::activate()
 {
     if (status() == ThreadContext::Active)
         return;
 
     lastActivate = curTick();
-
-//    if (status() == ThreadContext::Unallocated) {
-//      cpu->activateWhenReady(_threadId);
-//      return;
-//   }
-
     _status = ThreadContext::Active;
-
-    // status() == Suspended
-    baseCpu->activateContext(_threadId, delay);
+    baseCpu->activateContext(_threadId);
 }
 
 void