From 5b433568f05c6f1b093628c2a90f8383abfc1168 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 30 Oct 2011 00:32:54 -0700 Subject: SE/FS: Build the base process class in FS. --- 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 +--------- 7 files changed, 22 insertions(+), 61 deletions(-) (limited to 'src/cpu') diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc index 07a013afc..cfc083718 100644 --- a/src/cpu/inorder/cpu.cc +++ b/src/cpu/inorder/cpu.cc @@ -267,7 +267,7 @@ InOrderCPU::InOrderCPU(Params *params) #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 --git a/src/cpu/inorder/thread_state.hh b/src/cpu/inorder/thread_state.hh index 227097569..e4fe76491 100644 --- a/src/cpu/inorder/thread_state.hh +++ b/src/cpu/inorder/thread_state.hh @@ -48,8 +48,8 @@ class FunctionProfile; class ProfileNode; #else class FunctionalMemory; -class Process; #endif +class Process; /** * Class that has various thread state, such as the status, the @@ -76,24 +76,15 @@ class InOrderThreadState : public ThreadState { */ bool trapPending; -#if FULL_SYSTEM - InOrderThreadState(InOrderCPU *_cpu, ThreadID _thread_num) - : ThreadState(reinterpret_cast(_cpu), _thread_num), - cpu(_cpu), inSyscall(0), trapPending(0), lastGradIsBranch(false) - { } -#else InOrderThreadState(InOrderCPU *_cpu, ThreadID _thread_num, Process *_process) : ThreadState(reinterpret_cast(_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 --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index 441bd4389..371e4d53c 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -357,7 +357,7 @@ FullO3CPU::FullO3CPU(DerivO3CPUParams *params) #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 --git a/src/cpu/o3/thread_state.hh b/src/cpu/o3/thread_state.hh index 1171053b9..40e5c049b 100644 --- a/src/cpu/o3/thread_state.hh +++ b/src/cpu/o3/thread_state.hh @@ -75,11 +75,11 @@ struct O3ThreadState : public ThreadState { */ 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 @@ struct O3ThreadState : public ThreadState { static ProfileNode dummyNode; profileNode = &dummyNode; profilePC = 3; - } -#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 --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc index 2f629c2e1..6b9f60402 100644 --- a/src/cpu/simple_thread.cc +++ b/src/cpu/simple_thread.cc @@ -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(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 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys, 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(this); -} - #endif SimpleThread::SimpleThread() -#if FULL_SYSTEM - : ThreadState(NULL, -1) -#else : ThreadState(NULL, -1, NULL) -#endif { tc = new ProxyThreadContext(this); } diff --git a/src/cpu/thread_state.cc b/src/cpu/thread_state.cc index 342574083..cce9d8015 100644 --- a/src/cpu/thread_state.cc +++ b/src/cpu/thread_state.cc @@ -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 @@ ThreadState::getMemPort() /* 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 --git a/src/cpu/thread_state.hh b/src/cpu/thread_state.hh index 1087c27c2..10b87f02c 100644 --- a/src/cpu/thread_state.hh +++ b/src/cpu/thread_state.hh @@ -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 @@ class TranslatingPort; 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 @@ struct ThreadState { EndQuiesceEvent *quiesceEvent; TheISA::Kernel::Statistics *kernelStats; +#endif protected: -#else Process *process; -#endif TranslatingPort *port; -- cgit v1.2.3