From 8ad2b8c5596b817267fbf7a39e6ce28ffb49789c Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 31 Oct 2011 02:58:22 -0700 Subject: SE/FS: Make the functions available from the TC consistent between SE and FS. --- src/cpu/SConscript | 3 +-- src/cpu/inorder/cpu.cc | 10 +--------- src/cpu/inorder/cpu.hh | 4 +--- src/cpu/inorder/thread_context.cc | 3 --- src/cpu/inorder/thread_context.hh | 5 ++--- src/cpu/inorder/thread_state.cc | 3 --- src/cpu/inorder/thread_state.hh | 2 -- src/cpu/o3/cpu.cc | 4 ---- src/cpu/o3/cpu.hh | 2 -- src/cpu/o3/thread_context.hh | 15 +++++---------- src/cpu/o3/thread_context_impl.hh | 4 ---- src/cpu/o3/thread_state.hh | 15 +++------------ src/cpu/simple_thread.cc | 24 +++++++++--------------- src/cpu/simple_thread.hh | 20 ++++---------------- src/cpu/thread_context.cc | 2 -- src/cpu/thread_context.hh | 19 ++----------------- src/cpu/thread_state.cc | 2 -- src/cpu/thread_state.hh | 8 ++------ 18 files changed, 30 insertions(+), 115 deletions(-) (limited to 'src/cpu') diff --git a/src/cpu/SConscript b/src/cpu/SConscript index 370b83909..c6743caa0 100644 --- a/src/cpu/SConscript +++ b/src/cpu/SConscript @@ -122,6 +122,7 @@ Source('inteltrace.cc') Source('intr_control.cc') Source('nativetrace.cc') Source('pc_event.cc') +Source('profile.cc') Source('quiesce_event.cc') Source('static_inst.cc') Source('simple_thread.cc') @@ -129,8 +130,6 @@ Source('thread_context.cc') Source('thread_state.cc') if env['FULL_SYSTEM']: - Source('profile.cc') - if env['TARGET_ISA'] == 'sparc': SimObject('LegionTrace.py') Source('legiontrace.cc') diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc index cfc083718..97fbe737e 100644 --- a/src/cpu/inorder/cpu.cc +++ b/src/cpu/inorder/cpu.cc @@ -46,6 +46,7 @@ #include "cpu/activity.hh" #include "cpu/base.hh" #include "cpu/exetrace.hh" +#include "cpu/quiesce_event.hh" #include "cpu/simple_thread.hh" #include "cpu/thread_context.hh" #include "debug/Activity.hh" @@ -57,11 +58,7 @@ #include "params/InOrderCPU.hh" #include "sim/process.hh" #include "sim/stat_control.hh" - -#if FULL_SYSTEM -#include "cpu/quiesce_event.hh" #include "sim/system.hh" -#endif #if THE_ISA == ALPHA_ISA #include "arch/alpha/osfpal.hh" @@ -786,7 +783,6 @@ InOrderCPU::getPort(const std::string &if_name, int idx) return resPool->getPort(if_name, idx); } -#if FULL_SYSTEM Fault InOrderCPU::hwrei(ThreadID tid) { @@ -891,7 +887,6 @@ InOrderCPU::processInterrupts(Fault interrupt) trap(interrupt, threadContexts[0]->contextId(), dummyBufferInst); } - void InOrderCPU::updateMemPorts() { @@ -901,7 +896,6 @@ InOrderCPU::updateMemPorts() for (ThreadID i = 0; i < size; ++i) thread[i]->connectMemPorts(thread[i]->getTC()); } -#endif void InOrderCPU::trapContext(Fault fault, ThreadID tid, DynInstPtr inst, int delay) @@ -1709,7 +1703,6 @@ InOrderCPU::wakeup() } #endif -#if !FULL_SYSTEM void InOrderCPU::syscallContext(Fault fault, ThreadID tid, DynInstPtr inst, int delay) { @@ -1747,7 +1740,6 @@ InOrderCPU::syscall(int64_t callnum, ThreadID tid) // Clear Non-Speculative Block Variable nonSpecInstActive[tid] = false; } -#endif TheISA::TLB* InOrderCPU::getITBPtr() diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh index 098909cb7..dd53f3ce5 100644 --- a/src/cpu/inorder/cpu.hh +++ b/src/cpu/inorder/cpu.hh @@ -413,7 +413,6 @@ class InOrderCPU : public BaseCPU /** Get a Memory Port */ Port* getPort(const std::string &if_name, int idx = 0); -#if FULL_SYSTEM /** HW return from error interrupt. */ Fault hwrei(ThreadID tid); @@ -439,14 +438,13 @@ class InOrderCPU : public BaseCPU /** Check if this address is a valid data address. */ bool validDataAddr(Addr addr) { return true; } -#else + /** Schedule a syscall on the CPU */ void syscallContext(Fault fault, ThreadID tid, DynInstPtr inst, int delay = 0); /** Executes a syscall.*/ void syscall(int64_t callnum, ThreadID tid); -#endif /** Schedule a trap on the CPU */ void trapContext(Fault fault, ThreadID tid, DynInstPtr inst, int delay = 0); diff --git a/src/cpu/inorder/thread_context.cc b/src/cpu/inorder/thread_context.cc index 8fc6ac75f..ecdb61f1f 100644 --- a/src/cpu/inorder/thread_context.cc +++ b/src/cpu/inorder/thread_context.cc @@ -43,8 +43,6 @@ InOrderThreadContext::getVirtPort() return thread->getVirtPort(); } -#if FULL_SYSTEM - void InOrderThreadContext::dumpFuncProfile() { @@ -78,7 +76,6 @@ InOrderThreadContext::profileSample() { thread->profileSample(); } -#endif void InOrderThreadContext::takeOverFrom(ThreadContext *old_context) diff --git a/src/cpu/inorder/thread_context.hh b/src/cpu/inorder/thread_context.hh index 95338c05c..daba6e6b6 100644 --- a/src/cpu/inorder/thread_context.hh +++ b/src/cpu/inorder/thread_context.hh @@ -113,6 +113,7 @@ class InOrderThreadContext : public ThreadContext /** Returns a pointer to physical memory. */ PhysicalMemory *getPhysMemPtr() { assert(0); return 0; /*return cpu->physmem;*/ } +#endif /** Returns a pointer to this thread's kernel statistics. */ TheISA::Kernel::Statistics *getKernelStats() @@ -142,7 +143,7 @@ class InOrderThreadContext : public ThreadContext { return this->thread->quiesceEvent; } -#endif + /** Returns a pointer to this thread's process. */ Process *getProcessPtr() { return thread->getProcessPtr(); } @@ -271,11 +272,9 @@ class InOrderThreadContext : public ThreadContext * misspeculating, this is set as false. */ bool misspeculating() { return false; } -#if !FULL_SYSTEM /** Executes a syscall in SE mode. */ void syscall(int64_t callnum) { return cpu->syscall(callnum, thread->threadId()); } -#endif /** Reads the funcExeInst counter. */ Counter readFuncExeInst() { return thread->funcExeInst; } diff --git a/src/cpu/inorder/thread_state.cc b/src/cpu/inorder/thread_state.cc index b17f05c7d..040e29283 100644 --- a/src/cpu/inorder/thread_state.cc +++ b/src/cpu/inorder/thread_state.cc @@ -36,12 +36,9 @@ using namespace TheISA; -#if FULL_SYSTEM void InOrderThreadState::dumpFuncProfile() { std::ostream *os = simout.create(csprintf("profile.%s.dat", cpu->name())); profile->dump(tc, *os); } -#endif - diff --git a/src/cpu/inorder/thread_state.hh b/src/cpu/inorder/thread_state.hh index e4fe76491..fc5158d4f 100644 --- a/src/cpu/inorder/thread_state.hh +++ b/src/cpu/inorder/thread_state.hh @@ -86,9 +86,7 @@ class InOrderThreadState : public ThreadState { /** Handles the syscall. */ void syscall(int64_t callnum) { process->syscall(callnum, tc); } -#if FULL_SYSTEM void dumpFuncProfile(); -#endif /** Pointer to the ThreadContext of this thread. */ ThreadContext *tc; diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index 371e4d53c..1ffd014cd 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -983,8 +983,6 @@ FullO3CPU::trap(Fault fault, ThreadID tid, StaticInstPtr inst) fault->invoke(this->threadContexts[tid], inst); } -#if !FULL_SYSTEM - template void FullO3CPU::syscall(int64_t callnum, ThreadID tid) @@ -1005,8 +1003,6 @@ FullO3CPU::syscall(int64_t callnum, ThreadID tid) --(this->thread[tid]->funcExeInst); } -#endif - template void FullO3CPU::serialize(std::ostream &os) diff --git a/src/cpu/o3/cpu.hh b/src/cpu/o3/cpu.hh index dd9f5d40f..8eb32fae6 100644 --- a/src/cpu/o3/cpu.hh +++ b/src/cpu/o3/cpu.hh @@ -350,12 +350,10 @@ class FullO3CPU : public BaseO3CPU virtual void unserialize(Checkpoint *cp, const std::string §ion); public: -#if !FULL_SYSTEM /** Executes a syscall. * @todo: Determine if this needs to be virtual. */ void syscall(int64_t callnum, ThreadID tid); -#endif /** Starts draining the CPU's pipeline of all instructions in * order to stop all memory accesses. */ diff --git a/src/cpu/o3/thread_context.hh b/src/cpu/o3/thread_context.hh index 145d6fd29..815c9cb64 100755 --- a/src/cpu/o3/thread_context.hh +++ b/src/cpu/o3/thread_context.hh @@ -92,13 +92,13 @@ class O3ThreadContext : public ThreadContext /** Returns a pointer to the system. */ virtual System *getSystemPtr() { return cpu->system; } -#if FULL_SYSTEM /** Returns a pointer to this thread's kernel statistics. */ virtual TheISA::Kernel::Statistics *getKernelStats() { return thread->kernelStats; } - virtual void connectMemPorts(ThreadContext *tc) { thread->connectMemPorts(tc); } -#endif + virtual void connectMemPorts(ThreadContext *tc) + { thread->connectMemPorts(tc); } + /** Returns a pointer to this thread's process. */ virtual Process *getProcessPtr() { return thread->getProcessPtr(); } @@ -125,12 +125,11 @@ class O3ThreadContext : public ThreadContext /** Set the status to Halted. */ virtual void halt(int delay = 0); -#if FULL_SYSTEM /** Dumps the function profiling information. * @todo: Implement. */ virtual void dumpFuncProfile(); -#endif + /** Takes over execution of a thread from another CPU. */ virtual void takeOverFrom(ThreadContext *old_context); @@ -142,7 +141,6 @@ class O3ThreadContext : public ThreadContext /** Unserializes state. */ virtual void unserialize(Checkpoint *cp, const std::string §ion); -#if FULL_SYSTEM /** Reads the last tick that this thread was activated on. */ virtual Tick readLastActivate(); /** Reads the last tick that this thread was suspended on. */ @@ -152,7 +150,6 @@ class O3ThreadContext : public ThreadContext virtual void profileClear(); /** Samples the function profiling information. */ virtual void profileSample(); -#endif /** Copies the architectural registers from another TC into this TC. */ virtual void copyArchRegs(ThreadContext *tc); @@ -229,20 +226,18 @@ class O3ThreadContext : public ThreadContext * misspeculating, this is set as false. */ virtual bool misspeculating() { return false; } -#if !FULL_SYSTEM /** Executes a syscall in SE mode. */ virtual void syscall(int64_t callnum) { return cpu->syscall(callnum, thread->threadId()); } /** Reads the funcExeInst counter. */ virtual Counter readFuncExeInst() { return thread->funcExeInst; } -#else + /** Returns pointer to the quiesce event. */ virtual EndQuiesceEvent *getQuiesceEvent() { return this->thread->quiesceEvent; } -#endif }; diff --git a/src/cpu/o3/thread_context_impl.hh b/src/cpu/o3/thread_context_impl.hh index 0952465d4..a49440f1f 100755 --- a/src/cpu/o3/thread_context_impl.hh +++ b/src/cpu/o3/thread_context_impl.hh @@ -54,14 +54,12 @@ O3ThreadContext::getVirtPort() return thread->getVirtPort(); } -#if FULL_SYSTEM template void O3ThreadContext::dumpFuncProfile() { thread->dumpFuncProfile(); } -#endif template void @@ -197,7 +195,6 @@ O3ThreadContext::unserialize(Checkpoint *cp, const std::string §ion) } -#if FULL_SYSTEM template Tick O3ThreadContext::readLastActivate() @@ -225,7 +222,6 @@ O3ThreadContext::profileSample() { thread->profileSample(); } -#endif template void diff --git a/src/cpu/o3/thread_state.hh b/src/cpu/o3/thread_state.hh index 40e5c049b..1d58e2b27 100644 --- a/src/cpu/o3/thread_state.hh +++ b/src/cpu/o3/thread_state.hh @@ -37,17 +37,12 @@ #include "cpu/thread_state.hh" #include "sim/sim_exit.hh" -class Event; -class Process; - -#if FULL_SYSTEM class EndQuiesceEvent; -class FunctionProfile; -class ProfileNode; -#else +class Event; class FunctionalMemory; +class FunctionProfile; class Process; -#endif +class ProfileNode; /** * Class that has various thread state, such as the status, the @@ -102,18 +97,14 @@ struct O3ThreadState : public ThreadState { /** Returns a pointer to the TC of this thread. */ ThreadContext *getTC() { return tc; } -#if !FULL_SYSTEM /** Handles the syscall. */ void syscall(int64_t callnum) { process->syscall(callnum, tc); } -#endif -#if FULL_SYSTEM void dumpFuncProfile() { std::ostream *os = simout.create(csprintf("profile.%s.dat", cpu->name())); profile->dump(tc, *os); } -#endif }; #endif // __CPU_O3_THREAD_STATE_HH__ diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc index 53534a4f3..f2d0fde30 100644 --- a/src/cpu/simple_thread.cc +++ b/src/cpu/simple_thread.cc @@ -34,30 +34,26 @@ #include #include "arch/isa_traits.hh" -#include "arch/utility.hh" -#include "config/the_isa.hh" -#include "cpu/base.hh" -#include "cpu/simple_thread.hh" -#include "cpu/thread_context.hh" -#include "mem/vport.hh" -#include "params/BaseCPU.hh" -#include "sim/process.hh" - -#if FULL_SYSTEM #include "arch/kernel_stats.hh" #include "arch/stacktrace.hh" +#include "arch/utility.hh" #include "base/callback.hh" #include "base/cprintf.hh" #include "base/output.hh" #include "base/trace.hh" +#include "config/the_isa.hh" +#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/translating_port.hh" +#include "mem/vport.hh" +#include "params/BaseCPU.hh" +#include "sim/process.hh" #include "sim/serialize.hh" #include "sim/sim_exit.hh" -#else -#include "mem/translating_port.hh" #include "sim/system.hh" -#endif using namespace std; @@ -211,14 +207,12 @@ SimpleThread::unserialize(Checkpoint *cp, const std::string §ion) isa.unserialize(cpu, cp, section); } -#if FULL_SYSTEM void SimpleThread::dumpFuncProfile() { std::ostream *os = simout.create(csprintf("profile.%s.dat", cpu->name())); profile->dump(tc, *os); } -#endif void SimpleThread::activate(int delay) diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh index 4baf832f6..817fdf8ef 100644 --- a/src/cpu/simple_thread.hh +++ b/src/cpu/simple_thread.hh @@ -45,21 +45,22 @@ #include "cpu/thread_state.hh" #include "debug/FloatRegs.hh" #include "debug/IntRegs.hh" +#include "mem/page_table.hh" #include "mem/request.hh" #include "sim/byteswap.hh" #include "sim/eventq.hh" +#include "sim/process.hh" #include "sim/serialize.hh" +#include "sim/system.hh" class BaseCPU; -#if FULL_SYSTEM - -#include "sim/system.hh" class FunctionProfile; class ProfileNode; class FunctionalPort; class PhysicalPort; +class TranslatingPort; namespace TheISA { namespace Kernel { @@ -67,14 +68,6 @@ namespace TheISA { }; }; -#else // !FULL_SYSTEM - -#include "mem/page_table.hh" -#include "sim/process.hh" -class TranslatingPort; - -#endif // FULL_SYSTEM - /** * The SimpleThread object provides a combination of the ThreadState * object and the ThreadContext interface. It implements the @@ -184,15 +177,12 @@ class SimpleThread : public ThreadState dtb->demapPage(vaddr, asn); } -#if FULL_SYSTEM void dumpFuncProfile(); Fault hwrei(); bool simPalCheck(int palFunc); -#endif - /******************************************* * ThreadContext interface functions. ******************************************/ @@ -382,12 +372,10 @@ class SimpleThread : public ThreadState void setStCondFailures(unsigned sc_failures) { storeCondFailures = sc_failures; } -#if !FULL_SYSTEM void syscall(int64_t callnum) { process->syscall(callnum, tc); } -#endif }; diff --git a/src/cpu/thread_context.cc b/src/cpu/thread_context.cc index 334bdf4d4..c403667bf 100644 --- a/src/cpu/thread_context.cc +++ b/src/cpu/thread_context.cc @@ -56,7 +56,6 @@ ThreadContext::compare(ThreadContext *one, ThreadContext *two) panic("Float reg idx %d doesn't match, one: %#x, two: %#x", i, t1, t2); } -#if FULL_SYSTEM for (int i = 0; i < TheISA::NumMiscRegs; ++i) { TheISA::MiscReg t1 = one->readMiscRegNoEffect(i); TheISA::MiscReg t2 = two->readMiscRegNoEffect(i); @@ -64,7 +63,6 @@ ThreadContext::compare(ThreadContext *one, ThreadContext *two) panic("Misc reg idx %d doesn't match, one: %#x, two: %#x", i, t1, t2); } -#endif if (!(one->pcState() == two->pcState())) panic("PC state doesn't match."); diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh index e4e26d03c..f7879ea60 100644 --- a/src/cpu/thread_context.hh +++ b/src/cpu/thread_context.hh @@ -37,7 +37,6 @@ #include "arch/registers.hh" #include "arch/types.hh" #include "base/types.hh" -#include "config/full_system.hh" #include "config/the_isa.hh" // @todo: Figure out a more architecture independent way to obtain the ITB and @@ -125,11 +124,10 @@ class ThreadContext virtual System *getSystemPtr() = 0; -#if FULL_SYSTEM virtual TheISA::Kernel::Statistics *getKernelStats() = 0; virtual void connectMemPorts(ThreadContext *tc) = 0; -#endif + virtual Process *getProcessPtr() = 0; virtual TranslatingPort *getMemPort() = 0; @@ -152,9 +150,7 @@ class ThreadContext /// Set the status to Halted. virtual void halt(int delay = 0) = 0; -#if FULL_SYSTEM virtual void dumpFuncProfile() = 0; -#endif virtual void takeOverFrom(ThreadContext *old_context) = 0; @@ -163,7 +159,6 @@ class ThreadContext virtual void serialize(std::ostream &os) = 0; virtual void unserialize(Checkpoint *cp, const std::string §ion) = 0; -#if FULL_SYSTEM virtual EndQuiesceEvent *getQuiesceEvent() = 0; // Not necessarily the best location for these... @@ -173,7 +168,6 @@ class ThreadContext virtual void profileClear() = 0; virtual void profileSample() = 0; -#endif virtual void copyArchRegs(ThreadContext *tc) = 0; @@ -235,7 +229,6 @@ class ThreadContext // Only really makes sense for old CPU model. Still could be useful though. virtual bool misspeculating() = 0; -#if !FULL_SYSTEM // Same with st cond failures. virtual Counter readFuncExeInst() = 0; @@ -245,7 +238,6 @@ class ThreadContext // 1 if the CPU has no more active threads (meaning it's OK to exit); // Used in syscall-emulation mode when a thread calls the exit syscall. virtual int exit() { return 1; }; -#endif /** function to compare two thread contexts (for debugging) */ static void compare(ThreadContext *one, ThreadContext *two); @@ -293,12 +285,11 @@ class ProxyThreadContext : public ThreadContext System *getSystemPtr() { return actualTC->getSystemPtr(); } -#if FULL_SYSTEM TheISA::Kernel::Statistics *getKernelStats() { return actualTC->getKernelStats(); } void connectMemPorts(ThreadContext *tc) { actualTC->connectMemPorts(tc); } -#endif + Process *getProcessPtr() { return actualTC->getProcessPtr(); } TranslatingPort *getMemPort() { return actualTC->getMemPort(); } @@ -321,9 +312,7 @@ class ProxyThreadContext : public ThreadContext /// Set the status to Halted. void halt(int delay = 0) { actualTC->halt(); } -#if FULL_SYSTEM void dumpFuncProfile() { actualTC->dumpFuncProfile(); } -#endif void takeOverFrom(ThreadContext *oldContext) { actualTC->takeOverFrom(oldContext); } @@ -334,7 +323,6 @@ class ProxyThreadContext : public ThreadContext void unserialize(Checkpoint *cp, const std::string §ion) { actualTC->unserialize(cp, section); } -#if FULL_SYSTEM EndQuiesceEvent *getQuiesceEvent() { return actualTC->getQuiesceEvent(); } Tick readLastActivate() { return actualTC->readLastActivate(); } @@ -342,7 +330,6 @@ class ProxyThreadContext : public ThreadContext void profileClear() { return actualTC->profileClear(); } void profileSample() { return actualTC->profileSample(); } -#endif // @todo: Do I need this? void copyArchRegs(ThreadContext *tc) { actualTC->copyArchRegs(tc); } @@ -410,12 +397,10 @@ class ProxyThreadContext : public ThreadContext // @todo: Fix this! bool misspeculating() { return actualTC->misspeculating(); } -#if !FULL_SYSTEM void syscall(int64_t callnum) { actualTC->syscall(callnum); } Counter readFuncExeInst() { return actualTC->readFuncExeInst(); } -#endif }; #endif diff --git a/src/cpu/thread_state.cc b/src/cpu/thread_state.cc index cce9d8015..efb1d5469 100644 --- a/src/cpu/thread_state.cc +++ b/src/cpu/thread_state.cc @@ -125,7 +125,6 @@ ThreadState::connectVirtPort(ThreadContext *tc) connectToMemFunc(virtPort); } -#if FULL_SYSTEM void ThreadState::connectMemPorts(ThreadContext *tc) { @@ -146,7 +145,6 @@ ThreadState::profileSample() if (profile) profile->sample(profileNode, profilePC); } -#endif TranslatingPort * ThreadState::getMemPort() diff --git a/src/cpu/thread_state.hh b/src/cpu/thread_state.hh index bc16b4f98..972ca895d 100644 --- a/src/cpu/thread_state.hh +++ b/src/cpu/thread_state.hh @@ -39,7 +39,6 @@ #include "mem/mem_object.hh" #include "sim/process.hh" -#if FULL_SYSTEM class EndQuiesceEvent; class FunctionProfile; class ProfileNode; @@ -48,7 +47,6 @@ namespace TheISA { class Statistics; }; }; -#endif class Checkpoint; class Port; @@ -89,7 +87,6 @@ struct ThreadState { void connectVirtPort(ThreadContext *tc); -#if FULL_SYSTEM void connectMemPorts(ThreadContext *tc); void dumpFuncProfile(); @@ -101,7 +98,7 @@ struct ThreadState { void profileSample(); TheISA::Kernel::Statistics *getKernelStats() { return kernelStats; } -#endif + Process *getProcessPtr() { return process; } TranslatingPort *getMemPort(); @@ -169,7 +166,6 @@ struct ThreadState { /** Last time suspend was called on this thread. */ Tick lastSuspend; -#if FULL_SYSTEM public: FunctionProfile *profile; ProfileNode *profileNode; @@ -177,7 +173,7 @@ struct ThreadState { EndQuiesceEvent *quiesceEvent; TheISA::Kernel::Statistics *kernelStats; -#endif + protected: Process *process; -- cgit v1.2.3