summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2010-08-25 21:55:55 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2010-08-25 21:55:55 -0700
commit1bf944be6213163279e114412a7f3cc804b5846a (patch)
tree16b605b09f5a738fecafe9031a86a1bba0ab7e31 /src
parentee6a92863afa3c8cea4dda6b8f6c16e227e25349 (diff)
downloadgem5-1bf944be6213163279e114412a7f3cc804b5846a.tar.xz
cache: fix a bug in atomic multilevel snoops
Diffstat (limited to 'src')
-rw-r--r--src/mem/cache/cache_impl.hh11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh
index d471b293a..c930a886d 100644
--- a/src/mem/cache/cache_impl.hh
+++ b/src/mem/cache/cache_impl.hh
@@ -1099,6 +1099,12 @@ Cache<TagStore>::handleSnoop(PacketPtr pkt, BlkType *blk,
assert(!(pending_inval && !is_deferred));
assert(pkt->isRequest());
+ // the packet may get modified if we or a forwarded snooper
+ // responds in atomic mode, so remember a few things about the
+ // original packet up front
+ bool invalidate = pkt->isInvalidate();
+ bool needs_exclusive = pkt->needsExclusive();
+
if (forwardSnoops) {
// first propagate snoop upward to see if anyone above us wants to
// handle it. save & restore packet src since it will get
@@ -1141,10 +1147,9 @@ Cache<TagStore>::handleSnoop(PacketPtr pkt, BlkType *blk,
// and then do it later
bool respond = blk->isDirty() && pkt->needsResponse();
bool have_exclusive = blk->isWritable();
- bool invalidate = pkt->isInvalidate();
- if (pkt->isRead() && !pkt->isInvalidate()) {
- assert(!pkt->needsExclusive());
+ if (pkt->isRead() && !invalidate) {
+ assert(!needs_exclusive);
pkt->assertShared();
int bits_to_clear = BlkWritable;
const bool haveOwnershipState = true; // for now