gem5 v24.0.0.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 freePage () const
 
void setFreePage (Counter value)
 
Addr freePageAddr () 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 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 ()
 

Private Attributes

Addr pageShift = 0
 
Counter startPageNum = 0
 Start page of pool.
 
Counter freePageNum = 0
 Page number of free memory.
 
Counter _totalPages = 0
 The size of the pool, in number of pages.
 

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 45 of file mem_pool.hh.

Constructor & Destructor Documentation

◆ MemPool() [1/2]

gem5::MemPool::MemPool ( )
inlineprivate

Definition at line 59 of file mem_pool.hh.

◆ MemPool() [2/2]

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

Definition at line 40 of file mem_pool.cc.

References _totalPages, and gem5_assert.

Member Function Documentation

◆ allocate()

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

Definition at line 115 of file mem_pool.cc.

References fatal_if, freePageAddr(), freePageNum, and freePages().

◆ allocatedBytes()

Addr gem5::MemPool::allocatedBytes ( ) const

Definition at line 97 of file mem_pool.cc.

References allocatedPages(), and pageShift.

◆ allocatedPages()

Counter gem5::MemPool::allocatedPages ( ) const

Definition at line 79 of file mem_pool.cc.

References freePageNum, and startPageNum.

Referenced by allocatedBytes(), and freePages().

◆ freeBytes()

Addr gem5::MemPool::freeBytes ( ) const

Definition at line 103 of file mem_pool.cc.

References freePages(), and pageShift.

◆ freePage()

Counter gem5::MemPool::freePage ( ) const

Definition at line 55 of file mem_pool.cc.

References freePageNum.

◆ freePageAddr()

Addr gem5::MemPool::freePageAddr ( ) const

Definition at line 67 of file mem_pool.cc.

References freePageNum, and pageShift.

Referenced by allocate().

◆ freePages()

Counter gem5::MemPool::freePages ( ) const

Definition at line 85 of file mem_pool.cc.

References _totalPages, and allocatedPages().

Referenced by allocate(), 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 127 of file mem_pool.cc.

References _totalPages, freePageNum, pageShift, gem5::paramOut(), and startPageNum.

◆ setFreePage()

void gem5::MemPool::setFreePage ( Counter value)

Definition at line 61 of file mem_pool.cc.

References freePageNum.

◆ startAddr()

Addr gem5::MemPool::startAddr ( ) const

Definition at line 91 of file mem_pool.cc.

References pageShift, and startPage().

◆ startPage()

Counter gem5::MemPool::startPage ( ) const

Definition at line 49 of file mem_pool.cc.

References startPageNum.

Referenced by startAddr().

◆ totalBytes()

Addr gem5::MemPool::totalBytes ( ) const

Definition at line 109 of file mem_pool.cc.

References pageShift, and totalPages().

◆ totalPages()

Counter gem5::MemPool::totalPages ( ) const

Definition at line 73 of file mem_pool.cc.

References _totalPages.

Referenced by 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 136 of file mem_pool.cc.

References _totalPages, freePageNum, pageShift, gem5::paramIn(), and startPageNum.

Friends And Related Symbol Documentation

◆ MemPools

friend class MemPools
friend

Definition at line 61 of file mem_pool.hh.

Member Data Documentation

◆ _totalPages

Counter gem5::MemPool::_totalPages = 0
private

The size of the pool, in number of pages.

Definition at line 57 of file mem_pool.hh.

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

◆ freePageNum

Counter gem5::MemPool::freePageNum = 0
private

Page number of free memory.

Definition at line 54 of file mem_pool.hh.

Referenced by allocate(), allocatedPages(), freePage(), freePageAddr(), serialize(), setFreePage(), and unserialize().

◆ pageShift

Addr gem5::MemPool::pageShift = 0
private

◆ startPageNum

Counter gem5::MemPool::startPageNum = 0
private

Start page of pool.

Definition at line 51 of file mem_pool.hh.

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


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

Generated on Tue Jun 18 2024 16:24:12 for gem5 by doxygen 1.11.0