gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mem_state.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * Author: Brandon Potter
29  */
30 
31 #ifndef SRC_SIM_MEM_STATE_HH
32 #define SRC_SIM_MEM_STATE_HH
33 
34 #include "sim/serialize.hh"
35 
50 class MemState : public Serializable
51 {
52  public:
53  MemState(Addr brk_point, Addr stack_base, Addr max_stack_size,
54  Addr next_thread_stack_base, Addr mmap_end)
55  : _brkPoint(brk_point), _stackBase(stack_base), _stackSize(0),
56  _maxStackSize(max_stack_size), _stackMin(0),
57  _nextThreadStackBase(next_thread_stack_base), _mmapEnd(mmap_end)
58  { }
59 
60  MemState&
61  operator=(const MemState &in)
62  {
63  if (this == &in)
64  return *this;
65 
66  _brkPoint = in._brkPoint;
70  _stackMin = in._stackMin;
72  _mmapEnd = in._mmapEnd;
73  return *this;
74  }
75 
76  Addr getBrkPoint() const { return _brkPoint; }
77  Addr getStackBase() const { return _stackBase; }
78  Addr getStackSize() const { return _stackSize; }
79  Addr getMaxStackSize() const { return _maxStackSize; }
80  Addr getStackMin() const { return _stackMin; }
82  Addr getMmapEnd() const { return _mmapEnd; }
83 
84  void setBrkPoint(Addr brk_point) { _brkPoint = brk_point; }
85  void setStackBase(Addr stack_base) { _stackBase = stack_base; }
86  void setStackSize(Addr stack_size) { _stackSize = stack_size; }
87  void setMaxStackSize(Addr max_stack) { _maxStackSize = max_stack; }
88  void setStackMin(Addr stack_min) { _stackMin = stack_min; }
90  void setMmapEnd(Addr mmap_end) { _mmapEnd = mmap_end; }
91 
92  void
93  serialize(CheckpointOut &cp) const override
94  {
95  paramOut(cp, "brkPoint", _brkPoint);
96  paramOut(cp, "stackBase", _stackBase);
97  paramOut(cp, "stackSize", _stackSize);
98  paramOut(cp, "maxStackSize", _maxStackSize);
99  paramOut(cp, "stackMin", _stackMin);
100  paramOut(cp, "nextThreadStackBase", _nextThreadStackBase);
101  paramOut(cp, "mmapEnd", _mmapEnd);
102  }
103  void
105  {
106  paramIn(cp, "brkPoint", _brkPoint);
107  paramIn(cp, "stackBase", _stackBase);
108  paramIn(cp, "stackSize", _stackSize);
109  paramIn(cp, "maxStackSize", _maxStackSize);
110  paramIn(cp, "stackMin", _stackMin);
111  paramIn(cp, "nextThreadStackBase", _nextThreadStackBase);
112  paramIn(cp, "mmapEnd", _mmapEnd);
113  }
114 
115  private:
123 };
124 
125 #endif
Addr getBrkPoint() const
Definition: mem_state.hh:76
void setBrkPoint(Addr brk_point)
Definition: mem_state.hh:84
Addr getStackBase() const
Definition: mem_state.hh:77
Addr getMmapEnd() const
Definition: mem_state.hh:82
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: mem_state.hh:93
Addr _stackBase
Definition: mem_state.hh:117
void setMaxStackSize(Addr max_stack)
Definition: mem_state.hh:87
Definition: cprintf.cc:42
MemState & operator=(const MemState &in)
Definition: mem_state.hh:61
Addr _stackMin
Definition: mem_state.hh:120
void setStackBase(Addr stack_base)
Definition: mem_state.hh:85
Addr _stackSize
Definition: mem_state.hh:118
Addr getMaxStackSize() const
Definition: mem_state.hh:79
void setMmapEnd(Addr mmap_end)
Definition: mem_state.hh:90
Addr getStackMin() const
Definition: mem_state.hh:80
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: mem_state.hh:104
void paramOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst)
Definition: types.cc:40
Addr _nextThreadStackBase
Definition: mem_state.hh:121
Addr _brkPoint
Definition: mem_state.hh:116
Addr _mmapEnd
Definition: mem_state.hh:122
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
Basic support for object serialization.
Definition: serialize.hh:153
This class holds the memory state for the Process class and all of its derived, architecture-specific...
Definition: mem_state.hh:50
Addr getStackSize() const
Definition: mem_state.hh:78
Addr getNextThreadStackBase() const
Definition: mem_state.hh:81
void setNextThreadStackBase(Addr ntsb)
Definition: mem_state.hh:89
Addr _maxStackSize
Definition: mem_state.hh:119
std::ostream CheckpointOut
Definition: serialize.hh:68
void setStackMin(Addr stack_min)
Definition: mem_state.hh:88
void setStackSize(Addr stack_size)
Definition: mem_state.hh:86
void paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
Definition: types.cc:71
MemState(Addr brk_point, Addr stack_base, Addr max_stack_size, Addr next_thread_stack_base, Addr mmap_end)
Definition: mem_state.hh:53

Generated on Fri Feb 28 2020 16:27:03 for gem5 by doxygen 1.8.13