summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/system.cc14
-rw-r--r--sim/system.hh4
2 files changed, 8 insertions, 10 deletions
diff --git a/sim/system.cc b/sim/system.cc
index 74216176a..999782e48 100644
--- a/sim/system.cc
+++ b/sim/system.cc
@@ -114,11 +114,6 @@ System::System(const std::string _name,
#ifdef FULL_SYSTEM
Addr addr = 0;
- for(int i = 0; i < 12/*MAX_CPUS*/; i++)
- xc_array[i] = (ExecContext *) 0;
-
- num_cpus = 0;
-
if (kernelSymtab->findAddress("enable_async_printf", addr)) {
Addr paddr = vtophys(physmem, addr);
uint8_t *enable_async_printf =
@@ -204,10 +199,13 @@ System::initBootContext(ExecContext *xc)
void
System::registerExecContext(ExecContext *xc)
{
- if (num_cpus == 12/*MAX_CPUS*/)
+ if (xc->cpu_id >= 12/*MAX_CPUS*/)
panic("Too many CPU's\n");
- xc_array[xc->cpu_id] = xc;
- num_cpus++;
+
+ if (xc->cpu_id >= xcvec.size())
+ xcvec.resize(xc->cpu_id + 1);
+
+ xcvec[xc->cpu_id] = xc;
}
diff --git a/sim/system.hh b/sim/system.hh
index 830e78f4a..3ab514bfa 100644
--- a/sim/system.hh
+++ b/sim/system.hh
@@ -30,6 +30,7 @@
#define __SYSTEM_HH__
#include <string>
+#include <vector>
#include "sim/sim_object.hh"
#include "cpu/pc_event.hh"
@@ -72,8 +73,7 @@ class System : public SimObject
PCEventQueue pcEventQueue;
- ExecContext *xc_array[12/*MAX_CPUS*/];
- int num_cpus;
+ std::vector<ExecContext *> xcvec;
RemoteGDB *remoteGDB;
GDBListener *gdbListen;