changeset b0773af78423 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=b0773af78423
description:
        SE/FS: Build the base process class in FS.

diffstat:

 src/cpu/inorder/cpu.cc          |   2 +-
 src/cpu/inorder/thread_state.hh |  11 +----------
 src/cpu/o3/cpu.cc               |   2 +-
 src/cpu/o3/thread_state.hh      |  13 ++++---------
 src/cpu/simple_thread.cc        |  27 +++++++++++----------------
 src/cpu/thread_state.cc         |  18 +++---------------
 src/cpu/thread_state.hh         |  10 +---------
 src/mem/page_table.cc           |  18 +++---------------
 src/mem/page_table.hh           |  10 +---------
 src/mem/translating_port.cc     |  16 ++--------------
 src/mem/translating_port.hh     |  11 +----------
 src/sim/SConscript              |   4 ++--
 src/sim/process.cc              |  14 ++++----------
 src/sim/process.hh              |  11 -----------
 src/sim/process_impl.hh         |  12 ------------
 src/sim/syscall_emul.hh         |   1 +
 16 files changed, 36 insertions(+), 144 deletions(-)

diffs (truncated from 549 to 300 lines):

diff -r 659670964330 -r b0773af78423 src/cpu/inorder/cpu.cc
--- a/src/cpu/inorder/cpu.cc    Sun Oct 16 05:06:40 2011 -0700
+++ b/src/cpu/inorder/cpu.cc    Sun Oct 30 00:32:54 2011 -0700
@@ -267,7 +267,7 @@
 #if FULL_SYSTEM
         // SMT is not supported in FS mode yet.
         assert(numThreads == 1);
-        thread[tid] = new Thread(this, 0);
+        thread[tid] = new Thread(this, 0, NULL);
 #else
         if (tid < (ThreadID)params->workload.size()) {
             DPRINTF(InOrderCPU, "Workload[%i] process is %#x\n",
diff -r 659670964330 -r b0773af78423 src/cpu/inorder/thread_state.hh
--- a/src/cpu/inorder/thread_state.hh   Sun Oct 16 05:06:40 2011 -0700
+++ b/src/cpu/inorder/thread_state.hh   Sun Oct 30 00:32:54 2011 -0700
@@ -48,8 +48,8 @@
 class ProfileNode;
 #else
 class FunctionalMemory;
+#endif
 class Process;
-#endif
 
 /**
  * Class that has various thread state, such as the status, the
@@ -76,24 +76,15 @@
      */
     bool trapPending;
 
-#if FULL_SYSTEM
-    InOrderThreadState(InOrderCPU *_cpu, ThreadID _thread_num)
-        : ThreadState(reinterpret_cast<BaseCPU*>(_cpu), _thread_num),
-          cpu(_cpu), inSyscall(0), trapPending(0), lastGradIsBranch(false)
-    { }
-#else
     InOrderThreadState(InOrderCPU *_cpu, ThreadID _thread_num,
                        Process *_process)
         : ThreadState(reinterpret_cast<BaseCPU*>(_cpu), _thread_num,
                       _process),
           cpu(_cpu), inSyscall(0), trapPending(0), lastGradIsBranch(false)
     { }
-#endif
 
-#if !FULL_SYSTEM
     /** Handles the syscall. */
     void syscall(int64_t callnum) { process->syscall(callnum, tc); }
-#endif
 
 #if FULL_SYSTEM
     void dumpFuncProfile();    
diff -r 659670964330 -r b0773af78423 src/cpu/o3/cpu.cc
--- a/src/cpu/o3/cpu.cc Sun Oct 16 05:06:40 2011 -0700
+++ b/src/cpu/o3/cpu.cc Sun Oct 30 00:32:54 2011 -0700
@@ -357,7 +357,7 @@
 #if FULL_SYSTEM
         // SMT is not supported in FS mode yet.
         assert(this->numThreads == 1);
-        this->thread[tid] = new Thread(this, 0);
+        this->thread[tid] = new Thread(this, 0, NULL);
 #else
         if (tid < params->workload.size()) {
             DPRINTF(O3CPU, "Workload[%i] process is %#x",
diff -r 659670964330 -r b0773af78423 src/cpu/o3/thread_state.hh
--- a/src/cpu/o3/thread_state.hh        Sun Oct 16 05:06:40 2011 -0700
+++ b/src/cpu/o3/thread_state.hh        Sun Oct 30 00:32:54 2011 -0700
@@ -75,11 +75,11 @@
      */
     bool trapPending;
 
-#if FULL_SYSTEM
-    O3ThreadState(O3CPU *_cpu, int _thread_num)
-        : ThreadState(_cpu, _thread_num),
+    O3ThreadState(O3CPU *_cpu, int _thread_num, Process *_process)
+        : ThreadState(_cpu, _thread_num, _process),
           cpu(_cpu), inSyscall(0), trapPending(0)
     {
+#if FULL_SYSTEM
         if (cpu->params()->profile) {
             profile = new FunctionProfile(cpu->params()->system->kernelSymtab);
             Callback *cb =
@@ -93,13 +93,8 @@
         static ProfileNode dummyNode;
         profileNode = &dummyNode;
         profilePC = 3;
+#endif
     }
-#else
-    O3ThreadState(O3CPU *_cpu, int _thread_num, Process *_process)
-        : ThreadState(_cpu, _thread_num, _process),
-          cpu(_cpu), inSyscall(0), trapPending(0)
-    { }
-#endif
 
     /** Pointer to the ThreadContext of this thread. */
     ThreadContext *tc;
diff -r 659670964330 -r b0773af78423 src/cpu/simple_thread.cc
--- a/src/cpu/simple_thread.cc  Sun Oct 16 05:06:40 2011 -0700
+++ b/src/cpu/simple_thread.cc  Sun Oct 30 00:32:54 2011 -0700
@@ -62,11 +62,20 @@
 using namespace std;
 
 // constructor
-#if FULL_SYSTEM
+#if !FULL_SYSTEM
+SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, Process *_process,
+                           TheISA::TLB *_itb, TheISA::TLB *_dtb)
+    : ThreadState(_cpu, _thread_num, _process),
+      cpu(_cpu), itb(_itb), dtb(_dtb)
+{
+    clearArchRegs();
+    tc = new ProxyThreadContext<SimpleThread>(this);
+}
+#else
 SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys,
                            TheISA::TLB *_itb, TheISA::TLB *_dtb,
                            bool use_kernel_stats)
-    : ThreadState(_cpu, _thread_num),
+    : ThreadState(_cpu, _thread_num, NULL),
       cpu(_cpu), system(_sys), itb(_itb), dtb(_dtb)
 
 {
@@ -93,24 +102,10 @@
     if (use_kernel_stats)
         kernelStats = new TheISA::Kernel::Statistics(system);
 }
-#else
-SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, Process *_process,
-                           TheISA::TLB *_itb, TheISA::TLB *_dtb)
-    : ThreadState(_cpu, _thread_num, _process),
-      cpu(_cpu), itb(_itb), dtb(_dtb)
-{
-    clearArchRegs();
-    tc = new ProxyThreadContext<SimpleThread>(this);
-}
-
 #endif
 
 SimpleThread::SimpleThread()
-#if FULL_SYSTEM
-    : ThreadState(NULL, -1)
-#else
     : ThreadState(NULL, -1, NULL)
-#endif
 {
     tc = new ProxyThreadContext<SimpleThread>(this);
 }
diff -r 659670964330 -r b0773af78423 src/cpu/thread_state.cc
--- a/src/cpu/thread_state.cc   Sun Oct 16 05:06:40 2011 -0700
+++ b/src/cpu/thread_state.cc   Sun Oct 30 00:32:54 2011 -0700
@@ -42,32 +42,24 @@
 #include "cpu/quiesce_event.hh"
 #endif
 
-#if FULL_SYSTEM
-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),
-#else
-      process(_process),
 #endif
-      port(NULL), virtPort(NULL), physPort(NULL), funcExeInst(0),
-      storeCondFailures(0)
+      process(_process), port(NULL), virtPort(NULL), physPort(NULL),
+      funcExeInst(0), storeCondFailures(0)
 {
 }
 
 ThreadState::~ThreadState()
 {
-#if !FULL_SYSTEM
     if (port) {
         delete port->getPeer();
         delete port;
     }
-#endif
 }
 
 void
@@ -164,11 +156,7 @@
 
     /* Use this port to for syscall emulation writes to memory. */
     port = new TranslatingPort(csprintf("%s-%d-funcport", baseCpu->name(),
-                               _threadId),
-#if !FULL_SYSTEM
-                               process,
-#endif
-                               TranslatingPort::NextPage);
+                               _threadId), process, TranslatingPort::NextPage);
 
     connectToMemFunc(port);
 
diff -r 659670964330 -r b0773af78423 src/cpu/thread_state.hh
--- a/src/cpu/thread_state.hh   Sun Oct 16 05:06:40 2011 -0700
+++ b/src/cpu/thread_state.hh   Sun Oct 30 00:32:54 2011 -0700
@@ -36,11 +36,8 @@
 #include "cpu/base.hh"
 #include "cpu/profile.hh"
 #include "cpu/thread_context.hh"
-
-#if !FULL_SYSTEM
 #include "mem/mem_object.hh"
 #include "sim/process.hh"
-#endif
 
 #if FULL_SYSTEM
 class EndQuiesceEvent;
@@ -66,11 +63,7 @@
 struct ThreadState {
     typedef ThreadContext::Status Status;
 
-#if FULL_SYSTEM
-    ThreadState(BaseCPU *cpu, ThreadID _tid);
-#else
     ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process);
-#endif
 
     ~ThreadState();
 
@@ -185,10 +178,9 @@
     EndQuiesceEvent *quiesceEvent;
 
     TheISA::Kernel::Statistics *kernelStats;
+#endif
   protected:
-#else
     Process *process;
-#endif
 
     TranslatingPort *port;
 
diff -r 659670964330 -r b0773af78423 src/mem/page_table.cc
--- a/src/mem/page_table.cc     Sun Oct 16 05:06:40 2011 -0700
+++ b/src/mem/page_table.cc     Sun Oct 30 00:32:54 2011 -0700
@@ -52,15 +52,9 @@
 using namespace std;
 using namespace TheISA;
 
-PageTable::PageTable(
-#if !FULL_SYSTEM
-        Process *_process,
-#endif
-        Addr _pageSize)
-    : pageSize(_pageSize), offsetMask(mask(floorLog2(_pageSize)))
-#if !FULL_SYSTEM
-      , process(_process)
-#endif
+PageTable::PageTable(Process *_process, Addr _pageSize)
+    : pageSize(_pageSize), offsetMask(mask(floorLog2(_pageSize))),
+      process(_process)
 {
     assert(isPowerOf2(pageSize));
     pTableCache[0].vaddr = 0;
@@ -89,11 +83,9 @@
                     vaddr);
         }
 
-#if !FULL_SYSTEM
         pTable[vaddr] = TheISA::TlbEntry(process->M5_pid, vaddr,
                 process->system->new_page());
         updateCache(vaddr, pTable[vaddr]);
-#endif
     }
 }
 
@@ -204,9 +196,7 @@
     PTableItr iter = pTable.begin();
     PTableItr end = pTable.end();
     while (iter != end) {
-#if !FULL_SYSTEM
         os << "\n[" << csprintf("%s.Entry%d", process->name(), count) << "]\n";
-#endif
 
         paramOut(os, "vaddr", iter->first);
         iter->second.serialize(os);
@@ -226,7 +216,6 @@
     pTable.clear();
 
     while (i < count) {
-#if !FULL_SYSTEM
         TheISA::TlbEntry *entry;
         Addr vaddr;
 
@@ -235,7 +224,6 @@
         entry->unserialize(cp, csprintf("%s.Entry%d", process->name(), i));
         pTable[vaddr] = *entry;
         ++i;
-#endif
     }
 }
 
diff -r 659670964330 -r b0773af78423 src/mem/page_table.hh
--- a/src/mem/page_table.hh     Sun Oct 16 05:06:40 2011 -0700
+++ b/src/mem/page_table.hh     Sun Oct 30 00:32:54 2011 -0700
@@ -47,9 +47,7 @@
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to