mc146818.cc (6621:835a99bdab10) mc146818.cc (6677:b741b3e7164b)
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 193 unchanged lines hidden (view full) ---

202}
203
204void
205MC146818::serialize(const string &base, ostream &os)
206{
207 arrayParamOut(os, base + ".clock_data", clock_data, sizeof(clock_data));
208 paramOut(os, base + ".stat_regA", stat_regA);
209 paramOut(os, base + ".stat_regB", stat_regB);
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 193 unchanged lines hidden (view full) ---

202}
203
204void
205MC146818::serialize(const string &base, ostream &os)
206{
207 arrayParamOut(os, base + ".clock_data", clock_data, sizeof(clock_data));
208 paramOut(os, base + ".stat_regA", stat_regA);
209 paramOut(os, base + ".stat_regB", stat_regB);
210
211 //
212 // save the timer tick and rtc clock tick values to correctly reschedule
213 // them during unserialize
214 //
215 Tick rtcTimerInterruptTickOffset = event.when() - curTick;
216 SERIALIZE_SCALAR(rtcTimerInterruptTickOffset);
217 Tick rtcClockTickOffset = event.when() - curTick;
218 SERIALIZE_SCALAR(rtcClockTickOffset);
210}
211
212void
213MC146818::unserialize(const string &base, Checkpoint *cp,
214 const string &section)
215{
216 arrayParamIn(cp, section, base + ".clock_data", clock_data,
217 sizeof(clock_data));
218 paramIn(cp, section, base + ".stat_regA", stat_regA);
219 paramIn(cp, section, base + ".stat_regB", stat_regB);
220
219}
220
221void
222MC146818::unserialize(const string &base, Checkpoint *cp,
223 const string &section)
224{
225 arrayParamIn(cp, section, base + ".clock_data", clock_data,
226 sizeof(clock_data));
227 paramIn(cp, section, base + ".stat_regA", stat_regA);
228 paramIn(cp, section, base + ".stat_regB", stat_regB);
229
221 // We're not unserializing the event here, but we need to
222 // rescehedule the event since curTick was moved forward by the
223 // checkpoint
224 reschedule(event, curTick + event.interval);
230 //
231 // properly schedule the timer and rtc clock events
232 //
233 Tick rtcTimerInterruptTickOffset;
234 UNSERIALIZE_SCALAR(rtcTimerInterruptTickOffset);
235 reschedule(event, curTick + rtcTimerInterruptTickOffset);
236 Tick rtcClockTickOffset;
237 UNSERIALIZE_SCALAR(rtcClockTickOffset);
238 reschedule(tickEvent, curTick + rtcClockTickOffset);
225}
226
227MC146818::RTCEvent::RTCEvent(MC146818 * _parent, Tick i)
228 : parent(_parent), interval(i)
229{
230 DPRINTF(MC146818, "RTC Event Initilizing\n");
231 parent->schedule(this, curTick + interval);
232}

--- 34 unchanged lines hidden ---
239}
240
241MC146818::RTCEvent::RTCEvent(MC146818 * _parent, Tick i)
242 : parent(_parent), interval(i)
243{
244 DPRINTF(MC146818, "RTC Event Initilizing\n");
245 parent->schedule(this, curTick + interval);
246}

--- 34 unchanged lines hidden ---