Get rid of the immediate and displacement components of the EmulEnv struct and use...
[gem5.git] / src / sim / system.cc
index b3ba1b8f147069e94b55fe1ef7a22a1996713197..2d0eaaf5bd93993770c5e64c9a4fcb5e74e5fd06 100644 (file)
@@ -32,6 +32,8 @@
  */
 
 #include "arch/isa_traits.hh"
+#include "arch/remote_gdb.hh"
+#include "arch/utility.hh"
 #include "base/loader/object_file.hh"
 #include "base/loader/symtab.hh"
 #include "base/trace.hh"
@@ -43,7 +45,6 @@
 #include "sim/system.hh"
 #if FULL_SYSTEM
 #include "arch/vtophys.hh"
-#include "arch/remote_gdb.hh"
 #include "kern/kernel_stats.hh"
 #endif
 
@@ -141,13 +142,8 @@ System::~System()
 #endif // FULL_SYSTEM}
 }
 
-#if FULL_SYSTEM
-
-
 int rgdb_wait = -1;
-
-#endif // FULL_SYSTEM
-
+int rgdb_enable = true;
 
 void
 System::setMemoryMode(MemoryMode mode)
@@ -156,6 +152,13 @@ System::setMemoryMode(MemoryMode mode)
     memoryMode = mode;
 }
 
+bool System::breakpoint()
+{
+    if (remoteGDB.size())
+        return remoteGDB[0]->breakpoint();
+    return false;
+}
+
 int
 System::registerThreadContext(ThreadContext *tc, int id)
 {
@@ -175,24 +178,24 @@ System::registerThreadContext(ThreadContext *tc, int id)
     threadContexts[id] = tc;
     numcpus++;
 
-#if FULL_SYSTEM
-    RemoteGDB *rgdb = new RemoteGDB(this, tc);
-    GDBListener *gdbl = new GDBListener(rgdb, 7000 + id);
-    gdbl->listen();
-    /**
-     * Uncommenting this line waits for a remote debugger to connect
-     * to the simulator before continuing.
-     */
-    if (rgdb_wait != -1 && rgdb_wait == id)
-        gdbl->accept();
+    if (rgdb_enable) {
+        RemoteGDB *rgdb = new RemoteGDB(this, tc);
+        GDBListener *gdbl = new GDBListener(rgdb, 7000 + id);
+        gdbl->listen();
+        /**
+         * Uncommenting this line waits for a remote debugger to
+         * connect to the simulator before continuing.
+         */
+        if (rgdb_wait != -1 && rgdb_wait == id)
+            gdbl->accept();
+
+        if (remoteGDB.size() <= id) {
+            remoteGDB.resize(id + 1);
+        }
 
-    if (remoteGDB.size() <= id) {
-        remoteGDB.resize(id + 1);
+        remoteGDB[id] = rgdb;
     }
 
-    remoteGDB[id] = rgdb;
-#endif // FULL_SYSTEM
-
     return id;
 }
 
@@ -201,7 +204,7 @@ System::startup()
 {
     int i;
     for (i = 0; i < threadContexts.size(); i++)
-        threadContexts[i]->activate(0);
+        TheISA::startupCPU(threadContexts[i], i);
 }
 
 void
@@ -213,9 +216,8 @@ System::replaceThreadContext(ThreadContext *tc, int id)
     }
 
     threadContexts[id] = tc;
-#if FULL_SYSTEM
-    remoteGDB[id]->replaceThreadContext(tc);
-#endif // FULL_SYSTEM
+    if (id < remoteGDB.size())
+        remoteGDB[id]->replaceThreadContext(tc);
 }
 
 #if !FULL_SYSTEM