The Pedigree Project 0.1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Arm64PhysicalMemoryManager Class Referencefinal
+ Inheritance diagram for Arm64PhysicalMemoryManager:
+ Collaboration diagram for Arm64PhysicalMemoryManager:

Public Member Functions

void initialise (const BootstrapStruct_t &info)
 
physical_uintptr_t allocatePage (size_t constraints=0) override
 
physical_uintptr_t tryAllocatePage () override
 
void freePage (physical_uintptr_t page) override
 
void pin (physical_uintptr_t page) override
 
bool copyPhysicalPageToBuffer (physical_uintptr_t page, void *buffer) override
 
bool copyPhysicalPageFromBuffer (physical_uintptr_t page, const void *buffer) override
 
MemorySnapshot memorySnapshot () const override
 
size_t freePageCount () const override
 
bool allocateRegion (MemoryRegion &region, size_t pages, size_t constraints, size_t flags, physical_uintptr_t start=-1) override
 
- Public Member Functions inherited from PhysicalMemoryManager
void allocateMemoryRegionList (Vector< MemoryRegionInfo * > &MemoryRegions)
 
void freeMemoryRegionList (Vector< MemoryRegionInfo * > &MemoryRegions)
 

Static Public Member Functions

static Arm64PhysicalMemoryManagerinstance ()
 
- Static Public Member Functions inherited from PhysicalMemoryManager
static PhysicalMemoryManagerinstance ()
 
static constexpr size_t getPageSize () PURE
 

Private Member Functions

void freePageUnlocked (physical_uintptr_t page) override
 
void unmapRegion (MemoryRegion *region) override
 
bool pageAvailable (size_t page) const
 
void markPage (size_t page, bool available)
 
size_t pageLimit (size_t constraints) const
 
physical_uintptr_t allocatePageUnlocked (size_t constraints)
 
physical_uintptr_t allocateContinuousPagesUnlocked (size_t pages, size_t constraints)
 

Private Attributes

Spinlock m_Lock
 
Spinlock m_RegionLock
 
uint16_t * m_References
 
uint8_t * m_FreeBitmap
 
size_t m_MaxPage
 
size_t m_NextPage
 
size_t m_TotalPages
 
size_t m_FreePages
 
uintptr_t m_NextRegion
 

Additional Inherited Members

- Static Public Attributes inherited from PhysicalMemoryManager
static const size_t continuous = 1 << 0
 
static const size_t nonRamMemory = 1 << 1
 
static const size_t force = 1 << 2
 
static const size_t virtualOnly = 1 << 3
 
static const size_t below1MB = 1 << 4
 
static const size_t below16MB = 1 << 5
 
static const size_t below4GB = 1 << 6
 
static const size_t below64GB = 1 << 7
 
static const size_t addressConstraints = below1MB | below16MB | below4GB | below64GB
 
static const size_t anonymous = 1 << 8
 
- Protected Member Functions inherited from PhysicalMemoryManager
 PhysicalMemoryManager ()
 
virtual ~PhysicalMemoryManager ()
 
- Protected Attributes inherited from PhysicalMemoryManager
Vector< MemoryRegion * > m_MemoryRegions
 

Detailed Description

Definition at line 11 of file kernel/core/processor/arm64/PhysicalMemoryManager.h.

Constructor & Destructor Documentation

◆ Arm64PhysicalMemoryManager()

Arm64PhysicalMemoryManager::Arm64PhysicalMemoryManager ( )
private

Definition at line 18 of file arm64/PhysicalMemoryManager.cc.

Member Function Documentation

◆ allocateContinuousPagesUnlocked()

physical_uintptr_t Arm64PhysicalMemoryManager::allocateContinuousPagesUnlocked ( size_t  pages,
size_t  constraints 
)
private

Definition at line 157 of file arm64/PhysicalMemoryManager.cc.

◆ allocatePage()

physical_uintptr_t Arm64PhysicalMemoryManager::allocatePage ( size_t  pageConstraints = 0)
overridevirtual

Allocate a single page with optional constraints.

Returns
physical address of the page or 0 if no page available.

Implements PhysicalMemoryManager.

Definition at line 185 of file arm64/PhysicalMemoryManager.cc.

References panic().

◆ allocatePageUnlocked()

physical_uintptr_t Arm64PhysicalMemoryManager::allocatePageUnlocked ( size_t  constraints)
private

Definition at line 132 of file arm64/PhysicalMemoryManager.cc.

◆ allocateRegion()

bool Arm64PhysicalMemoryManager::allocateRegion ( MemoryRegion Region,
size_t  cPages,
size_t  pageConstraints,
size_t  Flags,
physical_uintptr_t  start = -1 
)
overridevirtual

Allocate a memory-region with specific constraints the pages need to fullfill.

Parameters
[in]Regionreference to the MemoryRegion object
[in]cPagesthe number of pages to allocate for the MemoryRegion object
[in]pageConstraintsthe constraints the pages have to fullfill
[in]Flagsflags from the VirtualAddressSpace class namespace
[in]startthe physical address of the beginning of the region (optional)
Returns
true, if a valid MemoryRegion object is created, false otherwise

Implements PhysicalMemoryManager.

Definition at line 257 of file arm64/PhysicalMemoryManager.cc.

References PhysicalMemoryManager::anonymous, VirtualAddressSpace::CacheDisable, PhysicalMemoryManager::continuous, freePage(), VirtualAddressSpace::getKernelAddressSpace(), VirtualAddressSpace::getMapping(), VirtualAddressSpace::KernelMode, PhysicalMemoryManager::m_MemoryRegions, MemoryRegion::m_PhysicalAddress, MemoryRegion::m_Size, MemoryRegion::m_VirtualAddress, VirtualAddressSpace::map(), PhysicalMemoryManager::nonRamMemory, Vector< T >::pushBack(), VirtualAddressSpace::unmap(), and PhysicalMemoryManager::virtualOnly.

◆ copyPhysicalPageFromBuffer()

bool Arm64PhysicalMemoryManager::copyPhysicalPageFromBuffer ( physical_uintptr_t  page,
const void *  buffer 
)
overridevirtual

Reimplemented from PhysicalMemoryManager.

Definition at line 238 of file arm64/PhysicalMemoryManager.cc.

◆ copyPhysicalPageToBuffer()

bool Arm64PhysicalMemoryManager::copyPhysicalPageToBuffer ( physical_uintptr_t  page,
void *  buffer 
)
overridevirtual

Reimplemented from PhysicalMemoryManager.

Definition at line 230 of file arm64/PhysicalMemoryManager.cc.

◆ freePage()

void Arm64PhysicalMemoryManager::freePage ( physical_uintptr_t  page)
overridevirtual

Free a page allocated with the allocatePage() function

Parameters
[in]pagephysical address of the page

Implements PhysicalMemoryManager.

Definition at line 216 of file arm64/PhysicalMemoryManager.cc.

References freePageUnlocked().

Referenced by allocateRegion(), Arm64VirtualAddressSpace::allocateStack(), Arm64VirtualAddressSpace::freeStack(), Arm64VirtualAddressSpace::handleCopyOnWriteFault(), and unmapRegion().

+ Here is the caller graph for this function:

◆ freePageCount()

size_t Arm64PhysicalMemoryManager::freePageCount ( ) const
overridevirtual

Specifies the number of pages that remain free on the system.

Reimplemented from PhysicalMemoryManager.

Definition at line 252 of file arm64/PhysicalMemoryManager.cc.

◆ freePageUnlocked()

void Arm64PhysicalMemoryManager::freePageUnlocked ( physical_uintptr_t  page)
overrideprivatevirtual

Same as freePage, but without the lock. Will panic if the lock is unlocked.

Note
Use in the wrong place and you die.

Implements PhysicalMemoryManager.

Definition at line 199 of file arm64/PhysicalMemoryManager.cc.

References panic().

Referenced by freePage().

+ Here is the caller graph for this function:

◆ initialise()

void Arm64PhysicalMemoryManager::initialise ( const BootstrapStruct_t info)

Definition at line 36 of file arm64/PhysicalMemoryManager.cc.

◆ instance()

Arm64PhysicalMemoryManager & Arm64PhysicalMemoryManager::instance ( )
static

Definition at line 27 of file arm64/PhysicalMemoryManager.cc.

◆ markPage()

void Arm64PhysicalMemoryManager::markPage ( size_t  page,
bool  available 
)
private

Definition at line 111 of file arm64/PhysicalMemoryManager.cc.

◆ memorySnapshot()

PhysicalMemoryManager::MemorySnapshot Arm64PhysicalMemoryManager::memorySnapshot ( ) const
overridevirtual

Reimplemented from PhysicalMemoryManager.

Definition at line 247 of file arm64/PhysicalMemoryManager.cc.

◆ pageAvailable()

bool Arm64PhysicalMemoryManager::pageAvailable ( size_t  page) const
private

Definition at line 107 of file arm64/PhysicalMemoryManager.cc.

◆ pageLimit()

size_t Arm64PhysicalMemoryManager::pageLimit ( size_t  constraints) const
private

Definition at line 120 of file arm64/PhysicalMemoryManager.cc.

◆ pin()

void Arm64PhysicalMemoryManager::pin ( physical_uintptr_t  page)
overridevirtual

"Pin" a page, increasing its refcount.

Every time a pinned page is passed to freePage, its refcount is decreased, and the page is only freed once the refcount hits zero.

Note that an unpin function is not provided, as freePage offers the right semantics.

Implements PhysicalMemoryManager.

Definition at line 221 of file arm64/PhysicalMemoryManager.cc.

References panic().

◆ tryAllocatePage()

physical_uintptr_t Arm64PhysicalMemoryManager::tryAllocatePage ( )
overridevirtual

Reimplemented from PhysicalMemoryManager.

Definition at line 194 of file arm64/PhysicalMemoryManager.cc.

◆ unmapRegion()

void Arm64PhysicalMemoryManager::unmapRegion ( MemoryRegion pRegion)
overrideprivatevirtual

Member Data Documentation

◆ m_FreeBitmap

uint8_t* Arm64PhysicalMemoryManager::m_FreeBitmap
private

◆ m_FreePages

size_t Arm64PhysicalMemoryManager::m_FreePages
private

◆ m_Lock

Spinlock Arm64PhysicalMemoryManager::m_Lock
mutableprivate

◆ m_MaxPage

size_t Arm64PhysicalMemoryManager::m_MaxPage
private

◆ m_NextPage

size_t Arm64PhysicalMemoryManager::m_NextPage
private

◆ m_NextRegion

uintptr_t Arm64PhysicalMemoryManager::m_NextRegion
private

◆ m_References

uint16_t* Arm64PhysicalMemoryManager::m_References
private

◆ m_RegionLock

Spinlock Arm64PhysicalMemoryManager::m_RegionLock
private

◆ m_TotalPages

size_t Arm64PhysicalMemoryManager::m_TotalPages
private

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