diff options
Diffstat (limited to 'sim/system.cc')
-rw-r--r-- | sim/system.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sim/system.cc b/sim/system.cc index 0e0b83332..76c895a88 100644 --- a/sim/system.cc +++ b/sim/system.cc @@ -56,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; } |