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/simple/atomic.cc | 7 ++++--- src/cpu/simple/timing.cc | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/cpu/simple') diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc index cc2c3576f..e5b3bd67d 100644 --- a/src/cpu/simple/atomic.cc +++ b/src/cpu/simple/atomic.cc @@ -80,6 +80,10 @@ void AtomicSimpleCPU::init() { BaseCPU::init(); + + // Initialise the ThreadContext's memory proxies + tcBase()->initMemProxies(tcBase()); + if (FullSystem) { ThreadID size = threadContexts.size(); for (ThreadID i = 0; i < size; ++i) { @@ -89,9 +93,6 @@ AtomicSimpleCPU::init() } } - // Initialise the ThreadContext's memory proxies - tcBase()->initMemProxies(tcBase()); - if (hasPhysMemPort) { AddrRangeList pmAddrList = physmemPort.getPeer()->getAddrRanges(); physMemAddr = *pmAddrList.begin(); diff --git a/src/cpu/simple/timing.cc b/src/cpu/simple/timing.cc index 3d1fe081d..f661756da 100644 --- a/src/cpu/simple/timing.cc +++ b/src/cpu/simple/timing.cc @@ -64,6 +64,10 @@ void TimingSimpleCPU::init() { BaseCPU::init(); + + // Initialise the ThreadContext's memory proxies + tcBase()->initMemProxies(tcBase()); + if (FullSystem) { for (int i = 0; i < threadContexts.size(); ++i) { ThreadContext *tc = threadContexts[i]; @@ -71,9 +75,6 @@ TimingSimpleCPU::init() TheISA::initCPU(tc, _cpuId); } } - - // Initialise the ThreadContext's memory proxies - tcBase()->initMemProxies(tcBase()); } void -- cgit v1.2.3