diff options
Diffstat (limited to 'src/sim/serialize.cc')
-rw-r--r-- | src/sim/serialize.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/sim/serialize.cc b/src/sim/serialize.cc index 0904b1375..f9a945b95 100644 --- a/src/sim/serialize.cc +++ b/src/sim/serialize.cc @@ -496,16 +496,73 @@ class Globals : public Serializable /// The one and only instance of the Globals class. Globals globals; +/// The version tags for this build of the simulator, to be stored in the +/// Globals section during serialization and compared upon unserialization. +extern std::set<std::string> version_tags; + void Globals::serialize(CheckpointOut &cp) const { paramOut(cp, "curTick", curTick()); + SERIALIZE_CONTAINER(version_tags); } void Globals::unserialize(CheckpointIn &cp) { paramIn(cp, "curTick", unserializedCurTick); + + const std::string §ion(Serializable::currentSection()); + std::string str; + if (!cp.find(section, "version_tags", str)) { + warn("**********************************************************\n"); + warn("!!!! Checkpoint uses an old versioning scheme. !!!!\n"); + warn("Run the checkpoint upgrader (util/cpt_upgrader.py) on your " + "checkpoint\n"); + warn("**********************************************************\n"); + return; + } + + std::set<std::string> cpt_tags; + arrayParamIn(cp, "version_tags", cpt_tags); // UNSERIALIZE_CONTAINER + + bool err = false; + for (const auto& t : version_tags) { + if (cpt_tags.find(t) == cpt_tags.end()) { + // checkpoint is missing tag that this binary has + if (!err) { + warn("*****************************************************\n"); + warn("!!!! Checkpoint is missing the following version tags:\n"); + err = true; + } + warn(" %s\n", t); + } + } + if (err) { + warn("You might experience some issues when restoring and should run " + "the checkpoint upgrader (util/cpt_upgrader.py) on your " + "checkpoint\n"); + warn("**********************************************************\n"); + } + + err = false; + for (const auto& t : cpt_tags) { + if (version_tags.find(t) == version_tags.end()) { + // gem5 binary is missing tag that this checkpoint has + if (!err) { + warn("*****************************************************\n"); + warn("!!!! gem5 is missing the following version tags:\n"); + err = true; + } + warn(" %s\n", t); + } + } + if (err) { + warn("Running a checkpoint with incompatible version tags is not " + "supported. While it might work, you may experience incorrect " + "behavior or crashes.\n"); + warn("**********************************************************\n"); + } } Serializable::Serializable() |