summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/checker/thread_context.hh6
-rw-r--r--src/cpu/inorder/thread_context.cc2
-rw-r--r--src/cpu/inorder/thread_context.hh6
-rwxr-xr-xsrc/cpu/o3/thread_context.hh6
-rwxr-xr-xsrc/cpu/o3/thread_context_impl.hh2
-rw-r--r--src/cpu/ozone/cpu.hh6
-rw-r--r--src/cpu/simple_thread.hh8
-rw-r--r--src/cpu/thread_context.hh12
-rw-r--r--src/cpu/thread_state.cc19
-rw-r--r--src/cpu/thread_state.hh13
10 files changed, 34 insertions, 46 deletions
diff --git a/src/cpu/checker/thread_context.hh b/src/cpu/checker/thread_context.hh
index d21de9f53..0d6fa6e2e 100644
--- a/src/cpu/checker/thread_context.hh
+++ b/src/cpu/checker/thread_context.hh
@@ -125,9 +125,9 @@ class CheckerThreadContext : public ThreadContext
Process *getProcessPtr() { return actualTC->getProcessPtr(); }
- PortProxy* getPhysProxy() { return actualTC->getPhysProxy(); }
+ PortProxy &getPhysProxy() { return actualTC->getPhysProxy(); }
- FSTranslatingPortProxy* getVirtProxy()
+ FSTranslatingPortProxy &getVirtProxy()
{ return actualTC->getVirtProxy(); }
//XXX: How does this work now?
@@ -139,7 +139,7 @@ class CheckerThreadContext : public ThreadContext
actualTC->connectMemPorts(tc);
}
- SETranslatingPortProxy* getMemProxy() { return actualTC->getMemProxy(); }
+ SETranslatingPortProxy &getMemProxy() { return actualTC->getMemProxy(); }
/** Executes a syscall in SE mode. */
void syscall(int64_t callnum)
diff --git a/src/cpu/inorder/thread_context.cc b/src/cpu/inorder/thread_context.cc
index 1a7ac0890..72592c299 100644
--- a/src/cpu/inorder/thread_context.cc
+++ b/src/cpu/inorder/thread_context.cc
@@ -38,7 +38,7 @@
using namespace TheISA;
-FSTranslatingPortProxy*
+FSTranslatingPortProxy&
InOrderThreadContext::getVirtProxy()
{
return thread->getVirtProxy();
diff --git a/src/cpu/inorder/thread_context.hh b/src/cpu/inorder/thread_context.hh
index 5a9cfce32..0f9b1028e 100644
--- a/src/cpu/inorder/thread_context.hh
+++ b/src/cpu/inorder/thread_context.hh
@@ -115,9 +115,9 @@ class InOrderThreadContext : public ThreadContext
TheISA::Kernel::Statistics *getKernelStats()
{ return thread->kernelStats; }
- PortProxy* getPhysProxy() { return thread->getPhysProxy(); }
+ PortProxy &getPhysProxy() { return thread->getPhysProxy(); }
- FSTranslatingPortProxy* getVirtProxy();
+ FSTranslatingPortProxy &getVirtProxy();
void initMemProxies(ThreadContext *tc)
{ thread->initMemProxies(tc); }
@@ -144,7 +144,7 @@ class InOrderThreadContext : public ThreadContext
return this->thread->quiesceEvent;
}
- SETranslatingPortProxy* getMemProxy() { return thread->getMemProxy(); }
+ SETranslatingPortProxy &getMemProxy() { return thread->getMemProxy(); }
/** Returns a pointer to this thread's process. */
Process *getProcessPtr() { return thread->getProcessPtr(); }
diff --git a/src/cpu/o3/thread_context.hh b/src/cpu/o3/thread_context.hh
index c2096fab2..8c32d1c05 100755
--- a/src/cpu/o3/thread_context.hh
+++ b/src/cpu/o3/thread_context.hh
@@ -114,14 +114,14 @@ class O3ThreadContext : public ThreadContext
/** Returns a pointer to this thread's process. */
virtual Process *getProcessPtr() { return thread->getProcessPtr(); }
- virtual PortProxy* getPhysProxy() { return thread->getPhysProxy(); }
+ virtual PortProxy &getPhysProxy() { return thread->getPhysProxy(); }
- virtual FSTranslatingPortProxy* getVirtProxy();
+ virtual FSTranslatingPortProxy &getVirtProxy();
virtual void initMemProxies(ThreadContext *tc)
{ thread->initMemProxies(tc); }
- virtual SETranslatingPortProxy* getMemProxy()
+ virtual SETranslatingPortProxy &getMemProxy()
{ return thread->getMemProxy(); }
/** Returns this thread's status. */
diff --git a/src/cpu/o3/thread_context_impl.hh b/src/cpu/o3/thread_context_impl.hh
index 2ea39f3eb..ecc40bd14 100755
--- a/src/cpu/o3/thread_context_impl.hh
+++ b/src/cpu/o3/thread_context_impl.hh
@@ -50,7 +50,7 @@
#include "debug/O3CPU.hh"
template <class Impl>
-FSTranslatingPortProxy*
+FSTranslatingPortProxy&
O3ThreadContext<Impl>::getVirtProxy()
{
return thread->getVirtProxy();
diff --git a/src/cpu/ozone/cpu.hh b/src/cpu/ozone/cpu.hh
index ff43ad6cb..d2b90bff3 100644
--- a/src/cpu/ozone/cpu.hh
+++ b/src/cpu/ozone/cpu.hh
@@ -114,12 +114,12 @@ class OzoneCPU : public BaseCPU
Process *getProcessPtr() { return thread->getProcessPtr(); }
- PortProxy* getPhysProxy() { return thread->getPhysProxy(); }
+ PortProxy &getPhysProxy() { return thread->getPhysProxy(); }
- FSTranslatingPortProxy* getVirtProxy()
+ FSTranslatingPortProxy &getVirtProxy()
{ return thread->getVirtProxy(); }
- SETranslatingPortProxy* getMemProxy() { return thread->getMemProxy(); }
+ SETranslatingPortProxy &getMemProxy() { return thread->getMemProxy(); }
Status status() const { return thread->status(); }
diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh
index b6dc8f047..d12ee9a06 100644
--- a/src/cpu/simple_thread.hh
+++ b/src/cpu/simple_thread.hh
@@ -206,14 +206,6 @@ class SimpleThread : public ThreadState
System *getSystemPtr() { return system; }
- PortProxy* getPhysProxy() { return physProxy; }
-
- /** Return a virtual port. This port cannot be cached locally in an object.
- * After a CPU switch it may point to the wrong memory object which could
- * mean stale data.
- */
- FSTranslatingPortProxy* getVirtProxy() { return virtProxy; }
-
Status status() const { return _status; }
void setStatus(Status newStatus) { _status = newStatus; }
diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh
index 2f2e5b02b..41941b262 100644
--- a/src/cpu/thread_context.hh
+++ b/src/cpu/thread_context.hh
@@ -143,9 +143,9 @@ class ThreadContext
virtual TheISA::Kernel::Statistics *getKernelStats() = 0;
- virtual PortProxy* getPhysProxy() = 0;
+ virtual PortProxy &getPhysProxy() = 0;
- virtual FSTranslatingPortProxy* getVirtProxy() = 0;
+ virtual FSTranslatingPortProxy &getVirtProxy() = 0;
/**
* Initialise the physical and virtual port proxies and tie them to
@@ -155,7 +155,7 @@ class ThreadContext
*/
virtual void initMemProxies(ThreadContext *tc) = 0;
- virtual SETranslatingPortProxy *getMemProxy() = 0;
+ virtual SETranslatingPortProxy &getMemProxy() = 0;
virtual Process *getProcessPtr() = 0;
@@ -319,13 +319,13 @@ class ProxyThreadContext : public ThreadContext
TheISA::Kernel::Statistics *getKernelStats()
{ return actualTC->getKernelStats(); }
- PortProxy* getPhysProxy() { return actualTC->getPhysProxy(); }
+ PortProxy &getPhysProxy() { return actualTC->getPhysProxy(); }
- FSTranslatingPortProxy* getVirtProxy() { return actualTC->getVirtProxy(); }
+ FSTranslatingPortProxy &getVirtProxy() { return actualTC->getVirtProxy(); }
void initMemProxies(ThreadContext *tc) { actualTC->initMemProxies(tc); }
- SETranslatingPortProxy* getMemProxy() { return actualTC->getMemProxy(); }
+ SETranslatingPortProxy &getMemProxy() { return actualTC->getMemProxy(); }
Process *getProcessPtr() { return actualTC->getProcessPtr(); }
diff --git a/src/cpu/thread_state.cc b/src/cpu/thread_state.cc
index 33c0d719c..3d58b4da4 100644
--- a/src/cpu/thread_state.cc
+++ b/src/cpu/thread_state.cc
@@ -106,6 +106,9 @@ ThreadState::initMemProxies(ThreadContext *tc)
// (i.e. due to restoring from a checkpoint and later switching
// in.
if (physProxy == NULL)
+ // this cannot be done in the constructor as the thread state
+ // itself is created in the base cpu constructor and the
+ // getPort is a virtual function at the moment
physProxy = new PortProxy(baseCpu->getDataPort());
if (virtProxy == NULL)
virtProxy = new FSTranslatingPortProxy(tc);
@@ -125,16 +128,12 @@ ThreadState::profileSample()
profile->sample(profileNode, profilePC);
}
-SETranslatingPortProxy *
+SETranslatingPortProxy &
ThreadState::getMemProxy()
{
- if (proxy != NULL)
- return proxy;
-
- /* Use this port proxy to for syscall emulation writes to memory. */
- proxy = new SETranslatingPortProxy(*process->system->getSystemPort(),
- process,
- SETranslatingPortProxy::NextPage);
-
- return proxy;
+ if (proxy == NULL)
+ proxy = new SETranslatingPortProxy(baseCpu->getDataPort(),
+ process,
+ SETranslatingPortProxy::NextPage);
+ return *proxy;
}
diff --git a/src/cpu/thread_state.hh b/src/cpu/thread_state.hh
index d1ce83803..153049812 100644
--- a/src/cpu/thread_state.hh
+++ b/src/cpu/thread_state.hh
@@ -49,9 +49,6 @@ namespace TheISA {
};
class Checkpoint;
-class PortProxy;
-class SETranslatingPort;
-class FSTranslatingPort;
/**
* Struct for holding general thread state that is needed across CPU
@@ -102,13 +99,13 @@ struct ThreadState {
TheISA::Kernel::Statistics *getKernelStats() { return kernelStats; }
- PortProxy* getPhysProxy() { return physProxy; }
+ PortProxy &getPhysProxy() { return *physProxy; }
- FSTranslatingPortProxy* getVirtProxy() { return virtProxy; }
+ FSTranslatingPortProxy &getVirtProxy() { return *virtProxy; }
Process *getProcessPtr() { return process; }
- SETranslatingPortProxy* getMemProxy();
+ SETranslatingPortProxy &getMemProxy();
/** Reads the number of instructions functionally executed and
* committed.
@@ -183,8 +180,8 @@ struct ThreadState {
/** A translating port proxy, outgoing only, for functional
* accesse to virtual addresses. */
- FSTranslatingPortProxy* virtProxy;
- SETranslatingPortProxy* proxy;
+ FSTranslatingPortProxy *virtProxy;
+ SETranslatingPortProxy *proxy;
public:
/*