SERIALIZE_SCALAR(size);
     SERIALIZE_SCALAR(nlu);
 
-    // should just add serialize/unserialize methods to AlphaPTE
-#if 0
-    stringstream buf;
     for (int i = 0; i < size; i++) {
-        buf.str("");
-        ccprintf(buf, "pte%02d.valid", i);
-        paramOut(buf.str(), table[i].valid);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.tag", i);
-        paramOut(buf.str(), table[i].tag);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.ppn", i);
-        paramOut(buf.str(), table[i].ppn);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.xre", i);
-        paramOut(buf.str(), table[i].xre);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.xwe", i);
-        paramOut(buf.str(), table[i].xwe);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.fonr", i);
-        paramOut(buf.str(), table[i].fonr);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.fonw", i);
-        paramOut(buf.str(), table[i].fonw);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.asma", i);
-        paramOut(buf.str(), table[i].asma);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.asn", i);
-        paramOut(buf.str(), table[i].asn);
+        nameOut(os, csprintf("%s.PTE%d", name(), i));
+        table[i].serialize(os);
     }
-#endif
 }
 
 void
     UNSERIALIZE_SCALAR(size);
     UNSERIALIZE_SCALAR(nlu);
 
-#if 0
-    string data;
-    stringstream buf;
     for (int i = 0; i < size; i++) {
-        buf.str("");
-        ccprintf(buf, "pte%02d.valid", i);
-        db.findDefault(category, buf.str(), data);
-        to_number(data, table[i].valid);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.tag", i);
-        db.findDefault(category, buf.str(), data);
-        to_number(data, table[i].tag);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.ppn", i);
-        db.findDefault(category, buf.str(), data);
-        to_number(data, table[i].ppn);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.xre", i);
-        db.findDefault(category, buf.str(), data);
-        to_number(data, table[i].xre);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.xwe", i);
-        db.findDefault(category, buf.str(), data);
-        to_number(data, table[i].xwe);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.fonr", i);
-        db.findDefault(category, buf.str(), data);
-        to_number(data, table[i].fonr);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.fonw", i);
-        db.findDefault(category, buf.str(), data);
-        to_number(data, table[i].fonw);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.asma", i);
-        db.findDefault(category, buf.str(), data);
-        to_number(data, table[i].asma);
-
-        buf.str("");
-        ccprintf(buf, "pte%02d.asn", i);
-        db.findDefault(category, buf.str(), data);
-        to_number(data, table[i].asn);
+        table[i].unserialize(db, csprintf("%s.PTE%d", section, i));
+        if (table[i].valid) {
+            lookupTable.insert(make_pair(table[i].tag, i));
+        }
     }
-#endif
 }
 
 
 
     // Checkpointing
     virtual void serialize(std::ostream &os);
     virtual void unserialize(const IniFile *db, const std::string §ion);
-
 };
 
 class AlphaItb : public AlphaTlb
 
 
 using namespace std;
 
+SimpleCPU::TickEvent::TickEvent(SimpleCPU *c)
+    : Event(&mainEventQueue, "SimpleCPU::TickEvent", 100), cpu(c)
+{
+}
+
+void
+SimpleCPU::TickEvent::process()
+{
+    cpu->tick();
+}
+
+const char *
+SimpleCPU::TickEvent::description()
+{
+    return "SimpleCPU tick event";
+}
+
+
 SimpleCPU::CacheCompletionEvent::CacheCompletionEvent(SimpleCPU *_cpu)
-    : Event(&mainEventQueue),
+    : Event(&mainEventQueue, "SimpleCPU::CacheCompletionEvent"),
       cpu(_cpu)
 {
 }
 const char *
 SimpleCPU::CacheCompletionEvent::description()
 {
-    return "cache completion event";
+    return "SimpleCPU cache completion event";
 }
 
 #ifdef FULL_SYSTEM
 void
 SimpleCPU::serialize(ostream &os)
 {
+    SERIALIZE_ENUM(_status);
+    SERIALIZE_SCALAR(inst);
     xc->serialize(os);
+    nameOut(os, csprintf("%s.tickEvent", name()));
+    tickEvent.serialize(os);
+    nameOut(os, csprintf("%s.cacheCompletionEvent", name()));
+    cacheCompletionEvent.serialize(os);
 }
 
 void
-SimpleCPU::unserialize(const IniFile *db, const string &category)
+SimpleCPU::unserialize(const IniFile *db, const string §ion)
 {
-    xc->unserialize(db, category);
-
-    // Read in Special registers
-
-    // CPUTraitsType::unserializeSpecialRegs(db,category,node,xc->regs);
+    UNSERIALIZE_ENUM(_status);
+    UNSERIALIZE_SCALAR(inst);
+    xc->unserialize(db, section);
+    tickEvent.unserialize(db, csprintf("%s.tickEvent", name()));
+    cacheCompletionEvent
+        .unserialize(db, csprintf("%s.cacheCompletionEvent", name()));
 }
 
 void
 
         SimpleCPU *cpu;
 
       public:
-        TickEvent(SimpleCPU *c)
-            : Event(&mainEventQueue, 100), cpu(c) { }
-        void process() { cpu->tick(); }
-        virtual const char *description() { return "tick event"; }
+        TickEvent(SimpleCPU *c);
+        void process();
+        const char *description();
     };
 
     TickEvent tickEvent;
 
         delete event;
 }
 
+
+void
+Event::serialize(std::ostream &os)
+{
+    SERIALIZE_SCALAR(_when);
+    SERIALIZE_SCALAR(_priority);
+    SERIALIZE_ENUM(_flags);
+}
+
+
+void
+Event::unserialize(const IniFile *db, const string §ion)
+{
+    if (scheduled())
+        deschedule();
+
+    UNSERIALIZE_SCALAR(_when);
+    UNSERIALIZE_SCALAR(_priority);
+
+    // need to see if original event was in a scheduled, unsquashed
+    // state, but don't want to restore those flags in the current
+    // object itself (since they aren't immediately true)
+    UNSERIALIZE_ENUM(_flags);
+    bool wasScheduled = (_flags & Scheduled) && !(_flags & Squashed);
+    _flags &= ~(Squashed | Scheduled);
+
+    if (wasScheduled) {
+        DPRINTF(Config, "rescheduling at %d\n", _when);
+        schedule(_when);
+    }
+}
+
+
 void
 EventQueue::nameChildren()
 {
 
     {
     }
 
+    /*
+     * Event constructor
+     * @param queue that the event gets scheduled on
+     */
+    Event(EventQueue *q, std::string _name, int p = 0)
+        : Serializeable(_name), queue(q), next(NULL),
+          _priority(p), _flags(None),
+#if TRACING_ON
+          when_created(curTick), when_scheduled(0),
+#endif
+          annotated_value(0)
+    {
+    }
+
     ~Event() {}
 
     /// Determine if the current event is scheduled
             return l->when() >= r->when() || l->priority() >= r->priority();
         }
     };
+
+    virtual void serialize(std::ostream &os);
+    virtual void unserialize(const IniFile *db, const std::string §ion);
 };
 
 template <class T, void (T::* F)()>
 
                              "file",
                              "file to write to", "");
 
+// Copy filename into regular string so we can export it without
+// having to include param.hh all over the place.
+string serializeFilename;
+
 SerializeParamContext::SerializeParamContext(const string §ion)
     : ParamContext(section), event(NULL)
 { }
 void
 SerializeParamContext::checkParams()
 {
-    if (!((string)serialize_file).empty() && serialize_cycle > 0)
-    event = new SerializeEvent(&mainEventQueue, serialize_cycle,
-                               serialize_file);
+    serializeFilename = serialize_file;
+    if (!serializeFilename.empty() && serialize_cycle > 0)
+        event = new SerializeEvent(&mainEventQueue, serialize_cycle,
+                                   serializeFilename);
 }
 
 void
 
                                      new##OBJ_CLASS##Builder);
 
 
+//
+// Export checkpoint filename param so other objects can derive
+// filenames from it (e.g., memory).
+//
+extern std::string serializeFilename;
 
 #endif // __SERIALIZE_HH__