diff options
author | Ron Dreslinski <rdreslin@umich.edu> | 2006-11-17 21:55:28 -0500 |
---|---|---|
committer | Ron Dreslinski <rdreslin@umich.edu> | 2006-11-17 21:55:28 -0500 |
commit | cd0b65508e3f9d9f72cd834aeccf9fd1f0349351 (patch) | |
tree | e92d97d22335627754de60a808183e2d00ea3c9c /src | |
parent | dbdf2f14ae6b586efd31b73aa4548a38ecee263f (diff) | |
download | gem5-cd0b65508e3f9d9f72cd834aeccf9fd1f0349351.tar.xz |
Make an initialization pass for the thread context and set the [phys,virt]Port correctly
src/cpu/simple/atomic.cc:
src/cpu/simple/timing.cc:
Call the thread context initialization
--HG--
extra : convert_revision : d7dc2a8b893dc670077b7f6150d4b710a1778620
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu/simple/atomic.cc | 3 | ||||
-rw-r--r-- | src/cpu/simple/timing.cc | 3 | ||||
-rw-r--r-- | src/cpu/simple_thread.cc | 31 | ||||
-rw-r--r-- | src/cpu/simple_thread.hh | 2 | ||||
-rw-r--r-- | src/cpu/thread_context.hh | 4 | ||||
-rw-r--r-- | src/cpu/thread_state.hh | 3 |
6 files changed, 32 insertions, 14 deletions
diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc index 133b5500b..cd335e36d 100644 --- a/src/cpu/simple/atomic.cc +++ b/src/cpu/simple/atomic.cc @@ -77,6 +77,9 @@ AtomicSimpleCPU::init() for (int i = 0; i < threadContexts.size(); ++i) { ThreadContext *tc = threadContexts[i]; + // initialize the mem pointers + tc->init(); + // initialize CPU, including PC TheISA::initCPU(tc, tc->readCpuId()); } diff --git a/src/cpu/simple/timing.cc b/src/cpu/simple/timing.cc index 3648f7613..aa23a00e8 100644 --- a/src/cpu/simple/timing.cc +++ b/src/cpu/simple/timing.cc @@ -59,6 +59,9 @@ TimingSimpleCPU::init() for (int i = 0; i < threadContexts.size(); ++i) { ThreadContext *tc = threadContexts[i]; + // initialize the mem pointers + tc->init(); + // initialize CPU, including PC TheISA::initCPU(tc, tc->readCpuId()); } diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc index 1edcbf352..e07d6e7c1 100644 --- a/src/cpu/simple_thread.cc +++ b/src/cpu/simple_thread.cc @@ -91,18 +91,6 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys, } else { kernelStats = NULL; } - Port *mem_port; - physPort = new FunctionalPort(csprintf("%s-%d-funcport", - cpu->name(), tid)); - mem_port = system->physmem->getPort("functional"); - mem_port->setPeer(physPort); - physPort->setPeer(mem_port); - - virtPort = new VirtualPort(csprintf("%s-%d-vport", - cpu->name(), tid)); - mem_port = system->physmem->getPort("functional"); - mem_port->setPeer(virtPort); - virtPort->setPeer(mem_port); } #else SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, @@ -116,6 +104,25 @@ 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) diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh index e8757c8c2..b9ce4e0ce 100644 --- a/src/cpu/simple_thread.hh +++ b/src/cpu/simple_thread.hh @@ -118,6 +118,8 @@ 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_context.hh b/src/cpu/thread_context.hh index 1e6a907f8..baeb7a8be 100644 --- a/src/cpu/thread_context.hh +++ b/src/cpu/thread_context.hh @@ -133,6 +133,8 @@ class ThreadContext virtual VirtualPort *getVirtPort(ThreadContext *tc = NULL) = 0; virtual void delVirtPort(VirtualPort *vp) = 0; + + virtual void init() = 0; #else virtual TranslatingPort *getMemPort() = 0; @@ -305,6 +307,8 @@ class ProxyThreadContext : public ThreadContext VirtualPort *getVirtPort(ThreadContext *tc = NULL) { return actualTC->getVirtPort(tc); } void delVirtPort(VirtualPort *vp) { return actualTC->delVirtPort(vp); } + + void init() {actualTC->init(); } #else TranslatingPort *getMemPort() { return actualTC->getMemPort(); } diff --git a/src/cpu/thread_state.hh b/src/cpu/thread_state.hh index 0a0af8b71..183ddcd2b 100644 --- a/src/cpu/thread_state.hh +++ b/src/cpu/thread_state.hh @@ -141,12 +141,11 @@ struct ThreadState { /** Sets the status of this thread. */ void setStatus(Status new_status) { _status = new_status; } - protected: + public: /** Gets a functional port from the memory object that's connected * to the CPU. */ Port *getMemFuncPort(); - public: /** Number of instructions committed. */ Counter numInst; /** Stat for number instructions committed. */ |