From: Gabe Black Date: Sat, 7 Mar 2020 23:51:50 +0000 (-0800) Subject: mem: Remove a check that the memory size is a multiple of the page size. X-Git-Tag: v20.0.0.0~274 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=87cf5a99ee686dc947cf21d08b2655d3b70437ee;p=gem5.git mem: Remove a check that the memory size is a multiple of the page size. There are a few problems with this check. 1. Many ISAs support multiple page sizes. 2. Memories (particularly small ROMs) may not actually be in multiples of the page size. 3. In a heterogenous environment, there won't be a single page size even if each ISA picks a canonical page size. 4. Other than catching some egregious configuration mistakes, there's nothing functionally wrong/different about a memory that isn't evenly coverable in pages, especially in systems or configurations that don't even use paging. Change-Id: I3cd241657318d2e3fd5a1226cb54fdebbf172788 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26423 Maintainer: Gabe Black Maintainer: Jason Lowe-Power Reviewed-by: Jason Lowe-Power Tested-by: Gem5 Cloud Project GCB service account <345032938727@cloudbuild.gserviceaccount.com> --- diff --git a/src/mem/abstract_mem.cc b/src/mem/abstract_mem.cc index 927fd0245..b5412badf 100644 --- a/src/mem/abstract_mem.cc +++ b/src/mem/abstract_mem.cc @@ -61,15 +61,9 @@ AbstractMemory::AbstractMemory(const Params *p) : kvmMap(p->kvm_map), _system(NULL), stats(*this) { -} - -void -AbstractMemory::init() -{ - assert(system()); - - if (size() % _system->getPageBytes() != 0) - panic("Memory Size not divisible by page size\n"); + panic_if(!range.valid() || !range.size(), + "Memory range %s must be valid with non-zero size.", + range.to_string()); } void diff --git a/src/mem/abstract_mem.hh b/src/mem/abstract_mem.hh index c8aef702d..b1d54fdeb 100644 --- a/src/mem/abstract_mem.hh +++ b/src/mem/abstract_mem.hh @@ -209,11 +209,6 @@ class AbstractMemory : public ClockedObject AbstractMemory(const Params* p); virtual ~AbstractMemory() {} - /** - * Initialise this memory. - */ - void init() override; - /** * See if this is a null memory that should never store data and * always return zero.