summaryrefslogtreecommitdiff
path: root/sim/system.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sim/system.cc')
-rw-r--r--sim/system.cc14
1 files changed, 6 insertions, 8 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;
}