diff options
author | Ron Dreslinski <rdreslin@umich.edu> | 2006-11-17 22:01:18 -0500 |
---|---|---|
committer | Ron Dreslinski <rdreslin@umich.edu> | 2006-11-17 22:01:18 -0500 |
commit | a00e13b1fe1f7f552bbb4623c4a4638f69e42000 (patch) | |
tree | ca711ddb66ffbff105de2defd3c6bf40cfd52aab | |
parent | f028865d351fbeae38230183e58a77bc0ad0cc12 (diff) | |
parent | cd0b65508e3f9d9f72cd834aeccf9fd1f0349351 (diff) | |
download | gem5-a00e13b1fe1f7f552bbb4623c4a4638f69e42000.tar.xz |
Merge zizzer:/bk/newmem
into zazzer.eecs.umich.edu:/z/rdreslin/m5bk/newmemcleanest
--HG--
extra : convert_revision : 1fc55d7d5707bb7c63790aab306ca5ea8ade5fab
-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. */ |