From: Andreas Sandberg Date: Thu, 16 Oct 2014 09:49:37 +0000 (-0400) Subject: sim: Add support for serializing BitUnionXX X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=804ed4b4186b93071fe6e8ba8e491a44cb7b0c45;p=gem5.git 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. --- 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 #include +#include "base/bitunion.hh" #include "base/types.hh" class IniFile; @@ -63,14 +64,37 @@ static const uint64_t gem5CheckpointVersion = 0x000000000000000d; template void paramOut(std::ostream &os, const std::string &name, const T ¶m); +template +void paramOut(std::ostream &os, const std::string &name, + const BitfieldBackend::BitUnionOperators &p) +{ + paramOut(os, name, p.__data); +} + template void paramIn(Checkpoint *cp, const std::string §ion, const std::string &name, T ¶m); +template +void paramIn(Checkpoint *cp, const std::string §ion, + const std::string &name, + BitfieldBackend::BitUnionOperators &p) +{ + paramIn(cp, section, name, p.__data); +} + template bool optParamIn(Checkpoint *cp, const std::string §ion, const std::string &name, T ¶m); +template +bool optParamIn(Checkpoint *cp, const std::string §ion, + const std::string &name, + BitfieldBackend::BitUnionOperators &p) +{ + return optParamIn(cp, section, name, p.__data); +} + template void arrayParamOut(std::ostream &os, const std::string &name, const T *param, unsigned size);