summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorLisa Hsu <Lisa.Hsu@amd.com>2010-01-19 22:03:44 -0800
committerLisa Hsu <Lisa.Hsu@amd.com>2010-01-19 22:03:44 -0800
commitd6da17251774a34b2835b71332cfaa682d979c3f (patch)
treeb71fb3f0d8c4acd2e9e4ac762e2421a7b841e6b2 /src/sim
parent0484432a7ca177d52fa98746b16c92805df73189 (diff)
downloadgem5-d6da17251774a34b2835b71332cfaa682d979c3f.tar.xz
util: do checkpoint aggregation more cleanly, fix last changeset.
1) Move alpha-specific code out of page_table.cc:serialize(). 2) Begin serializing M5_pid and unserializing it, but adding an function to do optional paramIn so that old checkpoints don't need to be fixed up. 3) Fix up alpha startup code so that the unserialized M5_pid value is properly written to DTB_IPR_ASN. 4) Fix the memory unserialize that I forgot somehow in the last changeset. 5) Add in an agg_se.py to handle aggregated checkpoints. --bench foo-bar plus positional arguments foo bar are the only changes in usage from se.py. Note this aggregation stuff has only been tested for Alpha and nothing else, though it should take a very minimal amount of work to get it to work with another ISA.
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/process.cc6
-rw-r--r--src/sim/serialize.cc15
-rw-r--r--src/sim/serialize.hh5
3 files changed, 26 insertions, 0 deletions
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 343d2ad5a..957c3cc3e 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -507,6 +507,7 @@ Process::serialize(std::ostream &os)
nameOut(os, csprintf("%s.FdMap%d", name(), x));
fd_map[x].serialize(os);
}
+ SERIALIZE_SCALAR(M5_pid);
}
@@ -528,6 +529,11 @@ Process::unserialize(Checkpoint *cp, const std::string &section)
fd_map[x].unserialize(cp, csprintf("%s.FdMap%d", section, x));
}
fix_file_offsets();
+ UNSERIALIZE_OPT_SCALAR(M5_pid);
+ // The above returns a bool so that you could do something if you don't
+ // find the param in the checkpoint if you wanted to, like set a default
+ // but in this case we'll just stick with the instantianted value if not
+ // found.
checkpointRestored = true;
diff --git a/src/sim/serialize.cc b/src/sim/serialize.cc
index 1663d18bc..0e6d9b254 100644
--- a/src/sim/serialize.cc
+++ b/src/sim/serialize.cc
@@ -204,6 +204,18 @@ paramIn(Checkpoint *cp, const string &section, const string &name, T &param)
}
}
+template <class T>
+bool
+optParamIn(Checkpoint *cp, const string &section, const string &name, T &param)
+{
+ string str;
+ if (!cp->find(section, name, str) || !parseParam(str, param)) {
+ warn("optional parameter %s:%s not present\n", section, name);
+ return false;
+ } else {
+ return true;
+ }
+}
template <class T>
void
@@ -322,6 +334,9 @@ paramOut(ostream &os, const string &name, type const &param); \
template void \
paramIn(Checkpoint *cp, const string &section, \
const string &name, type & param); \
+template bool \
+optParamIn(Checkpoint *cp, const string &section, \
+ const string &name, type & param); \
template void \
arrayParamOut(ostream &os, const string &name, \
type const *param, unsigned size); \
diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh
index 08240c0c0..cf1a672be 100644
--- a/src/sim/serialize.hh
+++ b/src/sim/serialize.hh
@@ -58,6 +58,10 @@ void paramIn(Checkpoint *cp, const std::string &section,
const std::string &name, T &param);
template <class T>
+bool optParamIn(Checkpoint *cp, const std::string &section,
+ const std::string &name, T &param);
+
+template <class T>
void arrayParamOut(std::ostream &os, const std::string &name,
const T *param, unsigned size);
@@ -85,6 +89,7 @@ objParamIn(Checkpoint *cp, const std::string &section,
#define SERIALIZE_SCALAR(scalar) paramOut(os, #scalar, scalar)
#define UNSERIALIZE_SCALAR(scalar) paramIn(cp, section, #scalar, scalar)
+#define UNSERIALIZE_OPT_SCALAR(scalar) optParamIn(cp, section, #scalar, scalar)
// ENUMs are like SCALARs, but we cast them to ints on the way out
#define SERIALIZE_ENUM(scalar) paramOut(os, #scalar, (int)scalar)