The Pedigree Project 0.1
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
MemoryRegion Class Reference

Special memory entity in the kernel's virtual address space. More...

#include <MemoryRegion.h>

+ Inheritance diagram for MemoryRegion:
+ Collaboration diagram for MemoryRegion:

Public Member Functions

 MemoryRegion (const char *pName)
 
virtual ~MemoryRegion ()
 
void free ()
 
void * virtualAddress () const
 
physical_uintptr_t physicalAddress () const
 
size_t size () const
 
const char * name () const
 
 operator bool () const
 
bool physicalBoundsCheck (physical_uintptr_t address)
 
template<typename T >
T * convertPhysicalPointer (physical_uintptr_t address)
 
void setNonRamMemory (bool b)
 
bool getNonRamMemory ()
 
void setForced (bool b)
 
bool getForced ()
 
void setAnonymous (bool b)
 
bool getAnonymous () const
 

Private Member Functions

 MemoryRegion (const MemoryRegion &)
 
MemoryRegion & operator= (const MemoryRegion &)
 

Private Attributes

void * m_VirtualAddress
 
physical_uintptr_t m_PhysicalAddress
 
size_t m_Size
 
const char * m_pName
 
bool m_bNonRamMemory
 
bool m_bForced
 
bool m_bPageBacked
 
bool m_bAnonymous
 

Friends

class X86CommonPhysicalMemoryManager
 
class HostedPhysicalMemoryManager
 
class Arm64PhysicalMemoryManager
 
class Armv7PhysicalMemoryManager
 

Detailed Description

Special memory entity in the kernel's virtual address space.

A MemoryRegion is a special memory entity that is mapped continuously in the virtual address space, but might not be continuous in the physical address space. These entities are allocated and freed via the PhysicalMemoryManager. A MemoryRegion is mapped into the kernel's virtual address space and as such accessible from kernel-mode within every process's virtual address space.

Definition at line 35 of file MemoryRegion.h.

Constructor & Destructor Documentation

◆ MemoryRegion() [1/2]

MemoryRegion::MemoryRegion ( const char *  pName)

The default constructor does nothing

Definition at line 23 of file MemoryRegion.cc.

◆ ~MemoryRegion()

MemoryRegion::~MemoryRegion ( )
virtual

The destructor unregisters itself from the PMM.

Definition at line 33 of file MemoryRegion.cc.

References PhysicalMemoryManager::instance(), and PhysicalMemoryManager::unmapRegion().

◆ MemoryRegion() [2/2]

MemoryRegion::MemoryRegion ( const MemoryRegion &  )
private

The copy-constructor

Note
Not implemented

Member Function Documentation

◆ convertPhysicalPointer()

template<typename T >
T * MemoryRegion::convertPhysicalPointer ( physical_uintptr_t  address)

Definition at line 105 of file MemoryRegion.h.

◆ free()

void MemoryRegion::free ( )

Definition at line 37 of file MemoryRegion.cc.

◆ getAnonymous()

bool MemoryRegion::getAnonymous ( ) const

Definition at line 87 of file MemoryRegion.cc.

◆ getForced()

bool MemoryRegion::getForced ( )

Definition at line 79 of file MemoryRegion.cc.

◆ getNonRamMemory()

bool MemoryRegion::getNonRamMemory ( )

Definition at line 71 of file MemoryRegion.cc.

◆ name()

const char * MemoryRegion::name ( ) const

Get the name of the memory-region

Returns
pointer to the name of the memory-region

Definition at line 53 of file MemoryRegion.cc.

References m_pName.

Referenced by MemoryPool::initialise().

+ Here is the caller graph for this function:

◆ operator bool()

MemoryRegion::operator bool ( ) const

Definition at line 57 of file MemoryRegion.cc.

◆ operator=()

MemoryRegion & MemoryRegion::operator= ( const MemoryRegion &  )
private

The copy-constructor

Note
Not implemented

◆ physicalAddress()

physical_uintptr_t MemoryRegion::physicalAddress ( ) const

Get the physical address of the beginning of the MemoryRegion

Returns
pointer to the beginning of the MemoryRegion (in the physical address space)

Definition at line 45 of file MemoryRegion.cc.

References m_PhysicalAddress.

Referenced by BusMasterIde::initialise(), Nic3C90x::Nic3C90x(), HostedPhysicalMemoryManager::unmapRegion(), and X86CommonPhysicalMemoryManager::unmapRegion().

+ Here is the caller graph for this function:

◆ physicalBoundsCheck()

bool MemoryRegion::physicalBoundsCheck ( physical_uintptr_t  address)

Definition at line 61 of file MemoryRegion.cc.

◆ setAnonymous()

void MemoryRegion::setAnonymous ( bool  b)

Definition at line 83 of file MemoryRegion.cc.

◆ setForced()

void MemoryRegion::setForced ( bool  b)

Definition at line 75 of file MemoryRegion.cc.

◆ setNonRamMemory()

void MemoryRegion::setNonRamMemory ( bool  b)

Definition at line 67 of file MemoryRegion.cc.

◆ size()

size_t MemoryRegion::size ( ) const

◆ virtualAddress()

void * MemoryRegion::virtualAddress ( ) const

Friends And Related Symbol Documentation

◆ Arm64PhysicalMemoryManager

friend class Arm64PhysicalMemoryManager
friend

Definition at line 40 of file MemoryRegion.h.

◆ Armv7PhysicalMemoryManager

friend class Armv7PhysicalMemoryManager
friend

Definition at line 41 of file MemoryRegion.h.

◆ HostedPhysicalMemoryManager

friend class HostedPhysicalMemoryManager
friend

As does HostedPhysicalMemoryManager.

Definition at line 39 of file MemoryRegion.h.

◆ X86CommonPhysicalMemoryManager

friend class X86CommonPhysicalMemoryManager
friend

X86CommonPhysicalMemoryManager needs access to MemoryRegion's members

Definition at line 37 of file MemoryRegion.h.

Member Data Documentation

◆ m_bAnonymous

bool MemoryRegion::m_bAnonymous
private

Definition at line 99 of file MemoryRegion.h.

◆ m_bForced

bool MemoryRegion::m_bForced
private

Definition at line 99 of file MemoryRegion.h.

◆ m_bNonRamMemory

bool MemoryRegion::m_bNonRamMemory
private

Definition at line 99 of file MemoryRegion.h.

◆ m_bPageBacked

bool MemoryRegion::m_bPageBacked
private

Definition at line 99 of file MemoryRegion.h.

◆ m_PhysicalAddress

physical_uintptr_t MemoryRegion::m_PhysicalAddress
private

Pointer to the beginning of the memory region in the physical address space, if the region is physically continuous, otherwise 0.

Definition at line 93 of file MemoryRegion.h.

Referenced by HostedPhysicalMemoryManager::allocateRegion(), X86CommonPhysicalMemoryManager::allocateRegion(), Arm64PhysicalMemoryManager::allocateRegion(), Armv7PhysicalMemoryManager::allocateRegion(), and physicalAddress().

◆ m_pName

const char* MemoryRegion::m_pName
private

User-visible name of the memory-region

Definition at line 97 of file MemoryRegion.h.

Referenced by name().

◆ m_Size

size_t MemoryRegion::m_Size
private

◆ m_VirtualAddress

void* MemoryRegion::m_VirtualAddress
private

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