summaryrefslogtreecommitdiff
path: root/dev/ns_gige.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2004-11-13 16:46:56 -0500
committerNathan Binkert <binkertn@umich.edu>2004-11-13 16:46:56 -0500
commit8922d699532cf5027c8cabe53aaf8be4db470764 (patch)
treefac37c5c456d6507f483de7566d965072dbf19c7 /dev/ns_gige.cc
parentacb98fb0f64a3b6a4f2f3151b0d4fb14fdfcf7cf (diff)
downloadgem5-8922d699532cf5027c8cabe53aaf8be4db470764.tar.xz
change the serialization of a packet so that we don't
do a nameOut. This fixes a subtle bug in serialization that can pop up. --HG-- extra : convert_revision : b52df977dcbef1c9bd0d4405ba0b36dff3737cdf
Diffstat (limited to 'dev/ns_gige.cc')
-rw-r--r--dev/ns_gige.cc26
1 files changed, 10 insertions, 16 deletions
diff --git a/dev/ns_gige.cc b/dev/ns_gige.cc
index 79b128025..39bae07ab 100644
--- a/dev/ns_gige.cc
+++ b/dev/ns_gige.cc
@@ -2123,19 +2123,15 @@ NSGigE::serialize(ostream &os)
SERIALIZE_SCALAR(txNumPkts);
int i = 0;
pktiter_t end = txFifo.end();
- for (pktiter_t p = txFifo.begin(); p != end; ++p) {
- nameOut(os, csprintf("%s.txFifo%d", name(), i++));
- (*p)->serialize(os);
- }
+ for (pktiter_t p = txFifo.begin(); p != end; ++p)
+ (*p)->serialize(csprintf("txFifo%d", i++), os);
int rxNumPkts = rxFifo.size();
SERIALIZE_SCALAR(rxNumPkts);
i = 0;
end = rxFifo.end();
- for (pktiter_t p = rxFifo.begin(); p != end; ++p) {
- nameOut(os, csprintf("%s.rxFifo%d", name(), i++));
- (*p)->serialize(os);
- }
+ for (pktiter_t p = rxFifo.begin(); p != end; ++p)
+ (*p)->serialize(csprintf("rxFifo%d", i++), os);
/*
* Serialize the various helper variables
@@ -2143,8 +2139,7 @@ NSGigE::serialize(ostream &os)
bool txPacketExists = txPacket;
SERIALIZE_SCALAR(txPacketExists);
if (txPacketExists) {
- nameOut(os, csprintf("%s.txPacket", name()));
- txPacket->serialize(os);
+ txPacket->serialize("txPacket", os);
uint32_t txPktBufPtr = (uint32_t) (txPacketBufPtr - txPacket->data);
SERIALIZE_SCALAR(txPktBufPtr);
}
@@ -2152,8 +2147,7 @@ NSGigE::serialize(ostream &os)
bool rxPacketExists = rxPacket;
SERIALIZE_SCALAR(rxPacketExists);
if (rxPacketExists) {
- nameOut(os, csprintf("%s.rxPacket", name()));
- rxPacket->serialize(os);
+ rxPacket->serialize("rxPacket", os);
uint32_t rxPktBufPtr = (uint32_t) (rxPacketBufPtr - rxPacket->data);
SERIALIZE_SCALAR(rxPktBufPtr);
}
@@ -2281,7 +2275,7 @@ NSGigE::unserialize(Checkpoint *cp, const std::string &section)
int i;
for (i = 0; i < txNumPkts; ++i) {
PacketPtr p = new PacketData;
- p->unserialize(cp, csprintf("%s.rxFifo%d", section, i));
+ p->unserialize(csprintf("rxFifo%d", i), cp, section);
txFifo.push_back(p);
}
@@ -2289,7 +2283,7 @@ NSGigE::unserialize(Checkpoint *cp, const std::string &section)
UNSERIALIZE_SCALAR(rxNumPkts);
for (i = 0; i < rxNumPkts; ++i) {
PacketPtr p = new PacketData;
- p->unserialize(cp, csprintf("%s.rxFifo%d", section, i));
+ p->unserialize(csprintf("rxFifo%d", i), cp, section);
rxFifo.push_back(p);
}
@@ -2300,7 +2294,7 @@ NSGigE::unserialize(Checkpoint *cp, const std::string &section)
UNSERIALIZE_SCALAR(txPacketExists);
if (txPacketExists) {
txPacket = new PacketData;
- txPacket->unserialize(cp, csprintf("%s.txPacket", section));
+ txPacket->unserialize("txPacket", cp, section);
uint32_t txPktBufPtr;
UNSERIALIZE_SCALAR(txPktBufPtr);
txPacketBufPtr = (uint8_t *) txPacket->data + txPktBufPtr;
@@ -2312,7 +2306,7 @@ NSGigE::unserialize(Checkpoint *cp, const std::string &section)
rxPacket = 0;
if (rxPacketExists) {
rxPacket = new PacketData;
- rxPacket->unserialize(cp, csprintf("%s.rxPacket", section));
+ rxPacket->unserialize("rxPacket", cp, section);
uint32_t rxPktBufPtr;
UNSERIALIZE_SCALAR(rxPktBufPtr);
rxPacketBufPtr = (uint8_t *) rxPacket->data + rxPktBufPtr;