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());
}
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());
}
} 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,
#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)
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
virtual VirtualPort *getVirtPort(ThreadContext *tc = NULL) = 0;
virtual void delVirtPort(VirtualPort *vp) = 0;
+
+ virtual void init() = 0;
#else
virtual TranslatingPort *getMemPort() = 0;
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(); }
/** 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. */