#include "cpu/exec_context.hh"
#include "targetarch/vtophys.hh"
+#include "sim/param.hh"
#include "sim/system.hh"
using namespace std;
int System::numSystemsRunning = 0;
System::System(const std::string _name,
+ const uint64_t _init_param,
MemoryController *_memCtrl,
PhysicalMemory *_physmem)
: SimObject(_name),
+ init_param(_init_param),
memCtrl(_memCtrl),
physmem(_physmem)
{
}
-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;
}