mem: Fix guest corruption when caches handle uncacheable accesses
[gem5.git] / src / mem / packet.hh
index cdcefcadbd4518f5e0921a4ab82ed9a80b0e8119..fbcf185ccb7e35230fac333b155ae58e72151047 100644 (file)
@@ -120,7 +120,6 @@ class MemCmd
         // @TODO these should be classified as responses rather than
         // requests; coding them as requests initially for backwards
         // compatibility
-        NetworkNackError,  // nacked at network layer (not by protocol)
         InvalidDestError,  // packet dest field invalid
         BadAddressError,   // memory address invalid
         FunctionalReadError, // unable to fulfill functional read
@@ -465,13 +464,6 @@ class Packet : public Printable
     // Network error conditions... encapsulate them as methods since
     // their encoding keeps changing (from result field to command
     // field, etc.)
-    void
-    setNacked()
-    {
-        assert(isResponse());
-        cmd = MemCmd::NetworkNackError;
-    }
-
     void
     setBadAddress()
     {
@@ -479,7 +471,6 @@ class Packet : public Printable
         cmd = MemCmd::BadAddressError;
     }
 
-    bool wasNacked() const     { return cmd == MemCmd::NetworkNackError; }
     bool hadBadAddress() const { return cmd == MemCmd::BadAddressError; }
     void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; }
 
@@ -500,6 +491,15 @@ class Packet : public Printable
     void clearDest() { dest = InvalidPortID; }
 
     Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; }
+    /**
+     * Update the address of this packet mid-transaction. This is used
+     * by the address mapper to change an already set address to a new
+     * one based on the system configuration. It is intended to remap
+     * an existing address, so it asserts that the current address is
+     * valid.
+     */
+    void setAddr(Addr _addr) { assert(flags.isSet(VALID_ADDR)); addr = _addr; }
+
     unsigned getSize() const  { assert(flags.isSet(VALID_SIZE)); return size; }
     Addr getOffset(int blkSize) const { return getAddr() & (Addr)(blkSize - 1); }
 
@@ -669,20 +669,6 @@ class Packet : public Printable
         }
     }
 
-    /**
-     * Take a request packet that has been returned as NACKED and
-     * modify it so that it can be sent out again. Only packets that
-     * need a response can be NACKED, so verify that that is true.
-     */
-    void
-    reinitNacked()
-    {
-        assert(wasNacked());
-        cmd = origCmd;
-        assert(needsResponse());
-        clearDest();
-    }
-
     void
     setSize(unsigned size)
     {