From 73e14fb3679e1063012b67a33c69473713a12304 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 25 Mar 2019 18:04:50 -0700 Subject: mem: Maintain a back door into the AbstractMem's backing store. The backing store pointer is added to the back door when it's set, assuming that the range isn't interleaved. If it is interleaved, then there isn't a way to get a flat pointer to the backing store. Depending on how the backing store is set up, it may be possible to return a larger backdoor which applies to all interleaved memories at the same time and to avoid problems with interleaving. I'm leaving this as a todo. Change-Id: I0e531c22835ec10954ab39f761b3d87666b59220 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17668 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/mem/abstract_mem.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/mem/abstract_mem.cc') diff --git a/src/mem/abstract_mem.cc b/src/mem/abstract_mem.cc index 581fc14cc..f0d626940 100644 --- a/src/mem/abstract_mem.cc +++ b/src/mem/abstract_mem.cc @@ -58,6 +58,9 @@ using namespace std; AbstractMemory::AbstractMemory(const Params *p) : MemObject(p), range(params()->range), pmemAddr(NULL), + backdoor(params()->range, nullptr, + (MemBackdoor::Flags)(MemBackdoor::Readable | + MemBackdoor::Writeable)), confTableReported(p->conf_table_reported), inAddrMap(p->in_addr_map), kvmMap(p->kvm_map), _system(NULL) { @@ -75,6 +78,13 @@ AbstractMemory::init() void AbstractMemory::setBackingStore(uint8_t* pmem_addr) { + // If there was an existing backdoor, let everybody know it's going away. + if (backdoor.ptr()) + backdoor.invalidate(); + + // The back door can't handle interleaved memory. + backdoor.ptr(range.interleaved() ? nullptr : pmem_addr); + pmemAddr = pmem_addr; } -- cgit v1.2.3