From a14013af3a9e04d68985aea7bcff6c1e70bdbb82 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Fri, 30 Mar 2012 09:38:35 -0400 Subject: CPU: Unify initMemProxies across CPUs and simulation modes This patch unifies where initMemProxies is called, in the init() method of each BaseCPU subclass, before TheISA::initCPU is called. Moreover, it also ensures that initMemProxies is called in both full-system and syscall-emulation mode, thus unifying also across the modes. An additional check is added in the ThreadState to ensure that initMemProxies is only called once. --- src/cpu/o3/cpu.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/cpu/o3') diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index f68b500ea..bfc9438d3 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -639,10 +639,13 @@ FullO3CPU::init() { BaseCPU::init(); - // Set inSyscall so that the CPU doesn't squash when initially - // setting up registers. - for (ThreadID tid = 0; tid < numThreads; ++tid) + for (ThreadID tid = 0; tid < numThreads; ++tid) { + // Set inSyscall so that the CPU doesn't squash when initially + // setting up registers. thread[tid]->inSyscall = true; + // Initialise the ThreadContext's memory proxies + thread[tid]->initMemProxies(thread[tid]->getTC()); + } // this CPU could still be unconnected if we are restoring from a // checkpoint and this CPU is to be switched in, thus we can only @@ -655,8 +658,6 @@ FullO3CPU::init() for (ThreadID tid = 0; tid < numThreads; tid++) { ThreadContext *src_tc = threadContexts[tid]; TheISA::initCPU(src_tc, src_tc->contextId()); - // Initialise the ThreadContext's memory proxies - thread[tid]->initMemProxies(thread[tid]->getTC()); } } -- cgit v1.2.3