mem-cache: Fix setting prefetch bit
[gem5.git] / src / mem / abstract_mem.hh
index b1d54fdebe4adb39a69f6f92000ab25d645ed546..1a3c01930eb3d891528d7aa2fd245f4e2c8a8dce 100644 (file)
@@ -159,7 +159,7 @@ class AbstractMemory : public ClockedObject
     }
 
     /** Pointer to the System object.
-     * This is used for getting the number of masters in the system which is
+     * This is used for getting the number of requestors in the system which is
      * needed when registering stats
      */
     System *_system;
@@ -206,16 +206,18 @@ class AbstractMemory : public ClockedObject
 
     typedef AbstractMemoryParams Params;
 
-    AbstractMemory(const Paramsp);
+    AbstractMemory(const Params &p);
     virtual ~AbstractMemory() {}
 
+    void initState() override;
+
     /**
      * See if this is a null memory that should never store data and
      * always return zero.
      *
      * @return true if null
      */
-    bool isNull() const { return params()->null; }
+    bool isNull() const { return params().null; }
 
     /**
      * Set the host memory backing store to be used by this memory
@@ -225,16 +227,31 @@ class AbstractMemory : public ClockedObject
      */
     void setBackingStore(uint8_t* pmem_addr);
 
+    void
+    getBackdoor(MemBackdoorPtr &bd_ptr)
+    {
+        if (lockedAddrList.empty() && backdoor.ptr())
+            bd_ptr = &backdoor;
+    }
+
     /**
      * Get the list of locked addresses to allow checkpointing.
      */
-    const std::list<LockedAddr>& getLockedAddrList() const
-    { return lockedAddrList; }
+    const std::list<LockedAddr> &
+    getLockedAddrList() const
+    {
+        return lockedAddrList;
+    }
 
     /**
      * Add a locked address to allow for checkpointing.
      */
-    void addLockedAddr(LockedAddr addr) { lockedAddrList.push_back(addr); }
+    void
+    addLockedAddr(LockedAddr addr)
+    {
+        backdoor.invalidate();
+        lockedAddrList.push_back(addr);
+    }
 
     /** read the system pointer
      * Implemented for completeness with the setter
@@ -249,10 +266,10 @@ class AbstractMemory : public ClockedObject
      */
     void system(System *sys) { _system = sys; }
 
-    const Params *
+    const Params &
     params() const
     {
-        return dynamic_cast<const Params *>(_params);
+        return dynamic_cast<const Params &>(_params);
     }
 
     /**