29#ifndef SRC_SIM_MEM_STATE_HH
30#define SRC_SIM_MEM_STATE_HH
40#include "debug/Vma.hh"
71 Addr max_stack_size,
Addr next_thread_stack_base,
131 const std::string&
name=
"anon",
int sim_fd=-1,
205 if (
vma.hasHostBuf()) {
206 paramOut(cp,
"fileOffset",
vma.getFileMappingOffset());
236 host_fd = open(
name.c_str(), O_RDONLY);
238 "Failed to open %s file "
239 "while unserializing file-backed VMA\n",
name);
241 paramIn(cp,
"addrRangeStart", start);
242 paramIn(cp,
"addrRangeEnd", end);
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
This class holds the memory state for the Process class and all of its derived, architecture-specific...
std::list< VMA > _vmaList
The _vmaList member is a list of virtual memory areas in the target application space that have been ...
Addr getBrkPoint() const
Get/set base addresses and sizes for the stack and data segments of the process' memory.
Process * _ownerProcess
Owner process of MemState.
void setMmapEnd(Addr mmap_end)
Addr extendMmap(Addr length)
Addr getMaxStackSize() const
void setStackSize(Addr stack_size)
bool fixupFault(Addr vaddr)
Attempt to fix up a fault at vaddr by allocating a page.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void setNextThreadStackBase(Addr ntsb)
void replicatePage(const MemState &in, Addr vaddr, Addr new_paddr, bool alloc_page)
Addr _nextThreadStackBase
void setStackBase(Addr stack_base)
void updateBrkRegion(Addr old_brk, Addr new_brk)
Change the end of a process' program break.
Addr getStackSize() const
void setBrkPoint(Addr brk_point)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
std::string printVmaList()
Print the list of VMAs in a format similar to /proc/self/maps.
void setMaxStackSize(Addr max_stack)
bool isUnmapped(Addr start_addr, Addr length)
Check if any page in the virtual address range from start_addr to start_addr + length is already mapp...
void resetOwner(Process *owner)
Change the Process owner in case this MemState is copied.
void allocateMem(Addr vaddr, int64_t size, bool clobber=false)
Given the vaddr and size, this method will chunk the allocation into page granularity and then reques...
Addr getStackBase() const
MemState & operator=(const MemState &in)
Addr getNextThreadStackBase() const
MemState(Process *owner, Addr brk_point, Addr stack_base, Addr max_stack_size, Addr next_thread_stack_base, Addr mmap_end)
void unmapRegion(Addr start_addr, Addr length)
Unmap a pre-existing region.
void remapRegion(Addr start_addr, Addr new_start_addr, Addr length)
Remap a pre-existing region.
void mapRegion(Addr start_addr, Addr length, const std::string &name="anon", int sim_fd=-1, Addr offset=0)
Add a new memory region.
void setStackMin(Addr stack_min)
Basic support for object serialization.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
bool optParamIn(CheckpointIn &cp, const std::string &name, T ¶m, bool do_warn=true)
This function is used for restoring optional parameters from the checkpoint.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
void paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
std::string csprintf(const char *format, const Args &...args)
Declarations of a non-full system Page Table.
const std::string & name()