changeset e57c7d9736a5 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=e57c7d9736a5
description:
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.
diffstat:
src/arch/alpha/system.cc | 6 ++----
src/arch/alpha/system.hh | 4 ++--
src/arch/mips/system.cc | 13 -------------
src/arch/mips/system.hh | 5 -----
src/arch/sparc/system.cc | 6 ++----
src/arch/sparc/system.hh | 4 ++--
src/arch/x86/system.cc | 13 -------------
src/arch/x86/system.hh | 2 --
src/sim/system.cc | 2 ++
src/sim/system.hh | 20 ++++++++++++++++++++
10 files changed, 30 insertions(+), 45 deletions(-)
diffs (198 lines):
diff -r b27d3e9a333f -r e57c7d9736a5 src/arch/alpha/system.cc
--- a/src/arch/alpha/system.cc Mon Oct 15 08:12:25 2012 -0400
+++ b/src/arch/alpha/system.cc Mon Oct 15 08:12:29 2012 -0400
@@ -218,17 +218,15 @@
}
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 §ion)
+AlphaSystem::unserializeSymtab(Checkpoint *cp, const std::string §ion)
{
- System::unserialize(cp,section);
consoleSymtab->unserialize("console_symtab", cp, section);
palSymtab->unserialize("pal_symtab", cp, section);
}
diff -r b27d3e9a333f -r e57c7d9736a5 src/arch/alpha/system.hh
--- a/src/arch/alpha/system.hh Mon Oct 15 08:12:25 2012 -0400
+++ b/src/arch/alpha/system.hh Mon Oct 15 08:12:29 2012 -0400
@@ -59,8 +59,8 @@
/**
* Serialization stuff
*/
- virtual void serialize(std::ostream &os);
- virtual void unserialize(Checkpoint *cp, const std::string §ion);
+ virtual void serializeSymtab(std::ostream &os);
+ virtual void unserializeSymtab(Checkpoint *cp, const std::string §ion);
/** Override startup() to provide a path to call setupFuncEvents()
*/
diff -r b27d3e9a333f -r e57c7d9736a5 src/arch/mips/system.cc
--- a/src/arch/mips/system.cc Mon Oct 15 08:12:25 2012 -0400
+++ b/src/arch/mips/system.cc Mon Oct 15 08:12:29 2012 -0400
@@ -67,19 +67,6 @@
return 0;
}
-void
-MipsSystem::serialize(std::ostream &os)
-{
- System::serialize(os);
-}
-
-
-void
-MipsSystem::unserialize(Checkpoint *cp, const std::string §ion)
-{
- System::unserialize(cp,section);
-}
-
MipsSystem *
MipsSystemParams::create()
{
diff -r b27d3e9a333f -r e57c7d9736a5 src/arch/mips/system.hh
--- a/src/arch/mips/system.hh Mon Oct 15 08:12:25 2012 -0400
+++ b/src/arch/mips/system.hh Mon Oct 15 08:12:29 2012 -0400
@@ -55,11 +55,6 @@
virtual bool breakpoint();
public:
- /**
- * Serialization stuff
- */
- virtual void serialize(std::ostream &os);
- virtual void unserialize(Checkpoint *cp, const std::string §ion);
/**
* Set the m5MipsAccess pointer in the console
diff -r b27d3e9a333f -r e57c7d9736a5 src/arch/sparc/system.cc
--- a/src/arch/sparc/system.cc Mon Oct 15 08:12:25 2012 -0400
+++ b/src/arch/sparc/system.cc Mon Oct 15 08:12:29 2012 -0400
@@ -177,9 +177,8 @@
}
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 @@
void
-SparcSystem::unserialize(Checkpoint *cp, const std::string §ion)
+SparcSystem::unserializeSymtab(Checkpoint *cp, const std::string §ion)
{
- System::unserialize(cp,section);
resetSymtab->unserialize("reset_symtab", cp, section);
hypervisorSymtab->unserialize("hypervisor_symtab", cp, section);
openbootSymtab->unserialize("openboot_symtab", cp, section);
diff -r b27d3e9a333f -r e57c7d9736a5 src/arch/sparc/system.hh
--- a/src/arch/sparc/system.hh Mon Oct 15 08:12:25 2012 -0400
+++ b/src/arch/sparc/system.hh Mon Oct 15 08:12:29 2012 -0400
@@ -54,8 +54,8 @@
* Serialization stuff
*/
public:
- virtual void serialize(std::ostream &os);
- virtual void unserialize(Checkpoint *cp, const std::string §ion);
+ virtual void serializeSymtab(std::ostream &os);
+ virtual void unserializeSymtab(Checkpoint *cp, const std::string §ion);
/** reset binary symbol table */
SymbolTable *resetSymtab;
diff -r b27d3e9a333f -r e57c7d9736a5 src/arch/x86/system.cc
--- a/src/arch/x86/system.cc Mon Oct 15 08:12:25 2012 -0400
+++ b/src/arch/x86/system.cc Mon Oct 15 08:12:29 2012 -0400
@@ -388,19 +388,6 @@
delete smbiosTable;
}
-void
-X86System::serialize(std::ostream &os)
-{
- System::serialize(os);
-}
-
-
-void
-X86System::unserialize(Checkpoint *cp, const std::string §ion)
-{
- System::unserialize(cp,section);
-}
-
X86System *
X86SystemParams::create()
{
diff -r b27d3e9a333f -r e57c7d9736a5 src/arch/x86/system.hh
--- a/src/arch/x86/system.hh Mon Oct 15 08:12:25 2012 -0400
+++ b/src/arch/x86/system.hh Mon Oct 15 08:12:29 2012 -0400
@@ -74,8 +74,6 @@
* Serialization stuff
*/
public:
- void serialize(std::ostream &os);
- void unserialize(Checkpoint *cp, const std::string §ion);
void initState();
diff -r b27d3e9a333f -r e57c7d9736a5 src/sim/system.cc
--- a/src/sim/system.cc Mon Oct 15 08:12:25 2012 -0400
+++ b/src/sim/system.cc Mon Oct 15 08:12:29 2012 -0400
@@ -341,6 +341,7 @@
kernelSymtab->serialize("kernel_symtab", os);
SERIALIZE_SCALAR(pagePtr);
SERIALIZE_SCALAR(nextPID);
+ serializeSymtab(os);
}
@@ -351,6 +352,7 @@
kernelSymtab->unserialize("kernel_symtab", cp, section);
UNSERIALIZE_SCALAR(pagePtr);
UNSERIALIZE_SCALAR(nextPID);
+ unserializeSymtab(cp, section);
}
void
diff -r b27d3e9a333f -r e57c7d9736a5 src/sim/system.hh
--- a/src/sim/system.hh Mon Oct 15 08:12:25 2012 -0400
+++ b/src/sim/system.hh Mon Oct 15 08:12:29 2012 -0400
@@ -403,6 +403,26 @@
// 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 §ion) {}
};
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev