summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Schultz <alschult@umich.edu>2004-06-16 19:47:07 -0400
committerAndrew Schultz <alschult@umich.edu>2004-06-16 19:47:07 -0400
commitd1256a2f2c0bbbc402e549274f8d1b833248ae0a (patch)
tree876845ef75900b8b957436920b07c4b2acc51f57
parente937b38e2ccf0bf75794178f29c8482d76bec9c8 (diff)
downloadgem5-d1256a2f2c0bbbc402e549274f8d1b833248ae0a.tar.xz
Fix serialize/unserialize of the timers and RTC events
--HG-- extra : convert_revision : aecf09b3b13a23ffef852a1539e8d4eec32008ad
-rw-r--r--dev/tsunami_io.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/dev/tsunami_io.cc b/dev/tsunami_io.cc
index 1d8ead5d9..ea530b3d2 100644
--- a/dev/tsunami_io.cc
+++ b/dev/tsunami_io.cc
@@ -141,7 +141,7 @@ TsunamiIO::ClockEvent::Status()
void
TsunamiIO::ClockEvent::serialize(std::ostream &os)
{
- Tick time = when();
+ Tick time = scheduled() ? when() : 0;
SERIALIZE_SCALAR(time);
SERIALIZE_SCALAR(status);
SERIALIZE_SCALAR(mode);
@@ -156,7 +156,8 @@ TsunamiIO::ClockEvent::unserialize(Checkpoint *cp, const std::string &section)
UNSERIALIZE_SCALAR(status);
UNSERIALIZE_SCALAR(mode);
UNSERIALIZE_SCALAR(interval);
- schedule(time);
+ if (time)
+ schedule(time);
}
TsunamiIO::TsunamiIO(const string &name, Tsunami *t, time_t init_time,
@@ -441,6 +442,13 @@ TsunamiIO::serialize(std::ostream &os)
SERIALIZE_SCALAR(picInterrupting);
SERIALIZE_SCALAR(RTCAddress);
+ // Serialize the timers
+ nameOut(os, csprintf("%s.timer0", name()));
+ timer0.serialize(os);
+ nameOut(os, csprintf("%s.timer2", name()));
+ timer2.serialize(os);
+ nameOut(os, csprintf("%s.rtc", name()));
+ rtc.serialize(os);
}
void
@@ -455,6 +463,11 @@ TsunamiIO::unserialize(Checkpoint *cp, const std::string &section)
UNSERIALIZE_SCALAR(picr);
UNSERIALIZE_SCALAR(picInterrupting);
UNSERIALIZE_SCALAR(RTCAddress);
+
+ // Unserialize the timers
+ timer0.unserialize(cp, csprintf("%s.timer0", section));
+ timer2.unserialize(cp, csprintf("%s.timer2", section));
+ rtc.unserialize(cp, csprintf("%s.rtc", section));
}
BEGIN_DECLARE_SIM_OBJECT_PARAMS(TsunamiIO)