diff options
author | Steve Reinhardt <steve.reinhardt@amd.com> | 2010-08-17 05:17:06 -0700 |
---|---|---|
committer | Steve Reinhardt <steve.reinhardt@amd.com> | 2010-08-17 05:17:06 -0700 |
commit | f064aa306061ecc468efd8cf148ed08398ca824d (patch) | |
tree | d78548dc953bb621d9154249d07022dabf2f6e2c /src/arch/x86/linux | |
parent | 2519d116c9171ed4bf220d5049f244b333aa0842 (diff) | |
download | gem5-f064aa306061ecc468efd8cf148ed08398ca824d.tar.xz |
sim: revamp unserialization procedure
Replace direct call to unserialize() on each SimObject with a pair of
calls for better control over initialization in both ckpt and non-ckpt
cases.
If restoring from a checkpoint, loadState(ckpt) is called on each
SimObject. The default implementation simply calls unserialize() if
there is a corresponding checkpoint section, so we get backward
compatibility for existing objects. However, objects can override
loadState() to get other behaviors, e.g., doing other programmed
initializations after unserialize(), or complaining if no checkpoint
section is found. (Note that the default warning for a missing
checkpoint section is now gone.)
If not restoring from a checkpoint, we call the new initState() method
on each SimObject instead. This provides a hook for state
initializations that are only required when *not* restoring from a
checkpoint.
Given this new framework, do some cleanup of LiveProcess subclasses
and X86System, which were (in some cases) emulating initState()
behavior in startup via a local flag or (in other cases) erroneously
doing initializations in startup() that clobbered state loaded earlier
by unserialize().
Diffstat (limited to 'src/arch/x86/linux')
-rw-r--r-- | src/arch/x86/linux/system.cc | 4 | ||||
-rw-r--r-- | src/arch/x86/linux/system.hh | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/arch/x86/linux/system.cc b/src/arch/x86/linux/system.cc index 4ae6d0ca4..1a113d365 100644 --- a/src/arch/x86/linux/system.cc +++ b/src/arch/x86/linux/system.cc @@ -59,9 +59,9 @@ LinuxX86System::~LinuxX86System() } void -LinuxX86System::startup() +LinuxX86System::initState() { - X86System::startup(); + X86System::initState(); // The location of the real mode data structure. const Addr realModeData = 0x90200; diff --git a/src/arch/x86/linux/system.hh b/src/arch/x86/linux/system.hh index e3c52ae50..ae7e93f3d 100644 --- a/src/arch/x86/linux/system.hh +++ b/src/arch/x86/linux/system.hh @@ -58,7 +58,7 @@ class LinuxX86System : public X86System LinuxX86System(Params *p); ~LinuxX86System(); - void startup(); + void initState(); }; #endif |