dev: (un)serialize fix for the RTC and RTC Timer Interrupt events
authorNikos Nikoleris <nikos.nikoleris@gmail.com>
Fri, 3 Apr 2015 16:42:10 +0000 (11:42 -0500)
committerNikos Nikoleris <nikos.nikoleris@gmail.com>
Fri, 3 Apr 2015 16:42:10 +0000 (11:42 -0500)
Restoring from a checkpoint fails if either the RTC or the RTC Timer
Interrrupt event is disabled. The restored machine tried incorrectly
to schedule the next event with negative offset.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

src/dev/mc146818.cc

index fa83507609c0b46687a3100454ad6e63b1a446d8..b5467f8cced1052411241e23e7d74883cd5ab3fa 100644 (file)
@@ -127,8 +127,11 @@ MC146818::startup()
 {
     assert(!event.scheduled());
     assert(!tickEvent.scheduled());
-    schedule(event, curTick() + event.offset);
-    schedule(tickEvent, curTick() + tickEvent.offset);
+
+    if (stat_regB.pie)
+        schedule(event, curTick() + event.offset);
+    if (!rega_dv_disabled(stat_regA))
+        schedule(tickEvent, curTick() + tickEvent.offset);
 }
 
 void