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
#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;
}
#if FULL_SYSTEM
+ src_tc->init();
+
TheISA::initCPU(src_tc, src_tc->readCpuId());
#endif
}
virtual VirtualPort *getVirtPort(ThreadContext *src_tc = NULL);
void delVirtPort(VirtualPort *vp);
+
+ virtual void init() { thread->init(); }
#else
virtual TranslatingPort *getMemPort() { return thread->getMemPort(); }
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;
}
#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)
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;
}
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
#if FULL_SYSTEM
#include "arch/kernel_stats.hh"
#include "cpu/quiesce_event.hh"
+#include "mem/vport.hh"
#endif
#if FULL_SYSTEM
}
#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()
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;
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);
}
Tick readLastSuspend() { return lastSuspend; }
#if FULL_SYSTEM
+ void init();
+
+ void initPhysPort();
+
+ void initVirtPort();
+
void dumpFuncProfile();
EndQuiesceEvent *getQuiesceEvent() { return quiesceEvent; }
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;