diff options
author | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2014-10-16 05:49:37 -0400 |
---|---|---|
committer | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2014-10-16 05:49:37 -0400 |
commit | 804ed4b4186b93071fe6e8ba8e491a44cb7b0c45 (patch) | |
tree | e9a7c3c808c556e352c3b682f28eef5d2bfeed66 /src/sim | |
parent | 66df7b7fd4c471cb71e77fa78902d354a3521174 (diff) | |
download | gem5-804ed4b4186b93071fe6e8ba8e491a44cb7b0c45.tar.xz |
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 (limited to 'src/sim')
-rw-r--r-- | src/sim/serialize.hh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh index 18efa2a26..e9de6f713 100644 --- a/src/sim/serialize.hh +++ b/src/sim/serialize.hh @@ -43,6 +43,7 @@ #include <map> #include <vector> +#include "base/bitunion.hh" #include "base/types.hh" class IniFile; @@ -63,14 +64,37 @@ static const uint64_t gem5CheckpointVersion = 0x000000000000000d; template <class T> void paramOut(std::ostream &os, const std::string &name, const T ¶m); +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 §ion, const std::string &name, T ¶m); +template <typename DataType, typename BitUnion> +void paramIn(Checkpoint *cp, const std::string §ion, + 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 §ion, const std::string &name, T ¶m); +template <typename DataType, typename BitUnion> +bool optParamIn(Checkpoint *cp, const std::string §ion, + 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); |