mem-cache: Add match functions to QueueEntry
[gem5.git] / src / mem / abstract_mem.hh
index 29c8c3f3e1efa6c56cb7d278c0e2de74613e0bf1..cf9ca74396ae14c7d6a3d40f00005c843f6cb8af 100644 (file)
@@ -49,6 +49,7 @@
 #ifndef __MEM_ABSTRACT_MEMORY_HH__
 #define __MEM_ABSTRACT_MEMORY_HH__
 
+#include "mem/backdoor.hh"
 #include "mem/mem_object.hh"
 #include "params/AbstractMemory.hh"
 #include "sim/stats.hh"
@@ -79,13 +80,13 @@ class LockedAddr {
     static Addr mask(Addr paddr) { return (paddr & ~Addr_Mask); }
 
     // check for matching execution context
-    bool matchesContext(RequestPtr req) const
+    bool matchesContext(const RequestPtr &req) const
     {
         return (contextId == req->contextId());
     }
 
-    LockedAddr(RequestPtr req) : addr(mask(req->getPaddr())),
-                               contextId(req->contextId())
+    LockedAddr(const RequestPtr &req) : addr(mask(req->getPaddr())),
+                                        contextId(req->contextId())
     {}
 
     // constructor for unserialization use
@@ -110,6 +111,9 @@ class AbstractMemory : public MemObject
     // Pointer to host memory used to implement this memory
     uint8_t* pmemAddr;
 
+    // Backdoor to access this memory.
+    MemBackdoor backdoor;
+
     // Enable specific memories to be reported to the configuration table
     const bool confTableReported;
 
@@ -140,7 +144,7 @@ class AbstractMemory : public MemObject
     // this method must be called on *all* stores since even
     // non-conditional stores must clear any matching lock addresses.
     bool writeOK(PacketPtr pkt) {
-        RequestPtr req = pkt->req;
+        const RequestPtr &req = pkt->req;
         if (lockedAddrList.empty()) {
             // no locked addrs: nothing to check, store_conditional fails
             bool isLLSC = pkt->isLLSC();