98 const std::optional<Addr> page =
freePhysPages.allocate(npages);
100 fatal(
"Out of memory, please increase size of physical memory.");
138 warn(
"Checkpoint contains legacy MemPool state (free_page_num)\n");
144 for (
int i = 0;
i <
n; ++
i) {
158 for (
const auto &
mem : memories)
165 return pools[pool_id].allocate(npages);
171 pools[pool_id].deallocate(page_addr, npages);
177 return pools[pool_id].totalBytes();
183 return pools[pool_id].freeBytes();
190 int num_pools =
pools.size();
193 for (
int i = 0;
i < num_pools;
i++)
207 for (
int i = 0;
i < num_pools;
i++) {
210 pools.push_back(pool);
Class for handling allocation of physical pages in SE mode.
FreeList< Addr > freePhysPages
Counter totalPages() const
void serialize(CheckpointOut &cp) const override
Serialize an object.
Counter _totalPages
The size of the pool, in number of pages.
Counter allocatedPages() const
void deallocate(Addr start, Addr npages)
Counter startPageNum
Start page of pool.
Addr allocatedBytes() const
Counter startPage() const
Addr allocate(Addr npages)
Counter freePages() const
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Addr allocPhysPages(int npages, int pool_id=0)
Allocate npages contiguous unused physical pages.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void populate(const AddrRangeList &memories)
Addr freeMemSize(int pool_id=0) const
Amount of physical memory that is still free in a pool.
std::vector< MemPool > pools
Addr memSize(int pool_id=0) const
Amount of physical memory that exists in a pool.
void deallocPhysPages(Addr page_addr, int npages, int pool_id=0)
Deallocate physical pages.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
#define fatal(...)
This implements a cprintf based fatal() function.
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.
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
BitfieldType< SegDescriptorLimit > limit
double Counter
All counters are of 64-bit values.
Copyright (c) 2024 Arm Limited 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)
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)