summaryrefslogtreecommitdiff
path: root/src/mem/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby')
-rw-r--r--src/mem/ruby/system/RubyPort.cc11
-rw-r--r--src/mem/ruby/system/RubyPort.hh4
-rw-r--r--src/mem/ruby/system/Sequencer.cc8
3 files changed, 10 insertions, 13 deletions
diff --git a/src/mem/ruby/system/RubyPort.cc b/src/mem/ruby/system/RubyPort.cc
index 2f1cc622d..5e9e8cdd4 100644
--- a/src/mem/ruby/system/RubyPort.cc
+++ b/src/mem/ruby/system/RubyPort.cc
@@ -151,12 +151,9 @@ RubyPort::PioPort::recvTimingResp(PacketPtr pkt)
// First we must retrieve the request port from the sender State
RubyPort::SenderState *senderState =
- safe_cast<RubyPort::SenderState *>(pkt->senderState);
+ safe_cast<RubyPort::SenderState *>(pkt->popSenderState());
M5Port *port = senderState->port;
assert(port != NULL);
-
- // pop the sender state from the packet
- pkt->senderState = senderState->saved;
delete senderState;
port->sendTimingResp(pkt);
@@ -187,7 +184,7 @@ RubyPort::M5Port::recvTimingReq(PacketPtr pkt)
// Save the port in the sender state object to be used later to
// route the response
- pkt->senderState = new SenderState(this, pkt->senderState);
+ pkt->pushSenderState(new SenderState(this));
// Check for pio requests and directly send them to the dedicated
// pio port.
@@ -230,7 +227,7 @@ RubyPort::M5Port::recvTimingReq(PacketPtr pkt)
pkt->getAddr(), RequestStatus_to_string(requestStatus));
SenderState* senderState = safe_cast<SenderState*>(pkt->senderState);
- pkt->senderState = senderState->saved;
+ pkt->senderState = senderState->predecessor;
delete senderState;
return false;
}
@@ -305,7 +302,7 @@ RubyPort::ruby_hit_callback(PacketPtr pkt)
assert(port != NULL);
// pop the sender state from the packet
- pkt->senderState = senderState->saved;
+ pkt->senderState = senderState->predecessor;
delete senderState;
port->hitCallback(pkt);
diff --git a/src/mem/ruby/system/RubyPort.hh b/src/mem/ruby/system/RubyPort.hh
index cec356edb..3c61eb522 100644
--- a/src/mem/ruby/system/RubyPort.hh
+++ b/src/mem/ruby/system/RubyPort.hh
@@ -113,10 +113,8 @@ class RubyPort : public MemObject
struct SenderState : public Packet::SenderState
{
M5Port* port;
- Packet::SenderState *saved;
- SenderState(M5Port* _port, Packet::SenderState *sender_state = NULL)
- : port(_port), saved(sender_state)
+ SenderState(M5Port* _port) : port(_port)
{}
};
diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc
index 1cdd6d806..f00f8407a 100644
--- a/src/mem/ruby/system/Sequencer.cc
+++ b/src/mem/ruby/system/Sequencer.cc
@@ -530,11 +530,13 @@ Sequencer::hitCallback(SequencerRequest* srequest,
// Note: RubyPort will access it's sender state before the
// RubyTester.
if (m_usingRubyTester) {
- RubyPort::SenderState *requestSenderState =
+ RubyPort::SenderState *reqSenderState =
safe_cast<RubyPort::SenderState*>(pkt->senderState);
+ // @todo This is a dangerous assumption on nothing else
+ // modifying the senderState
RubyTester::SenderState* testerSenderState =
- safe_cast<RubyTester::SenderState*>(requestSenderState->saved);
- testerSenderState->subBlock->mergeFrom(data);
+ safe_cast<RubyTester::SenderState*>(reqSenderState->predecessor);
+ testerSenderState->subBlock.mergeFrom(data);
}
delete srequest;