cpu,sim: Don't tie ThreadContext contextId to the CPU ID.

The contextId is generally treated as (and should be) an opaque index
into the System objects threadContext array. When forcing it to
particular values, that introduces gaps in the threadContext array which
trips up other code which is expecting the array to have only valid
entries.

Change-Id: I4997e989b436a3008f65f348722dfb843b2f110a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57089
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
This commit is contained in:
Gabe Black
2022-02-24 02:15:52 -08:00
parent e7f1acc0dc
commit 412ae3f8df
3 changed files with 11 additions and 30 deletions

View File

@@ -431,15 +431,10 @@ BaseCPU::registerThreadContexts()
"per thread (%i)\n",
name(), interrupts.size(), numThreads);
ThreadID size = threadContexts.size();
for (ThreadID tid = 0; tid < size; ++tid) {
for (ThreadID tid = 0; tid < threadContexts.size(); ++tid) {
ThreadContext *tc = threadContexts[tid];
if (system->multiThread) {
system->registerThreadContext(tc);
} else {
system->registerThreadContext(tc, _cpuId);
}
system->registerThreadContext(tc);
if (!FullSystem)
tc->getProcessPtr()->assignThreadContext(tc->contextId());