summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-10-15 08:12:29 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-10-15 08:12:29 -0400
commitd7ad8dc608dd6de4ff9c930de79edcdc3bdf8d40 (patch)
treeade28cbaf338c105085fc9573356ff722354a720
parent0c58106b6e27445e259d82bb13e2a5b6ae991bb6 (diff)
downloadgem5-d7ad8dc608dd6de4ff9c930de79edcdc3bdf8d40.tar.xz
Checkpoint: Make system serialize call children
This patch changes how the serialization of the system works. The base class had a non-virtual serialize and unserialize, that was hidden by a function with the same name for a number of subclasses (most likely not intentional as the base class should have been virtual). A few of the derived systems had no specialization at all (e.g. Power and x86 that simply called the System::serialize), but MIPS and Alpha adds additional symbol table entries to the checkpoint. Instead of overriding the virtual function, the additional entries are now printed through a virtual function (un)serializeSymtab. The reason for not calling System::serialize from the two related systems is that a follow up patch will require the system to also serialize the PhysicalMemory, and if this is done in the base class if ends up being between the general parts and the specialized symbol table. With this patch, the checkpoint is not modified, as the order of the segments is unchanged.
-rw-r--r--src/arch/alpha/system.cc6
-rw-r--r--src/arch/alpha/system.hh4
-rwxr-xr-xsrc/arch/mips/system.cc13
-rwxr-xr-xsrc/arch/mips/system.hh5
-rw-r--r--src/arch/sparc/system.cc6
-rw-r--r--src/arch/sparc/system.hh4
-rw-r--r--src/arch/x86/system.cc13
-rw-r--r--src/arch/x86/system.hh2
-rw-r--r--src/sim/system.cc2
-rw-r--r--src/sim/system.hh20
10 files changed, 30 insertions, 45 deletions
diff --git a/src/arch/alpha/system.cc b/src/arch/alpha/system.cc
index ca3c2b078..f8e65015a 100644
--- a/src/arch/alpha/system.cc
+++ b/src/arch/alpha/system.cc
@@ -218,17 +218,15 @@ AlphaSystem::setAlphaAccess(Addr access)
}
void
-AlphaSystem::serialize(std::ostream &os)
+AlphaSystem::serializeSymtab(std::ostream &os)
{
- System::serialize(os);
consoleSymtab->serialize("console_symtab", os);
palSymtab->serialize("pal_symtab", os);
}
void
-AlphaSystem::unserialize(Checkpoint *cp, const std::string &section)
+AlphaSystem::unserializeSymtab(Checkpoint *cp, const std::string &section)
{
- System::unserialize(cp,section);
consoleSymtab->unserialize("console_symtab", cp, section);
palSymtab->unserialize("pal_symtab", cp, section);
}
diff --git a/src/arch/alpha/system.hh b/src/arch/alpha/system.hh
index 024d8bb47..bbf281c39 100644
--- a/src/arch/alpha/system.hh
+++ b/src/arch/alpha/system.hh
@@ -59,8 +59,8 @@ class AlphaSystem : public System
/**
* Serialization stuff
*/
- virtual void serialize(std::ostream &os);
- virtual void unserialize(Checkpoint *cp, const std::string &section);
+ virtual void serializeSymtab(std::ostream &os);
+ virtual void unserializeSymtab(Checkpoint *cp, const std::string &section);
/** Override startup() to provide a path to call setupFuncEvents()
*/
diff --git a/src/arch/mips/system.cc b/src/arch/mips/system.cc
index f0d4c250e..c6a043e46 100755
--- a/src/arch/mips/system.cc
+++ b/src/arch/mips/system.cc
@@ -67,19 +67,6 @@ MipsSystem::breakpoint()
return 0;
}
-void
-MipsSystem::serialize(std::ostream &os)
-{
- System::serialize(os);
-}
-
-
-void
-MipsSystem::unserialize(Checkpoint *cp, const std::string &section)
-{
- System::unserialize(cp,section);
-}
-
MipsSystem *
MipsSystemParams::create()
{
diff --git a/src/arch/mips/system.hh b/src/arch/mips/system.hh
index fcaceadcd..6b74ac1e5 100755
--- a/src/arch/mips/system.hh
+++ b/src/arch/mips/system.hh
@@ -55,11 +55,6 @@ class MipsSystem : public System
virtual bool breakpoint();
public:
- /**
- * Serialization stuff
- */
- virtual void serialize(std::ostream &os);
- virtual void unserialize(Checkpoint *cp, const std::string &section);
/**
* Set the m5MipsAccess pointer in the console
diff --git a/src/arch/sparc/system.cc b/src/arch/sparc/system.cc
index 9ce0a90de..0b36df9ca 100644
--- a/src/arch/sparc/system.cc
+++ b/src/arch/sparc/system.cc
@@ -177,9 +177,8 @@ SparcSystem::~SparcSystem()
}
void
-SparcSystem::serialize(std::ostream &os)
+SparcSystem::serializeSymtab(std::ostream &os)
{
- System::serialize(os);
resetSymtab->serialize("reset_symtab", os);
hypervisorSymtab->serialize("hypervisor_symtab", os);
openbootSymtab->serialize("openboot_symtab", os);
@@ -190,9 +189,8 @@ SparcSystem::serialize(std::ostream &os)
void
-SparcSystem::unserialize(Checkpoint *cp, const std::string &section)
+SparcSystem::unserializeSymtab(Checkpoint *cp, const std::string &section)
{
- System::unserialize(cp,section);
resetSymtab->unserialize("reset_symtab", cp, section);
hypervisorSymtab->unserialize("hypervisor_symtab", cp, section);
openbootSymtab->unserialize("openboot_symtab", cp, section);
diff --git a/src/arch/sparc/system.hh b/src/arch/sparc/system.hh
index 4b3da6287..a4bd64aa5 100644
--- a/src/arch/sparc/system.hh
+++ b/src/arch/sparc/system.hh
@@ -54,8 +54,8 @@ class SparcSystem : public System
* Serialization stuff
*/
public:
- virtual void serialize(std::ostream &os);
- virtual void unserialize(Checkpoint *cp, const std::string &section);
+ virtual void serializeSymtab(std::ostream &os);
+ virtual void unserializeSymtab(Checkpoint *cp, const std::string &section);
/** reset binary symbol table */
SymbolTable *resetSymtab;
diff --git a/src/arch/x86/system.cc b/src/arch/x86/system.cc
index 87fb61edc..f99ad43c7 100644
--- a/src/arch/x86/system.cc
+++ b/src/arch/x86/system.cc
@@ -388,19 +388,6 @@ X86System::~X86System()
delete smbiosTable;
}
-void
-X86System::serialize(std::ostream &os)
-{
- System::serialize(os);
-}
-
-
-void
-X86System::unserialize(Checkpoint *cp, const std::string &section)
-{
- System::unserialize(cp,section);
-}
-
X86System *
X86SystemParams::create()
{
diff --git a/src/arch/x86/system.hh b/src/arch/x86/system.hh
index 0b5da3145..998a69cd7 100644
--- a/src/arch/x86/system.hh
+++ b/src/arch/x86/system.hh
@@ -74,8 +74,6 @@ class X86System : public System
* Serialization stuff
*/
public:
- void serialize(std::ostream &os);
- void unserialize(Checkpoint *cp, const std::string &section);
void initState();
diff --git a/src/sim/system.cc b/src/sim/system.cc
index 4871ac824..65eb0e3eb 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -341,6 +341,7 @@ System::serialize(ostream &os)
kernelSymtab->serialize("kernel_symtab", os);
SERIALIZE_SCALAR(pagePtr);
SERIALIZE_SCALAR(nextPID);
+ serializeSymtab(os);
}
@@ -351,6 +352,7 @@ System::unserialize(Checkpoint *cp, const string &section)
kernelSymtab->unserialize("kernel_symtab", cp, section);
UNSERIALIZE_SCALAR(pagePtr);
UNSERIALIZE_SCALAR(nextPID);
+ unserializeSymtab(cp, section);
}
void
diff --git a/src/sim/system.hh b/src/sim/system.hh
index 4348ecaca..2393c83f2 100644
--- a/src/sim/system.hh
+++ b/src/sim/system.hh
@@ -403,6 +403,26 @@ class System : public MemObject
// For futex system call
std::map<uint64_t, std::list<ThreadContext *> * > futexMap;
+ protected:
+
+ /**
+ * If needed, serialize additional symbol table entries for a
+ * specific subclass of this sytem. Currently this is used by
+ * Alpha and MIPS.
+ *
+ * @param os stream to serialize to
+ */
+ virtual void serializeSymtab(std::ostream &os) {}
+
+ /**
+ * If needed, unserialize additional symbol table entries for a
+ * specific subclass of this system.
+ *
+ * @param cp checkpoint to unserialize from
+ * @param section relevant section in the checkpoint
+ */
+ virtual void unserializeSymtab(Checkpoint *cp,
+ const std::string &section) {}
};