cpu: Store the translating proxy with the same pointer in SE or FS mode.
authorGabe Black <gabeblack@google.com>
Thu, 2 May 2019 08:54:15 +0000 (01:54 -0700)
committerGabe Black <gabeblack@google.com>
Thu, 30 May 2019 14:20:03 +0000 (14:20 +0000)
Only one is active at a time, so they can share the same pointer.

Change-Id: Ie4ae1f0ffbf9448f6730f9c7d072bc85d6d423da
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18580
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
src/cpu/thread_state.cc
src/cpu/thread_state.hh

index c9fc56487346e61677e98dc8be4f061a39f0c9ca..3396c75c795dc491bd23c45401ad0ba21b303ed6 100644 (file)
@@ -49,7 +49,7 @@ ThreadState::ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
       _contextId(0), _threadId(_tid), lastActivate(0), lastSuspend(0),
       profile(NULL), profileNode(NULL), profilePC(0), quiesceEvent(NULL),
       kernelStats(NULL), process(_process), physProxy(NULL), virtProxy(NULL),
-      proxy(NULL), funcExeInst(0), storeCondFailures(0)
+      funcExeInst(0), storeCondFailures(0)
 {
 }
 
@@ -59,8 +59,6 @@ ThreadState::~ThreadState()
         delete physProxy;
     if (virtProxy != NULL)
         delete virtProxy;
-    if (proxy != NULL)
-        delete proxy;
 }
 
 void
@@ -118,8 +116,8 @@ ThreadState::initMemProxies(ThreadContext *tc)
         assert(virtProxy == NULL);
         virtProxy = new FSTranslatingPortProxy(tc);
     } else {
-        assert(proxy == NULL);
-        proxy = new SETranslatingPortProxy(baseCpu->getDataPort(),
+        assert(virtProxy == NULL);
+        virtProxy = new SETranslatingPortProxy(baseCpu->getDataPort(),
                                            process,
                                            SETranslatingPortProxy::NextPage);
     }
@@ -145,8 +143,8 @@ PortProxy &
 ThreadState::getMemProxy()
 {
     assert(!FullSystem);
-    assert(proxy != NULL);
-    return *proxy;
+    assert(virtProxy != NULL);
+    return *virtProxy;
 }
 
 void
index e00c86f55d083cb2e7e331124956ec476a991fe0..db4a3f4142281aeb880cd4b8e930eb15a5a9caa8 100644 (file)
@@ -115,9 +115,9 @@ struct ThreadState : public Serializable {
          * the se translating port proxy needs to be reinitialized since it
          * holds a pointer to the process class.
          */
-        if (proxy) {
-            delete proxy;
-            proxy = NULL;
+        if (virtProxy) {
+            delete virtProxy;
+            virtProxy = NULL;
             initMemProxies(NULL);
         }
     }
@@ -197,8 +197,7 @@ struct ThreadState : public Serializable {
 
     /** A translating port proxy, outgoing only, for functional
      * accesse to virtual addresses. */
-    FSTranslatingPortProxy *virtProxy;
-    SETranslatingPortProxy *proxy;
+    PortProxy *virtProxy;
 
   public:
     /*