diff --git a/src/sim/mem_pool.cc b/src/sim/mem_pool.cc index e489110c9b..bd56df8241 100644 --- a/src/sim/mem_pool.cc +++ b/src/sim/mem_pool.cc @@ -33,11 +33,8 @@ #include "sim/mem_pool.hh" -#include - #include "base/addr_range.hh" #include "base/logging.hh" -#include "sim/system.hh" namespace gem5 { @@ -147,14 +144,8 @@ MemPool::unserialize(CheckpointIn &cp) } void -MemPools::populate(const System &sys) +MemPools::populate(const AddrRangeList &memories) { - AddrRangeList memories = sys.getPhysMem().getConfAddrRanges(); - const auto &m5op_range = sys.m5opRange(); - - if (m5op_range.valid()) - memories -= m5op_range; - for (const auto &mem : memories) pools.emplace_back(pageShift, mem.start(), mem.end()); } diff --git a/src/sim/mem_pool.hh b/src/sim/mem_pool.hh index 613d763923..a2a00d54bb 100644 --- a/src/sim/mem_pool.hh +++ b/src/sim/mem_pool.hh @@ -36,14 +36,13 @@ #include +#include "base/addr_range.hh" #include "base/types.hh" #include "sim/serialize.hh" namespace gem5 { -class System; - /** Class for handling allocation of physical pages in SE mode. */ class MemPool : public Serializable { @@ -96,7 +95,7 @@ class MemPools : public Serializable public: MemPools(Addr page_shift) : pageShift(page_shift) {} - void populate(const System &sys); + void populate(const AddrRangeList &memories); /// Allocate npages contiguous unused physical pages. /// @return Starting address of first page diff --git a/src/sim/se_workload.cc b/src/sim/se_workload.cc index 47bdb1cc09..d3c857048b 100644 --- a/src/sim/se_workload.cc +++ b/src/sim/se_workload.cc @@ -43,7 +43,14 @@ void SEWorkload::setSystem(System *sys) { Workload::setSystem(sys); - memPools.populate(*sys); + + AddrRangeList memories = sys->getPhysMem().getConfAddrRanges(); + const auto &m5op_range = sys->m5opRange(); + + if (m5op_range.valid()) + memories -= m5op_range; + + memPools.populate(memories); } void