x86: Add checkpointing capability to arch components
authorJoel Hestness <hestness@cs.utexas.edu>
Mon, 7 Feb 2011 06:14:17 +0000 (22:14 -0800)
committerJoel Hestness <hestness@cs.utexas.edu>
Mon, 7 Feb 2011 06:14:17 +0000 (22:14 -0800)
Add checkpointing capability to the x86 interrupt device and the TLBs

src/arch/x86/interrupts.cc
src/arch/x86/interrupts.hh
src/arch/x86/pagetable.cc

index 61800e1ea7cf2c752eb75fa97caed8d9d0658157..9b2d42a16297688fda1c7ec5d01e38df506f1c6e 100644 (file)
@@ -706,6 +706,65 @@ X86ISA::Interrupts::updateIntrInfo(ThreadContext *tc)
     }
 }
 
+void
+X86ISA::Interrupts::serialize(std::ostream &os)
+{
+    SERIALIZE_ARRAY(regs, NUM_APIC_REGS);
+    SERIALIZE_SCALAR(clock);
+    SERIALIZE_SCALAR(pendingSmi);
+    SERIALIZE_SCALAR(smiVector);
+    SERIALIZE_SCALAR(pendingNmi);
+    SERIALIZE_SCALAR(nmiVector);
+    SERIALIZE_SCALAR(pendingExtInt);
+    SERIALIZE_SCALAR(extIntVector);
+    SERIALIZE_SCALAR(pendingInit);
+    SERIALIZE_SCALAR(initVector);
+    SERIALIZE_SCALAR(pendingStartup);
+    SERIALIZE_SCALAR(startupVector);
+    SERIALIZE_SCALAR(startedUp);
+    SERIALIZE_SCALAR(pendingUnmaskableInt);
+    SERIALIZE_SCALAR(pendingIPIs);
+    SERIALIZE_SCALAR(IRRV);
+    SERIALIZE_SCALAR(ISRV);
+    bool apicTimerEventScheduled = apicTimerEvent.scheduled();
+    SERIALIZE_SCALAR(apicTimerEventScheduled);
+    Tick apicTimerEventTick = apicTimerEvent.when();
+    SERIALIZE_SCALAR(apicTimerEventTick);
+}
+
+void
+X86ISA::Interrupts::unserialize(Checkpoint *cp, const std::string &section)
+{
+    UNSERIALIZE_ARRAY(regs, NUM_APIC_REGS);
+    UNSERIALIZE_SCALAR(clock);
+    UNSERIALIZE_SCALAR(pendingSmi);
+    UNSERIALIZE_SCALAR(smiVector);
+    UNSERIALIZE_SCALAR(pendingNmi);
+    UNSERIALIZE_SCALAR(nmiVector);
+    UNSERIALIZE_SCALAR(pendingExtInt);
+    UNSERIALIZE_SCALAR(extIntVector);
+    UNSERIALIZE_SCALAR(pendingInit);
+    UNSERIALIZE_SCALAR(initVector);
+    UNSERIALIZE_SCALAR(pendingStartup);
+    UNSERIALIZE_SCALAR(startupVector);
+    UNSERIALIZE_SCALAR(startedUp);
+    UNSERIALIZE_SCALAR(pendingUnmaskableInt);
+    UNSERIALIZE_SCALAR(pendingIPIs);
+    UNSERIALIZE_SCALAR(IRRV);
+    UNSERIALIZE_SCALAR(ISRV);
+    bool apicTimerEventScheduled;
+    UNSERIALIZE_SCALAR(apicTimerEventScheduled);
+    if (apicTimerEventScheduled) {
+        Tick apicTimerEventTick;
+        UNSERIALIZE_SCALAR(apicTimerEventTick);
+        if (apicTimerEvent.scheduled()) {
+            reschedule(apicTimerEvent, apicTimerEventTick, true);
+        } else {
+            schedule(apicTimerEvent, apicTimerEventTick);
+        }
+    }
+}
+
 X86ISA::Interrupts *
 X86LocalApicParams::create()
 {
index 55651bf3b9c1809b80be292f0d5fba9fd661d69e..e45610ec7dffa98d69144461bf729d2404e56c71 100644 (file)
@@ -257,17 +257,8 @@ class Interrupts : public BasicPioDevice, IntDev
      * Serialization.
      */
 
-    void
-    serialize(std::ostream &os)
-    {
-        warn("Interrupts::serialize unimplemented!\n");
-    }
-
-    void
-    unserialize(Checkpoint *cp, const std::string &section)
-    {
-        warn("Interrupts::unserialize unimplemented!\n");
-    }
+    virtual void serialize(std::ostream &os);
+    virtual void unserialize(Checkpoint *cp, const std::string &section);
 
     /*
      * Old functions needed for compatability but which will be phased out
index 6de4c956f830a263ea58412cb10217a4f4e074a3..a7717def72ceb1a6bdd73f34ac91c4421b62f901 100644 (file)
@@ -52,11 +52,29 @@ TlbEntry::TlbEntry(Addr asn, Addr _vaddr, Addr _paddr) :
 void
 TlbEntry::serialize(std::ostream &os)
 {
+    SERIALIZE_SCALAR(paddr);
+    SERIALIZE_SCALAR(vaddr);
+    SERIALIZE_SCALAR(size);
+    SERIALIZE_SCALAR(writable);
+    SERIALIZE_SCALAR(user);
+    SERIALIZE_SCALAR(uncacheable);
+    SERIALIZE_SCALAR(global);
+    SERIALIZE_SCALAR(patBit);
+    SERIALIZE_SCALAR(noExec);
 }
 
 void
 TlbEntry::unserialize(Checkpoint *cp, const std::string &section)
 {
+    UNSERIALIZE_SCALAR(paddr);
+    UNSERIALIZE_SCALAR(vaddr);
+    UNSERIALIZE_SCALAR(size);
+    UNSERIALIZE_SCALAR(writable);
+    UNSERIALIZE_SCALAR(user);
+    UNSERIALIZE_SCALAR(uncacheable);
+    UNSERIALIZE_SCALAR(global);
+    UNSERIALIZE_SCALAR(patBit);
+    UNSERIALIZE_SCALAR(noExec);
 }
 
 }