summaryrefslogtreecommitdiff
path: root/src/mem/addr_mapper.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2013-02-19 05:56:05 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2013-02-19 05:56:05 -0500
commit0622f30961fc32b967bb1ef784afc5a205b16f6e (patch)
treeb6b57cf049b7fc7e49cc65a735af7508862b9c24 /src/mem/addr_mapper.cc
parentf69d431ede9b815ea4b63a2d20237ed3e79df169 (diff)
downloadgem5-0622f30961fc32b967bb1ef784afc5a205b16f6e.tar.xz
mem: Add predecessor to SenderState base class
This patch adds a predecessor field to the SenderState base class to make the process of linking them up more uniform, and enable a traversal of the stack without knowing the specific type of the subclasses. There are a number of simplifications done as part of changing the SenderState, particularly in the RubyTest.
Diffstat (limited to 'src/mem/addr_mapper.cc')
-rw-r--r--src/mem/addr_mapper.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mem/addr_mapper.cc b/src/mem/addr_mapper.cc
index 4ee834408..4aff9dcd8 100644
--- a/src/mem/addr_mapper.cc
+++ b/src/mem/addr_mapper.cc
@@ -123,10 +123,9 @@ AddrMapper::recvTimingReq(PacketPtr pkt)
Addr orig_addr = pkt->getAddr();
bool needsResponse = pkt->needsResponse();
bool memInhibitAsserted = pkt->memInhibitAsserted();
- Packet::SenderState* senderState = pkt->senderState;
if (needsResponse && !memInhibitAsserted) {
- pkt->senderState = new AddrMapperSenderState(senderState, orig_addr);
+ pkt->pushSenderState(new AddrMapperSenderState(orig_addr));
}
pkt->setAddr(remapAddr(orig_addr));
@@ -137,8 +136,7 @@ AddrMapper::recvTimingReq(PacketPtr pkt)
// If not successful, restore the sender state
if (!successful && needsResponse) {
- delete pkt->senderState;
- pkt->senderState = senderState;
+ delete pkt->popSenderState();
}
return successful;
@@ -158,7 +156,7 @@ AddrMapper::recvTimingResp(PacketPtr pkt)
Addr remapped_addr = pkt->getAddr();
// Restore the state and address
- pkt->senderState = receivedState->origSenderState;
+ pkt->senderState = receivedState->predecessor;
pkt->setAddr(receivedState->origAddr);
// Attempt to send the packet