summaryrefslogtreecommitdiff
path: root/src/cpu/thread_state.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/thread_state.cc')
-rw-r--r--src/cpu/thread_state.cc35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/cpu/thread_state.cc b/src/cpu/thread_state.cc
index 8602f8a50..9cac4fd26 100644
--- a/src/cpu/thread_state.cc
+++ b/src/cpu/thread_state.cc
@@ -39,6 +39,7 @@
#if FULL_SYSTEM
#include "arch/kernel_stats.hh"
#include "cpu/quiesce_event.hh"
+#include "mem/vport.hh"
#endif
#if FULL_SYSTEM
@@ -111,6 +112,28 @@ ThreadState::unserialize(Checkpoint *cp, const std::string &section)
}
#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()
@@ -138,17 +161,14 @@ ThreadState::getMemPort()
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;
@@ -161,5 +181,6 @@ ThreadState::getMemFuncPort()
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);
}