summaryrefslogtreecommitdiff
path: root/src/mem/abstract_mem.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/abstract_mem.hh')
-rw-r--r--src/mem/abstract_mem.hh13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mem/abstract_mem.hh b/src/mem/abstract_mem.hh
index d92e7070c..14694f9d5 100644
--- a/src/mem/abstract_mem.hh
+++ b/src/mem/abstract_mem.hh
@@ -271,6 +271,19 @@ class AbstractMemory : public ClockedObject
AddrRange getAddrRange() const;
/**
+ * Transform a gem5 address space address into its physical counterpart
+ * in the host address space.
+ *
+ * @param addr Address in gem5's address space.
+ * @return Pointer to the corresponding memory address of the host.
+ */
+ inline uint8_t *
+ toHostAddr(Addr addr) const
+ {
+ return pmemAddr + addr - range.start();
+ }
+
+ /**
* Get the memory size.
*
* @return the size of the memory