ruby: set: corrects csprintf() call introduced by 7d95b650c9b6
[gem5.git] / src / sim / root.cc
index c47ada30eeddcc4a39bbc1851232c8978f4392c6..f77159486cfbeb3ebe9d04e68a7900e0041c20bf 100644 (file)
@@ -32,6 +32,8 @@
  */
 
 #include "base/misc.hh"
+#include "base/trace.hh"
+#include "config/the_isa.hh"
 #include "debug/TimeSync.hh"
 #include "sim/full_system.hh"
 #include "sim/root.hh"
@@ -121,10 +123,47 @@ Root::initState()
 void
 Root::loadState(Checkpoint *cp)
 {
+    SimObject::loadState(cp);
     timeSyncEnable(params()->time_sync_enable);
 }
 
+void
+Root::serialize(std::ostream &os)
+{
+    uint64_t cpt_ver = gem5CheckpointVersion;
+    SERIALIZE_SCALAR(cpt_ver);
+    SERIALIZE_SCALAR(FullSystem);
+    std::string isa = THE_ISA_STR;
+    SERIALIZE_SCALAR(isa);
+}
+
+void
+Root::unserialize(Checkpoint *cp, const std::string &section)
+{
+    uint64_t cpt_ver = 0;
+    UNSERIALIZE_OPT_SCALAR(cpt_ver);
+    if (cpt_ver < gem5CheckpointVersion) {
+        warn("**********************************************************\n");
+        warn("!!!! Checkpoint ver %#x is older than current ver %#x !!!!\n",
+                cpt_ver, gem5CheckpointVersion);
+        warn("You might experience some issues when restoring and should run "
+             "the checkpoint upgrader (util/cpt_upgrader.py) on your "
+             "checkpoint\n");
+        warn("**********************************************************\n");
+    } else if (cpt_ver > gem5CheckpointVersion) {
+        warn("**********************************************************\n");
+        warn("!!!! Checkpoint ver %#x is newer than current ver %#x !!!!\n",
+                cpt_ver, gem5CheckpointVersion);
+        warn("Running a new checkpoint with an older version of gem5 is not "
+             "supported. While it might work, you may experience incorrect "
+             "behavior or crashes.\n");
+        warn("**********************************************************\n");
+     }
+}
+
+
 bool FullSystem;
+unsigned int FullSystemInt;
 
 Root *
 RootParams::create()
@@ -136,6 +175,7 @@ RootParams::create()
     created = true;
 
     FullSystem = full_system;
+    FullSystemInt = full_system ? 1 : 0;
 
     return new Root(this);
 }