From f064aa306061ecc468efd8cf148ed08398ca824d Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Tue, 17 Aug 2010 05:17:06 -0700 Subject: 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(). --- src/sim/process.hh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/sim/process.hh') diff --git a/src/sim/process.hh b/src/sim/process.hh index e73f93fa5..3b78cb001 100644 --- a/src/sim/process.hh +++ b/src/sim/process.hh @@ -79,8 +79,6 @@ class Process : public SimObject /// running on. System *system; - bool checkpointRestored; - // thread contexts associated with this process std::vector contextIds; @@ -130,8 +128,7 @@ class Process : public SimObject // constructor Process(ProcessParams * params); - // post initialization startup - virtual void startup(); + virtual void initState(); protected: /// Memory object for initialization (image loading) -- cgit v1.2.3