summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Harris <austinharris@utexas.edu>2017-11-20 15:55:40 -0600
committerAustin Harris <austin.dane.harris@gmail.com>2017-11-21 16:35:54 +0000
commit00232a868e4816d19c129fb3d6ef5519d7176d5a (patch)
tree7af8719efedfd729f4db9005b8da653623e776f9
parent03b231eb48a9d37c39a7ac8a95cb0c0fc7dae641 (diff)
downloadgem5-00232a868e4816d19c129fb3d6ef5519d7176d5a.tar.xz
sim: Fix need to save address space info during serialization.
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>
-rw-r--r--src/sim/mem_state.hh27
-rw-r--r--src/sim/process.cc2
2 files changed, 28 insertions, 1 deletions
diff --git a/src/sim/mem_state.hh b/src/sim/mem_state.hh
index 03a719752..ca07a64ef 100644
--- a/src/sim/mem_state.hh
+++ b/src/sim/mem_state.hh
@@ -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;
diff --git a/src/sim/process.cc b/src/sim/process.cc
index bfc52c361..ee90667ff 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -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