diff options
author | Kevin Lim <ktlim@umich.edu> | 2006-11-19 17:43:03 -0500 |
---|---|---|
committer | Kevin Lim <ktlim@umich.edu> | 2006-11-19 17:43:03 -0500 |
commit | a2113fd3dc85798c7dcc1d67691ffd29a86ef5a0 (patch) | |
tree | eb2a28bb316c4748a156bccae6dada417afa4495 /src | |
parent | a00e13b1fe1f7f552bbb4623c4a4638f69e42000 (diff) | |
download | gem5-a2113fd3dc85798c7dcc1d67691ffd29a86ef5a0.tar.xz |
Update Virtual and Physical ports.
src/cpu/o3/alpha/cpu_impl.hh:
Handle the PhysicalPort and VirtualPort in the ThreadState.
src/cpu/o3/cpu.cc:
Initialize the thread context.
src/cpu/o3/thread_context.hh:
Add new function to initialize thread context.
src/cpu/o3/thread_context_impl.hh:
Use code now put into function.
src/cpu/simple_thread.cc:
Move code to ThreadState and use the new helper function.
src/cpu/simple_thread.hh:
Remove init() in this derived class; use init() from ThreadState base class.
src/cpu/thread_state.cc:
Move setting up of Physical and Virtual ports here. Change getMemFuncPort() to connectToMemFunc(), which connects a port to a functional port of the memory object below the CPU.
src/cpu/thread_state.hh:
Update functions.
--HG--
extra : convert_revision : ff254715ef0b259dc80d08f13543b63e4024ca8d
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu/o3/alpha/cpu_impl.hh | 18 | ||||
-rw-r--r-- | src/cpu/o3/cpu.cc | 2 | ||||
-rwxr-xr-x | src/cpu/o3/thread_context.hh | 2 | ||||
-rwxr-xr-x | src/cpu/o3/thread_context_impl.hh | 5 | ||||
-rw-r--r-- | src/cpu/simple_thread.cc | 24 | ||||
-rw-r--r-- | src/cpu/simple_thread.hh | 2 | ||||
-rw-r--r-- | src/cpu/thread_state.cc | 35 | ||||
-rw-r--r-- | src/cpu/thread_state.hh | 12 |
8 files changed, 43 insertions, 57 deletions
diff --git a/src/cpu/o3/alpha/cpu_impl.hh b/src/cpu/o3/alpha/cpu_impl.hh index b2ef78360..98fd0699a 100644 --- a/src/cpu/o3/alpha/cpu_impl.hh +++ b/src/cpu/o3/alpha/cpu_impl.hh @@ -116,24 +116,6 @@ AlphaO3CPU<Impl>::AlphaO3CPU(Params *params) #if FULL_SYSTEM // Setup quiesce event. this->thread[i]->quiesceEvent = new EndQuiesceEvent(tc); - - Port *mem_port; - FunctionalPort *phys_port; - VirtualPort *virt_port; - phys_port = new FunctionalPort(csprintf("%s-%d-funcport", - name(), i)); - mem_port = this->system->physmem->getPort("functional"); - mem_port->setPeer(phys_port); - phys_port->setPeer(mem_port); - - virt_port = new VirtualPort(csprintf("%s-%d-vport", - name(), i)); - mem_port = this->system->physmem->getPort("functional"); - mem_port->setPeer(virt_port); - virt_port->setPeer(mem_port); - - this->thread[i]->setPhysPort(phys_port); - this->thread[i]->setVirtPort(virt_port); #endif // Give the thread the TC. this->thread[i]->tc = tc; diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index 580816372..3dc353a9f 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -497,6 +497,8 @@ FullO3CPU<Impl>::init() } #if FULL_SYSTEM + src_tc->init(); + TheISA::initCPU(src_tc, src_tc->readCpuId()); #endif } diff --git a/src/cpu/o3/thread_context.hh b/src/cpu/o3/thread_context.hh index daee2fc7d..031f36480 100755 --- a/src/cpu/o3/thread_context.hh +++ b/src/cpu/o3/thread_context.hh @@ -91,6 +91,8 @@ class O3ThreadContext : public ThreadContext virtual VirtualPort *getVirtPort(ThreadContext *src_tc = NULL); void delVirtPort(VirtualPort *vp); + + virtual void init() { thread->init(); } #else virtual TranslatingPort *getMemPort() { return thread->getMemPort(); } diff --git a/src/cpu/o3/thread_context_impl.hh b/src/cpu/o3/thread_context_impl.hh index 8d623f5b8..0180756e3 100755 --- a/src/cpu/o3/thread_context_impl.hh +++ b/src/cpu/o3/thread_context_impl.hh @@ -41,12 +41,9 @@ O3ThreadContext<Impl>::getVirtPort(ThreadContext *src_tc) return thread->getVirtPort(); VirtualPort *vp; - Port *mem_port; vp = new VirtualPort("tc-vport", src_tc); - mem_port = cpu->system->physmem->getPort("functional"); - mem_port->setPeer(vp); - vp->setPeer(mem_port); + thread->connectToMemFunc(vp); return vp; } diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc index e07d6e7c1..13d0e2e29 100644 --- a/src/cpu/simple_thread.cc +++ b/src/cpu/simple_thread.cc @@ -104,25 +104,6 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, #endif -#if FULL_SYSTEM -void -SimpleThread::init() -{ - Port *mem_port; - physPort = new FunctionalPort(csprintf("%s-%d-funcport", - cpu->name(), tid)); - mem_port = getMemFuncPort(); - mem_port->setPeer(physPort); - physPort->setPeer(mem_port); - - virtPort = new VirtualPort(csprintf("%s-%d-vport", - cpu->name(), tid)); - mem_port = getMemFuncPort(); - mem_port->setPeer(virtPort); - virtPort->setPeer(mem_port); -} -#endif - SimpleThread::SimpleThread() #if FULL_SYSTEM : ThreadState(NULL, -1, -1) @@ -316,10 +297,7 @@ SimpleThread::getVirtPort(ThreadContext *src_tc) return virtPort; VirtualPort *vp = new VirtualPort("tc-vport", src_tc); - Port *mem_port = getMemFuncPort(); - - mem_port->setPeer(vp); - vp->setPeer(mem_port); + connectToMemFunc(vp); return vp; } diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh index b9ce4e0ce..e8757c8c2 100644 --- a/src/cpu/simple_thread.hh +++ b/src/cpu/simple_thread.hh @@ -118,8 +118,6 @@ class SimpleThread : public ThreadState SimpleThread(BaseCPU *_cpu, int _thread_num, System *_system, TheISA::ITB *_itb, TheISA::DTB *_dtb, bool use_kernel_stats = true); - - void init(); #else SimpleThread(BaseCPU *_cpu, int _thread_num, Process *_process, int _asid); #endif diff --git a/src/cpu/thread_state.cc b/src/cpu/thread_state.cc index 8602f8a50..9cac4fd26 100644 --- a/src/cpu/thread_state.cc +++ b/src/cpu/thread_state.cc @@ -39,6 +39,7 @@ #if FULL_SYSTEM #include "arch/kernel_stats.hh" #include "cpu/quiesce_event.hh" +#include "mem/vport.hh" #endif #if FULL_SYSTEM @@ -111,6 +112,28 @@ ThreadState::unserialize(Checkpoint *cp, const std::string §ion) } #if FULL_SYSTEM +void +ThreadState::init() +{ + initPhysPort(); + initVirtPort(); +} + +void +ThreadState::initPhysPort() +{ + physPort = new FunctionalPort(csprintf("%s-%d-funcport", + baseCpu->name(), tid)); + connectToMemFunc(physPort); +} + +void +ThreadState::initVirtPort() +{ + virtPort = new VirtualPort(csprintf("%s-%d-vport", + baseCpu->name(), tid)); + connectToMemFunc(virtPort); +} void ThreadState::profileClear() @@ -138,17 +161,14 @@ ThreadState::getMemPort() baseCpu->name(), tid), process->pTable, false); - Port *func_port = getMemFuncPort(); - - func_port->setPeer(port); - port->setPeer(func_port); + connectToMemFunc(port); return port; } #endif -Port * -ThreadState::getMemFuncPort() +void +ThreadState::connectToMemFunc(Port *port) { Port *dcache_port, *func_mem_port; @@ -161,5 +181,6 @@ ThreadState::getMemFuncPort() func_mem_port = mem_object->getPort("functional"); assert(func_mem_port != NULL); - return func_mem_port; + func_mem_port->setPeer(port); + port->setPeer(func_mem_port); } diff --git a/src/cpu/thread_state.hh b/src/cpu/thread_state.hh index 183ddcd2b..1844be8b7 100644 --- a/src/cpu/thread_state.hh +++ b/src/cpu/thread_state.hh @@ -91,6 +91,12 @@ struct ThreadState { Tick readLastSuspend() { return lastSuspend; } #if FULL_SYSTEM + void init(); + + void initPhysPort(); + + void initVirtPort(); + void dumpFuncProfile(); EndQuiesceEvent *getQuiesceEvent() { return quiesceEvent; } @@ -142,9 +148,9 @@ struct ThreadState { void setStatus(Status new_status) { _status = new_status; } public: - /** Gets a functional port from the memory object that's connected - * to the CPU. */ - Port *getMemFuncPort(); + /** Connects port to the functional port of the memory object + * below the CPU. */ + void connectToMemFunc(Port *port); /** Number of instructions committed. */ Counter numInst; |