sim: Move System specific code out of MemPools.
Move that code into SEWorkload which already has to know about System objects. The MemPool(s) object(s) now only have to worry about AddrRanges and AddrRangeLists and don't have to know or care where they came from. Change-Id: Ic23aeb959d6f666b655d010c8572c41c60b5aa57 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50350 Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Gabe Black <gabe.black@gmail.com> Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
This commit is contained in:
@@ -33,11 +33,8 @@
|
||||
|
||||
#include "sim/mem_pool.hh"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#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());
|
||||
}
|
||||
|
||||
@@ -36,14 +36,13 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user