From 00232a868e4816d19c129fb3d6ef5519d7176d5a Mon Sep 17 00:00:00 2001 From: Austin Harris Date: Mon, 20 Nov 2017 15:55:40 -0600 Subject: [PATCH] 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 Signed-off-by: Austin Harris Reviewed-on: https://gem5-review.googlesource.com/5901 Reviewed-by: Gabe Black Reviewed-by: Andreas Sandberg Maintainer: Jason Lowe-Power --- src/sim/mem_state.hh | 27 ++++++++++++++++++++++++++- src/sim/process.cc | 2 ++ 2 files changed, 28 insertions(+), 1 deletion(-) 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 -- 2.30.2