Minor fix plus new assertion to catch similar bugs.
authorSteve Reinhardt <stever@eecs.umich.edu>
Sat, 23 Jun 2007 20:24:33 +0000 (13:24 -0700)
committerSteve Reinhardt <stever@eecs.umich.edu>
Sat, 23 Jun 2007 20:24:33 +0000 (13:24 -0700)
src/cpu/memtest/memtest.cc:
    Need to set packet source field so that response from cache
    doesn't run into assertion failure when copying source to dest.
src/mem/packet.hh:
    Copy source field when copying packets.
    Assert that source is valid before copying it to dest
    when turning packets around.

--HG--
extra : convert_revision : 09e3cfda424aa89fe170e21e955b295746832bf8

src/cpu/memtest/memtest.cc
src/mem/packet.hh

index 6e8c5d0bf0d1655b63ac935b92046fd7fb132e96..019b4328c5810ab612446eed24a94dc7fc4cb173 100644 (file)
@@ -344,6 +344,7 @@ MemTest::tick()
                 req->getPaddr(), blockAddr(req->getPaddr()), *result);
 
         PacketPtr pkt = new Packet(req, MemCmd::ReadReq, Packet::Broadcast);
+        pkt->setSrc(0);
         pkt->dataDynamicArray(new uint8_t[req->getSize()]);
         MemTestSenderState *state = new MemTestSenderState(result);
         pkt->senderState = state;
@@ -373,6 +374,7 @@ MemTest::tick()
                 req->getPaddr(), blockAddr(req->getPaddr()), data & 0xff);
 
         PacketPtr pkt = new Packet(req, MemCmd::WriteReq, Packet::Broadcast);
+        pkt->setSrc(0);
         uint8_t *pkt_data = new uint8_t[req->getSize()];
         pkt->dataDynamicArray(pkt_data);
         memcpy(pkt_data, &data, req->getSize());
index 80da045ef3550bb06a91a7cbfdfcc7d6f0bba45e..fc1c283ed6872c4e81154152bc11b9148b77b8a5 100644 (file)
@@ -384,7 +384,7 @@ class Packet : public FastAlloc
     Packet(Packet *origPkt)
         :  data(NULL), staticData(false), dynamicData(false), arrayData(false),
            addr(origPkt->addr), size(origPkt->size),
-           dest(origPkt->dest),
+           src(origPkt->src), dest(origPkt->dest),
            addrSizeValid(origPkt->addrSizeValid), srcValid(origPkt->srcValid),
            snoopFlags(origPkt->snoopFlags),
            time(curTick),
@@ -440,7 +440,7 @@ class Packet : public FastAlloc
      */
     void convertAtomicToTimingResponse()
     {
-        dest = src;
+        dest = getSrc();
         srcValid = false;
     }