diff options
-rw-r--r-- | src/mem/cache/base_cache.cc | 10 | ||||
-rw-r--r-- | src/mem/cache/cache_impl.hh | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/mem/cache/base_cache.cc b/src/mem/cache/base_cache.cc index 938bd8786..30c996d4f 100644 --- a/src/mem/cache/base_cache.cc +++ b/src/mem/cache/base_cache.cc @@ -36,6 +36,7 @@ #include "mem/cache/base_cache.hh" #include "cpu/smt.hh" #include "cpu/base.hh" +#include "mem/cache/miss/mshr.hh" using namespace std; @@ -179,6 +180,10 @@ BaseCache::CachePort::recvRetry() } pkt = cache->getPacket(); MSHR* mshr = (MSHR*)pkt->senderState; + //Copy the packet, it may be modified/destroyed elsewhere + Packet * copyPkt = new Packet(*pkt); + copyPkt->dataStatic<uint8_t>(pkt->getPtr<uint8_t>()); + mshr->pkt = copyPkt; bool success = sendTiming(pkt); DPRINTF(Cache, "Address %x was %s in sending the timing request\n", pkt->getAddr(), success ? "succesful" : "unsuccesful"); @@ -288,6 +293,11 @@ BaseCache::CacheEvent::process() pkt = cachePort->cache->getPacket(); MSHR* mshr = (MSHR*) pkt->senderState; + //Copy the packet, it may be modified/destroyed elsewhere + Packet * copyPkt = new Packet(*pkt); + copyPkt->dataStatic<uint8_t>(pkt->getPtr<uint8_t>()); + mshr->pkt = copyPkt; + bool success = cachePort->sendTiming(pkt); DPRINTF(Cache, "Address %x was %s in sending the timing request\n", pkt->getAddr(), success ? "succesful" : "unsuccesful"); diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index 00f93328e..fc559195d 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -273,9 +273,9 @@ void Cache<TagStore,Buffering,Coherence>::sendResult(PacketPtr &pkt, MSHR* mshr, bool success) { if (success && !(pkt->flags & NACKED_LINE)) { - missQueue->markInService(pkt, mshr); + missQueue->markInService(mshr->pkt, mshr); //Temp Hack for UPGRADES - if (pkt->cmd == Packet::UpgradeReq) { + if (mshr->pkt->cmd == Packet::UpgradeReq) { pkt->flags &= ~CACHE_LINE_FILL; BlkType *blk = tags->findBlock(pkt); CacheBlk::State old_state = (blk) ? blk->status : 0; @@ -304,6 +304,8 @@ Cache<TagStore,Buffering,Coherence>::handleResponse(Packet * &pkt) { BlkType *blk = NULL; if (pkt->senderState) { + //Delete temp copy in MSHR, restore it. + delete ((MSHR*)pkt->senderState)->pkt; ((MSHR*)pkt->senderState)->pkt = pkt; if (pkt->result == Packet::Nacked) { //pkt->reinitFromRequest(); |