summaryrefslogtreecommitdiff
path: root/src/mem/packet.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/packet.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/packet.cc')
-rw-r--r--src/mem/packet.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mem/packet.cc b/src/mem/packet.cc
index dc5ff4362..cea65cea0 100644
--- a/src/mem/packet.cc
+++ b/src/mem/packet.cc
@@ -316,6 +316,24 @@ Packet::checkFunctional(Printable *obj, Addr addr, int size, uint8_t *data)
}
void
+Packet::pushSenderState(Packet::SenderState *sender_state)
+{
+ assert(sender_state != NULL);
+ sender_state->predecessor = senderState;
+ senderState = sender_state;
+}
+
+Packet::SenderState *
+Packet::popSenderState()
+{
+ assert(senderState != NULL);
+ SenderState *sender_state = senderState;
+ senderState = sender_state->predecessor;
+ sender_state->predecessor = NULL;
+ return sender_state;
+}
+
+void
Packet::print(ostream &o, const int verbosity, const string &prefix) const
{
ccprintf(o, "%s[%x:%x] %s\n", prefix,