Serialized cpu interrupts
authorAli Saidi <saidi@eecs.umich.edu>
Thu, 17 Jun 2004 19:36:59 +0000 (15:36 -0400)
committerAli Saidi <saidi@eecs.umich.edu>
Thu, 17 Jun 2004 19:36:59 +0000 (15:36 -0400)
cpu/simple_cpu/simple_cpu.cc:
    called basecpu serialization

--HG--
extra : convert_revision : 1a639b5e3c08e47a5d581c18b2b53fe87bd05b73

cpu/base_cpu.cc
cpu/base_cpu.hh
cpu/simple_cpu/simple_cpu.cc

index 944c76ed8dc73ccd87ba473ccab4f44b1ee6ec2c..3ee7a3892321e64e9824372c44a144302c829ee0 100644 (file)
@@ -242,6 +242,21 @@ BaseCPU::clear_interrupts()
     intstatus = 0;
 }
 
+
+void
+BaseCPU::serialize(std::ostream &os)
+{
+    SERIALIZE_ARRAY(interrupts, NumInterruptLevels);
+    SERIALIZE_SCALAR(intstatus);
+}
+
+void
+BaseCPU::unserialize(Checkpoint *cp, const std::string &section)
+{
+    UNSERIALIZE_ARRAY(interrupts, NumInterruptLevels);
+    UNSERIALIZE_SCALAR(intstatus);
+}
+
 #endif // FULL_SYSTEM
 
 DEFINE_SIM_OBJECT_CLASS_NAME("BaseCPU", BaseCPU)
index 3e1518cf323b6fa8bbd57e86f176c7ab1d058e65..f75f0040921daf9c620066be646d4a45789c7e6e 100644 (file)
@@ -139,6 +139,21 @@ class BaseCPU : public SimObject
 
 #ifdef FULL_SYSTEM
     System *system;
+
+
+    /**
+     * Serialize this object to the given output stream.
+     * @param os The stream to serialize to.
+     */
+    virtual void serialize(std::ostream &os);
+
+    /**
+     * Reconstruct the state of this object from a checkpoint.
+     * @param cp The checkpoint use.
+     * @param section The section name of this object
+     */
+    virtual void unserialize(Checkpoint *cp, const std::string &section);
+
 #endif
 
     /**
index f2109af514629fb3bdaea5519ba8878bf69546b8..99e302ca3656741b3f5242a376ab794f701da0e9 100644 (file)
@@ -299,6 +299,7 @@ SimpleCPU::resetStats()
 void
 SimpleCPU::serialize(ostream &os)
 {
+    BaseCPU::serialize(os);
     SERIALIZE_ENUM(_status);
     SERIALIZE_SCALAR(inst);
     nameOut(os, csprintf("%s.xc", name()));
@@ -312,6 +313,7 @@ SimpleCPU::serialize(ostream &os)
 void
 SimpleCPU::unserialize(Checkpoint *cp, const string &section)
 {
+    BaseCPU::unserialize(cp, section);
     UNSERIALIZE_ENUM(_status);
     UNSERIALIZE_SCALAR(inst);
     xc->unserialize(cp, csprintf("%s.xc", section));