changeset 6f10e35b57d1 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=6f10e35b57d1
description:
        cpu: Only activate thread 0 in Minor if the CPU is active

        Minor currently activates thread 0 in startup() to work around an
        issue where activateContext() is called from LiveProcess before the
        process entry point is known. When activateContext() is called, Minor
        creates a branch instruction to the process's entry point. The first
        time it is called, the branch points to an undefined location (0). The
        call in startup() updates the branch to point to the actual entry
        point.

        When instantiating a switched out Minor CPU, it still tries to
        activate thread 0. This is clearly incorrect since a switched out CPU
        can't have any active threads. This changeset adds a check to ensure
        that the thread is active before reactivating it.

diffstat:

 src/cpu/minor/cpu.cc |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r 369861e3d5af -r 6f10e35b57d1 src/cpu/minor/cpu.cc
--- a/src/cpu/minor/cpu.cc      Thu Jul 30 10:15:50 2015 +0100
+++ b/src/cpu/minor/cpu.cc      Thu Jul 30 10:15:50 2015 +0100
@@ -189,8 +189,13 @@
     for (auto i = threads.begin(); i != threads.end(); i ++)
         (*i)->startup();
 
-    /* CPU state setup, activate initial context */
-    activateContext(0);
+    /* Workaround cases in SE mode where a thread is activated with an
+     * incorrect PC that is updated after the call to activate. This
+     * causes problems for Minor since it instantiates a virtual
+     * branch instruction when activateContext() is called which ends
+     * up pointing to an illegal address.  */
+    if (threads[0]->status() == ThreadContext::Active)
+        activateContext(0);
 }
 
 DrainState
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to