sim: Exclude the m5opRange from the system mempools by construction.

Don't look for the m5opRange in the memory pools when allocating memory
so that it can be skipped, just exclude it from the memory pools
entirely when they are set up. This removes a dependence between the
memory pools and the system class.

Change-Id: I0d88c1bc2f889f32b234073cff8988319fb36ea5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50338
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-09-11 05:20:53 -07:00
parent e7bf4db7bd
commit 6d9cbb9d6e
2 changed files with 9 additions and 11 deletions

View File

@@ -103,17 +103,9 @@ MemPool::allocate(Addr npages)
{
Addr return_addr = freePageAddr();
freePageNum += npages;
Addr next_return_addr = freePageAddr();
if (sys->m5opRange().valid() &&
next_return_addr >= sys->m5opRange().start()) {
warn("Reached m5ops MMIO region\n");
return_addr = sys->m5opRange().end();
freePageNum = (return_addr >> sys->getPageShift()) + npages;
}
fatal_if((freePages() <= 0), "Out of memory, "
"please increase size of physical memory.");
fatal_if(freePages() <= 0,
"Out of memory, please increase size of physical memory.");
return return_addr;
}

View File

@@ -233,7 +233,13 @@ System::System(const Params &p)
assert(!memories.empty());
for (const auto &mem : memories) {
assert(!mem.interleaved());
memPools.emplace_back(this, mem.start(), mem.end());
if (_m5opRange.valid()) {
// Make sure the m5op range is not included.
for (const auto &range: mem.exclude({_m5opRange}))
memPools.emplace_back(this, range.start(), range.end());
} else {
memPools.emplace_back(this, mem.start(), mem.end());
}
}
/*