Merge stever@zizzer:/bk/m5 into isabel.reinhardt.house:/z/stever/bk/m5
[gem5.git] / sim / system.cc
index e1e293c90a76da74b095b0be0c19eb4df5436e05..af4a4c151fdb2884a45e7cfade1d845c9e584c09 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "cpu/exec_context.hh"
 #include "targetarch/vtophys.hh"
+#include "sim/param.hh"
 #include "sim/system.hh"
 
 using namespace std;
@@ -37,7 +38,7 @@ vector<System *> System::systemList;
 int System::numSystemsRunning = 0;
 
 System::System(const std::string _name,
-               const int _init_param,
+               const uint64_t _init_param,
                MemoryController *_memCtrl,
                PhysicalMemory *_physmem)
     : SimObject(_name),
@@ -55,16 +56,24 @@ System::~System()
 }
 
 
-void
+int
 System::registerExecContext(ExecContext *xc)
 {
-    if (xc->cpu_id >= 12/*MAX_CPUS*/)
-        panic("Too many CPU's\n");
+    int myIndex = execContexts.size();
+    execContexts.push_back(xc);
+    return myIndex;
+}
+
 
-    if (xc->cpu_id >= xcvec.size())
-        xcvec.resize(xc->cpu_id + 1);
+void
+System::replaceExecContext(int xcIndex, ExecContext *xc)
+{
+    if (xcIndex >= execContexts.size()) {
+        panic("replaceExecContext: bad xcIndex, %d >= %d\n",
+              xcIndex, execContexts.size());
+    }
 
-    xcvec[xc->cpu_id] = xc;
+    execContexts[xcIndex] = xc;
 }