sim: Fix need to save address space info during serialization.
authorAustin Harris <austinharris@utexas.edu>
Mon, 20 Nov 2017 21:55:40 +0000 (15:55 -0600)
committerAustin Harris <austin.dane.harris@gmail.com>
Tue, 21 Nov 2017 16:35:54 +0000 (16:35 +0000)
This fixes a fatal already mapped error in
FuncPageTable::allocate that occurs in some cases
when restoring from a checkpoint.

Change-Id: Ib726a69358118626663e42b7f14889b0d3a98de0
Reported-by: Ruohuang Zheng <zhengruohuang@gmail.com>
Signed-off-by: Austin Harris <austinharris@utexas.edu>
Reviewed-on: https://gem5-review.googlesource.com/5901
Reviewed-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

src/sim/mem_state.hh
src/sim/process.cc

index 03a71975244734e3f0965390dcb93e4b22123f6c..ca07a64efb9ce2464f7f6a6d18502c70c9a2ed5d 100644 (file)
@@ -31,6 +31,8 @@
 #ifndef SRC_SIM_MEM_STATE_HH
 #define SRC_SIM_MEM_STATE_HH
 
+#include "sim/serialize.hh"
+
 /**
  * This class holds the memory state for the Process class and all of its
  * derived, architecture-specific children.
@@ -45,7 +47,7 @@
  * pointer interface because two process can potentially share their virtual
  * address space if certain options are passed into the clone(2).
  */
-class MemState
+class MemState : public Serializable
 {
   public:
     MemState(Addr brk_point, Addr stack_base, Addr max_stack_size,
@@ -87,6 +89,29 @@ class MemState
     void setNextThreadStackBase(Addr ntsb) { _nextThreadStackBase = ntsb; }
     void setMmapEnd(Addr mmap_end) { _mmapEnd = mmap_end; }
 
+    void
+    serialize(CheckpointOut &cp) const override
+    {
+        paramOut(cp, "brkPoint", _brkPoint);
+        paramOut(cp, "stackBase", _stackBase);
+        paramOut(cp, "stackSize", _stackSize);
+        paramOut(cp, "maxStackSize", _maxStackSize);
+        paramOut(cp, "stackMin", _stackMin);
+        paramOut(cp, "nextThreadStackBase", _nextThreadStackBase);
+        paramOut(cp, "mmapEnd", _mmapEnd);
+    }
+    void
+    unserialize(CheckpointIn &cp) override
+    {
+        paramIn(cp, "brkPoint", _brkPoint);
+        paramIn(cp, "stackBase", _stackBase);
+        paramIn(cp, "stackSize", _stackSize);
+        paramIn(cp, "maxStackSize", _maxStackSize);
+        paramIn(cp, "stackMin", _stackMin);
+        paramIn(cp, "nextThreadStackBase", _nextThreadStackBase);
+        paramIn(cp, "mmapEnd", _mmapEnd);
+    }
+
   private:
     Addr _brkPoint;
     Addr _stackBase;
index bfc52c36122b0cda4b4edf3d71a70cd5ad70a3ce..ee90667ffe46a407e55c96dd65a130ccf1af1bce 100644 (file)
@@ -367,6 +367,7 @@ Process::fixupStackFault(Addr vaddr)
 void
 Process::serialize(CheckpointOut &cp) const
 {
+    memState->serialize(cp);
     pTable->serialize(cp);
     /**
      * Checkpoints for file descriptors currently do not work. Need to
@@ -384,6 +385,7 @@ Process::serialize(CheckpointOut &cp) const
 void
 Process::unserialize(CheckpointIn &cp)
 {
+    memState->unserialize(cp);
     pTable->unserialize(cp);
     /**
      * Checkpoints for file descriptors currently do not work. Need to