diff options
author | Steve Reinhardt <stever@eecs.umich.edu> | 2003-10-28 12:55:12 -0800 |
---|---|---|
committer | Steve Reinhardt <stever@eecs.umich.edu> | 2003-10-28 12:55:12 -0800 |
commit | b90f810575679442d78c0e9cd0c98a057ba4871b (patch) | |
tree | 8882e14d0f8cbee6f7c630ecb2408b62974a32d2 /dev | |
parent | cec7f73abf841a65bdce38d6eb67a643e4879335 (diff) | |
download | gem5-b90f810575679442d78c0e9cd0c98a057ba4871b.tar.xz |
Revamp serialization to make it easier.
--HG--
extra : convert_revision : c57a538d7cf606dbdf5fa244f92da46bd830e335
Diffstat (limited to 'dev')
-rw-r--r-- | dev/alpha_access.h | 10 | ||||
-rw-r--r-- | dev/alpha_console.cc | 105 | ||||
-rw-r--r-- | dev/alpha_console.hh | 5 | ||||
-rw-r--r-- | dev/console.cc | 5 | ||||
-rw-r--r-- | dev/console.hh | 5 |
5 files changed, 63 insertions, 67 deletions
diff --git a/dev/alpha_access.h b/dev/alpha_access.h index ef33633e5..4bba39c4f 100644 --- a/dev/alpha_access.h +++ b/dev/alpha_access.h @@ -41,6 +41,11 @@ typedef uint64 UINT64; #else typedef uint32_t UINT32; typedef uint64_t UINT64; + +#include <ostream> +#include <string> +class IniFile; + #endif // This structure hacked up from simos @@ -74,6 +79,11 @@ struct AlphaAccess UINT64 bootStrapImpure; // 70: UINT32 bootStrapCPU; // 78: UINT32 align2; // 7C: Dummy placeholder for alignment + +#ifndef CONSOLE + void serialize(std::ostream &os); + void unserialize(IniFile &db, const std::string §ion); +#endif }; #endif // __ALPHA_ACCESS_H__ diff --git a/dev/alpha_console.cc b/dev/alpha_console.cc index cd03b3656..00dab4bad 100644 --- a/dev/alpha_console.cc +++ b/dev/alpha_console.cc @@ -166,70 +166,59 @@ AlphaConsole::write(MemReqPtr req, const uint8_t *data) } void -AlphaConsole::serialize() +AlphaAccess::serialize(ostream &os) { - nameOut(); - // assumes full AlphaAccess size - // might have unnecessary fields here - paramOut("last_offset",alphaAccess->last_offset); - paramOut("version",alphaAccess->version); - paramOut("numCPUs",alphaAccess->numCPUs); - paramOut("mem_size",alphaAccess->mem_size); - paramOut("cpuClock",alphaAccess->cpuClock); - paramOut("intrClockFrequency",alphaAccess->intrClockFrequency); - paramOut("kernStart",alphaAccess->kernStart); - paramOut("kernEnd",alphaAccess->kernEnd); - paramOut("entryPoint",alphaAccess->entryPoint); - paramOut("diskUnit",alphaAccess->diskUnit); - paramOut("diskCount",alphaAccess->diskCount); - paramOut("diskPAddr",alphaAccess->diskPAddr); - paramOut("diskBlock",alphaAccess->diskBlock); - paramOut("diskOperation",alphaAccess->diskOperation); - paramOut("outputChar",alphaAccess->outputChar); - paramOut("bootStrapImpure",alphaAccess->bootStrapImpure); - paramOut("bootStrapCPU",alphaAccess->bootStrapCPU); + SERIALIZE_MEMBER(last_offset); + SERIALIZE_MEMBER(version); + SERIALIZE_MEMBER(numCPUs); + SERIALIZE_MEMBER(mem_size); + SERIALIZE_MEMBER(cpuClock); + SERIALIZE_MEMBER(intrClockFrequency); + SERIALIZE_MEMBER(kernStart); + SERIALIZE_MEMBER(kernEnd); + SERIALIZE_MEMBER(entryPoint); + SERIALIZE_MEMBER(diskUnit); + SERIALIZE_MEMBER(diskCount); + SERIALIZE_MEMBER(diskPAddr); + SERIALIZE_MEMBER(diskBlock); + SERIALIZE_MEMBER(diskOperation); + SERIALIZE_MEMBER(outputChar); + SERIALIZE_MEMBER(bootStrapImpure); + SERIALIZE_MEMBER(bootStrapCPU); } void -AlphaConsole::unserialize(IniFile &db, const std::string &category, - ConfigNode *node) +AlphaAccess::unserialize(IniFile &db, const std::string §ion) { - string data; - db.findDefault(category,"last_offset",data); - to_number(data,alphaAccess->last_offset); - db.findDefault(category,"version",data); - to_number(data,alphaAccess->version); - db.findDefault(category,"numCPUs",data); - to_number(data,alphaAccess->numCPUs); - db.findDefault(category,"mem_size",data); - to_number(data,alphaAccess->mem_size); - db.findDefault(category,"cpuClock",data); - to_number(data,alphaAccess->cpuClock); - db.findDefault(category,"intrClockFrequency",data); - to_number(data,alphaAccess->intrClockFrequency); - db.findDefault(category,"kernStart",data); - to_number(data,alphaAccess->kernStart); - db.findDefault(category,"kernEnd",data); - to_number(data,alphaAccess->kernEnd); - db.findDefault(category,"entryPoint",data); - to_number(data,alphaAccess->entryPoint); - db.findDefault(category,"diskUnit",data); - to_number(data,alphaAccess->diskUnit); - db.findDefault(category,"diskCount",data); - to_number(data,alphaAccess->diskCount); - db.findDefault(category,"diskPAddr",data); - to_number(data,alphaAccess->diskPAddr); - db.findDefault(category,"diskBlock",data); - to_number(data,alphaAccess->diskBlock); - db.findDefault(category,"diskOperation",data); - to_number(data,alphaAccess->diskOperation); - db.findDefault(category,"outputChar",data); - to_number(data,alphaAccess->outputChar); - db.findDefault(category,"bootStrapImpure",data); - to_number(data,alphaAccess->bootStrapImpure); - db.findDefault(category,"bootStrapCPU",data); - to_number(data,alphaAccess->bootStrapCPU); + UNSERIALIZE_MEMBER(last_offset); + UNSERIALIZE_MEMBER(version); + UNSERIALIZE_MEMBER(numCPUs); + UNSERIALIZE_MEMBER(mem_size); + UNSERIALIZE_MEMBER(cpuClock); + UNSERIALIZE_MEMBER(intrClockFrequency); + UNSERIALIZE_MEMBER(kernStart); + UNSERIALIZE_MEMBER(kernEnd); + UNSERIALIZE_MEMBER(entryPoint); + UNSERIALIZE_MEMBER(diskUnit); + UNSERIALIZE_MEMBER(diskCount); + UNSERIALIZE_MEMBER(diskPAddr); + UNSERIALIZE_MEMBER(diskBlock); + UNSERIALIZE_MEMBER(diskOperation); + UNSERIALIZE_MEMBER(outputChar); + UNSERIALIZE_MEMBER(bootStrapImpure); + UNSERIALIZE_MEMBER(bootStrapCPU); +} +void +AlphaConsole::serialize(ostream &os) +{ + alphaAccess->serialize(os); +} + +void +AlphaConsole::unserialize(IniFile &db, const std::string §ion) +{ + alphaAccess->unserialize(db, section); } BEGIN_DECLARE_SIM_OBJECT_PARAMS(AlphaConsole) diff --git a/dev/alpha_console.hh b/dev/alpha_console.hh index 608e6ac00..caa571cec 100644 --- a/dev/alpha_console.hh +++ b/dev/alpha_console.hh @@ -100,9 +100,8 @@ class AlphaConsole : public MmapDevice /** * standard serialization routines for checkpointing */ - virtual void serialize(); - virtual void unserialize(IniFile &db, const std::string &category, - ConfigNode *node); + virtual void serialize(std::ostream &os); + virtual void unserialize(IniFile &db, const std::string §ion); }; #endif // __ALPHA_CONSOLE_HH__ diff --git a/dev/console.cc b/dev/console.cc index 168907417..a84f4a666 100644 --- a/dev/console.cc +++ b/dev/console.cc @@ -314,14 +314,13 @@ SimConsole::setInt(int bits) void -SimConsole::serialize() +SimConsole::serialize(ostream &os) { panic("Unimplemented"); } void -SimConsole::unserialize(IniFile &db, const std::string &category, - ConfigNode *node) +SimConsole::unserialize(IniFile &db, const std::string §ion) { panic("Unimplemented"); } diff --git a/dev/console.hh b/dev/console.hh index b88cab3ef..5d9ea5302 100644 --- a/dev/console.hh +++ b/dev/console.hh @@ -128,9 +128,8 @@ class SimConsole : public SimObject void initInt(IntrControl *i); void setInt(int bits); - virtual void serialize(); - virtual void unserialize(IniFile &db, const std::string &category, - ConfigNode *node); + virtual void serialize(std::ostream &os); + virtual void unserialize(IniFile &db, const std::string §ion); }; class ConsoleListener : public SimObject |