summaryrefslogtreecommitdiff
path: root/src/cpu/thread_state.cc
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2006-10-31 14:37:19 -0500
committerKevin Lim <ktlim@umich.edu>2006-10-31 14:37:19 -0500
commit5825a6c9d82b813d983b688da5f1ce18c90f774f (patch)
treea5be1a1c3968ff57d387523f95e46bcb2797c121 /src/cpu/thread_state.cc
parent7f39644609e19ada9e94c9bbb09c3e625fa6e8ed (diff)
parentbfd5eb2b08dad700d085a637d5e16a61dcc530d7 (diff)
downloadgem5-5825a6c9d82b813d983b688da5f1ce18c90f774f.tar.xz
Merge ktlim@zizzer:/bk/newmem
into zamp.eecs.umich.edu:/z/ktlim2/clean/newmem-busfix configs/example/fs.py: configs/example/se.py: src/mem/tport.hh: Hand merge. --HG-- extra : convert_revision : b9df95534d43b3b311f24ae24717371d03d615bf
Diffstat (limited to 'src/cpu/thread_state.cc')
-rw-r--r--src/cpu/thread_state.cc43
1 files changed, 37 insertions, 6 deletions
diff --git a/src/cpu/thread_state.cc b/src/cpu/thread_state.cc
index e6ebcc525..f81b78147 100644
--- a/src/cpu/thread_state.cc
+++ b/src/cpu/thread_state.cc
@@ -29,8 +29,11 @@
*/
#include "base/output.hh"
+#include "cpu/base.hh"
#include "cpu/profile.hh"
#include "cpu/thread_state.hh"
+#include "mem/port.hh"
+#include "mem/translating_port.hh"
#include "sim/serialize.hh"
#if FULL_SYSTEM
@@ -39,15 +42,16 @@
#endif
#if FULL_SYSTEM
-ThreadState::ThreadState(int _cpuId, int _tid)
- : cpuId(_cpuId), tid(_tid), lastActivate(0), lastSuspend(0),
+ThreadState::ThreadState(BaseCPU *cpu, int _cpuId, int _tid)
+ : baseCpu(cpu), cpuId(_cpuId), tid(_tid), lastActivate(0), lastSuspend(0),
profile(NULL), profileNode(NULL), profilePC(0), quiesceEvent(NULL),
+ physPort(NULL), virtPort(NULL),
microPC(0), nextMicroPC(1), funcExeInst(0), storeCondFailures(0)
#else
-ThreadState::ThreadState(int _cpuId, int _tid, Process *_process,
- short _asid, MemObject *mem)
- : cpuId(_cpuId), tid(_tid), lastActivate(0), lastSuspend(0),
- process(_process), asid(_asid),
+ThreadState::ThreadState(BaseCPU *cpu, int _cpuId, int _tid, Process *_process,
+ short _asid)
+ : baseCpu(cpu), cpuId(_cpuId), tid(_tid), lastActivate(0), lastSuspend(0),
+ port(NULL), process(_process), asid(_asid),
microPC(0), nextMicroPC(1), funcExeInst(0), storeCondFailures(0)
#endif
{
@@ -112,4 +116,31 @@ ThreadState::profileSample()
profile->sample(profileNode, profilePC);
}
+#else
+TranslatingPort *
+ThreadState::getMemPort()
+{
+ if (port != NULL)
+ return port;
+
+ /* Use this port to for syscall emulation writes to memory. */
+ Port *dcache_port, *func_mem_port;
+ port = new TranslatingPort(csprintf("%s-%d-funcport",
+ baseCpu->name(), tid),
+ process->pTable, false);
+
+ dcache_port = baseCpu->getPort("dcache_port");
+ assert(dcache_port != NULL);
+
+ MemObject *mem_object = dcache_port->getPeer()->getOwner();
+ assert(mem_object != NULL);
+
+ func_mem_port = mem_object->getPort("functional");
+ assert(func_mem_port != NULL);
+
+ func_mem_port->setPeer(port);
+ port->setPeer(func_mem_port);
+
+ return port;
+}
#endif