Merge zizzer:/bk/newmem

into  zazzer.eecs.umich.edu:/z/rdreslin/m5bk/newmemcleanest

--HG--
extra : convert_revision : 1fc55d7d5707bb7c63790aab306ca5ea8ade5fab
This commit is contained in:
Ron Dreslinski 2006-11-17 22:01:18 -05:00
commit a00e13b1fe
6 changed files with 32 additions and 14 deletions

View file

@ -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());
}

View file

@ -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());
}

View file

@ -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)

View file

@ -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

View file

@ -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(); }

View file

@ -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. */