summaryrefslogtreecommitdiff
path: root/sim/serialize.hh
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2003-10-29 08:50:25 -0800
committerSteve Reinhardt <stever@eecs.umich.edu>2003-10-29 08:50:25 -0800
commit8da9fcdd751bcb74c17e72d7d0a6c7ccf259552c (patch)
tree0cf43c0d989be70e4dbf57eaa3c1083ae0b11f9a /sim/serialize.hh
parentaa12cac9fd423d75578c3657fe5fe6e664e63890 (diff)
downloadgem5-8da9fcdd751bcb74c17e72d7d0a6c7ccf259552c.tar.xz
Flesh out ExecContext serialize/unserialize (including RegFile).
Add support for serializing enums. arch/alpha/isa_traits.hh: Add serialize/unserialize functions for RegFile (defined in new isa_traits.cc). cpu/exec_context.cc: Flesh out serialize/unserialize. sim/serialize.hh: Add {UN}SERIALIZE_ENUM(). --HG-- extra : convert_revision : 9e30c7e7b3b290dc8ea0888ba3636fc93ee89052
Diffstat (limited to 'sim/serialize.hh')
-rw-r--r--sim/serialize.hh10
1 files changed, 10 insertions, 0 deletions
diff --git a/sim/serialize.hh b/sim/serialize.hh
index 9c321b897..d7842b47d 100644
--- a/sim/serialize.hh
+++ b/sim/serialize.hh
@@ -66,6 +66,16 @@ void arrayParamIn(const IniFile *db, const std::string &section,
#define UNSERIALIZE_SCALAR(scalar) paramIn(db, 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)
+
+#define UNSERIALIZE_ENUM(scalar) \
+ do { \
+ int tmp; \
+ paramIn(db, section, #scalar, tmp); \
+ scalar = (typeof(scalar))tmp; \
+ } while (0)
+
#define SERIALIZE_ARRAY(member, size) \
arrayParamOut(os, #member, member, size)