changeset 810f5a48a920 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=810f5a48a920
description:
        sim: Add support for serializing BitUnionXX

        BitUnion instances can normally not be used with the SERIALIZE_SCALAR
        and UNSERIALIZE_SCALAR macros due to the way they are converted
        between their storage type and their actual type. This changeset adds
        a set of parm(In|Out) functions specifically for gem5 bit unions to
        work around the issue.

diffstat:

 src/sim/serialize.hh |  24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diffs (49 lines):

diff -r 64809024b924 -r 810f5a48a920 src/sim/serialize.hh
--- a/src/sim/serialize.hh      Thu Oct 16 05:49:37 2014 -0400
+++ b/src/sim/serialize.hh      Thu Oct 16 05:49:37 2014 -0400
@@ -43,6 +43,7 @@
 #include <map>
 #include <vector>
 
+#include "base/bitunion.hh"
 #include "base/types.hh"
 
 class IniFile;
@@ -63,14 +64,37 @@
 template <class T>
 void paramOut(std::ostream &os, const std::string &name, const T &param);
 
+template <typename DataType, typename BitUnion>
+void paramOut(std::ostream &os, const std::string &name,
+              const BitfieldBackend::BitUnionOperators<DataType, BitUnion> &p)
+{
+    paramOut(os, name, p.__data);
+}
+
 template <class T>
 void paramIn(Checkpoint *cp, const std::string &section,
              const std::string &name, T &param);
 
+template <typename DataType, typename BitUnion>
+void paramIn(Checkpoint *cp, const std::string &section,
+             const std::string &name,
+             BitfieldBackend::BitUnionOperators<DataType, BitUnion> &p)
+{
+    paramIn(cp, section, name, p.__data);
+}
+
 template <class T>
 bool optParamIn(Checkpoint *cp, const std::string &section,
              const std::string &name, T &param);
 
+template <typename DataType, typename BitUnion>
+bool optParamIn(Checkpoint *cp, const std::string &section,
+                const std::string &name,
+                BitfieldBackend::BitUnionOperators<DataType, BitUnion> &p)
+{
+    return optParamIn(cp, section, name, p.__data);
+}
+
 template <class T>
 void arrayParamOut(std::ostream &os, const std::string &name,
                    const T *param, unsigned size);
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to