gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
gem5::MemPool Class Reference

Class for handling allocation of physical pages in SE mode. More...

#include <mem_pool.hh>

Inheritance diagram for gem5::MemPool:
gem5::Serializable

Public Member Functions

 MemPool (Addr page_shift, Addr ptr, Addr limit)
 
Counter startPage () const
 
Counter totalPages () const
 
Counter allocatedPages () const
 
Counter freePages () const
 
Addr startAddr () const
 
Addr allocatedBytes () const
 
Addr freeBytes () const
 
Addr totalBytes () const
 
Addr allocate (Addr npages)
 
void deallocate (Addr start, Addr npages)
 
void serialize (CheckpointOut &cp) const override
 Serialize an object.
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object.
 
- Public Member Functions inherited from gem5::Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section.
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object.
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 

Private Member Functions

 MemPool ()=default
 

Private Attributes

Addr pageShift = 0
 
Counter startPageNum = 0
 Start page of pool.
 
Counter _totalPages = 0
 The size of the pool, in number of pages.
 
FreeList< AddrfreePhysPages
 

Friends

class MemPools
 

Additional Inherited Members

- Static Public Member Functions inherited from gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section.
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it.
 

Detailed Description

Class for handling allocation of physical pages in SE mode.

Definition at line 46 of file mem_pool.hh.

Constructor & Destructor Documentation

◆ MemPool() [1/2]

gem5::MemPool::MemPool ( )
privatedefault

◆ MemPool() [2/2]

gem5::MemPool::MemPool ( Addr page_shift,
Addr ptr,
Addr limit )

Definition at line 40 of file mem_pool.cc.

References _totalPages, freePhysPages, gem5::X86ISA::limit, pageShift, and startPageNum.

Member Function Documentation

◆ allocate()

Addr gem5::MemPool::allocate ( Addr npages)

Definition at line 96 of file mem_pool.cc.

References fatal, freePhysPages, and pageShift.

◆ allocatedBytes()

Addr gem5::MemPool::allocatedBytes ( ) const

Definition at line 78 of file mem_pool.cc.

References allocatedPages(), and pageShift.

◆ allocatedPages()

Counter gem5::MemPool::allocatedPages ( ) const

Definition at line 60 of file mem_pool.cc.

References freePages(), and totalPages().

Referenced by allocatedBytes().

◆ deallocate()

void gem5::MemPool::deallocate ( Addr start,
Addr npages )

Definition at line 105 of file mem_pool.cc.

References freePhysPages, and pageShift.

◆ freeBytes()

Addr gem5::MemPool::freeBytes ( ) const

Definition at line 84 of file mem_pool.cc.

References freePages(), and pageShift.

◆ freePages()

Counter gem5::MemPool::freePages ( ) const

Definition at line 66 of file mem_pool.cc.

References freePhysPages.

Referenced by allocatedPages(), and freeBytes().

◆ serialize()

void gem5::MemPool::serialize ( CheckpointOut & cp) const
overridevirtual

Serialize an object.

Output an object's state into the current checkpoint section.

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 111 of file mem_pool.cc.

References _totalPages, gem5::csprintf(), freePhysPages, gem5::ArmISA::i, pageShift, gem5::paramOut(), and startPageNum.

◆ startAddr()

Addr gem5::MemPool::startAddr ( ) const

Definition at line 72 of file mem_pool.cc.

References pageShift, and startPage().

◆ startPage()

Counter gem5::MemPool::startPage ( ) const

Definition at line 48 of file mem_pool.cc.

References startPageNum.

Referenced by startAddr().

◆ totalBytes()

Addr gem5::MemPool::totalBytes ( ) const

Definition at line 90 of file mem_pool.cc.

References pageShift, and totalPages().

◆ totalPages()

Counter gem5::MemPool::totalPages ( ) const

Definition at line 54 of file mem_pool.cc.

References _totalPages.

Referenced by allocatedPages(), and totalBytes().

◆ unserialize()

void gem5::MemPool::unserialize ( CheckpointIn & cp)
overridevirtual

Unserialize an object.

Read an object's state from the current checkpoint section.

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 128 of file mem_pool.cc.

References _totalPages, gem5::RiscvISA::base, gem5::csprintf(), freePhysPages, gem5::ArmISA::i, gem5::ArmISA::n, gem5::optParamIn(), pageShift, gem5::paramIn(), startPageNum, and warn.

Friends And Related Symbol Documentation

◆ MemPools

friend class MemPools
friend

Definition at line 61 of file mem_pool.hh.

References gem5::X86ISA::limit, and MemPools.

Referenced by MemPools.

Member Data Documentation

◆ _totalPages

Counter gem5::MemPool::_totalPages = 0
private

The size of the pool, in number of pages.

Definition at line 55 of file mem_pool.hh.

Referenced by MemPool(), serialize(), totalPages(), and unserialize().

◆ freePhysPages

FreeList<Addr> gem5::MemPool::freePhysPages
private

Definition at line 57 of file mem_pool.hh.

Referenced by allocate(), deallocate(), freePages(), MemPool(), serialize(), and unserialize().

◆ pageShift

Addr gem5::MemPool::pageShift = 0
private

◆ startPageNum

Counter gem5::MemPool::startPageNum = 0
private

Start page of pool.

Definition at line 52 of file mem_pool.hh.

Referenced by MemPool(), serialize(), startPage(), and unserialize().


The documentation for this class was generated from the following files:

Generated on Mon May 26 2025 09:19:22 for gem5 by doxygen 1.13.2