The Pedigree Project  0.1
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
PpcCommonPhysicalMemoryManager Class Reference

Implementation of the PhysicalMemoryManager for common ppc. More...

#include <PhysicalMemoryManager.h>

+ Inheritance diagram for PpcCommonPhysicalMemoryManager:
+ Collaboration diagram for PpcCommonPhysicalMemoryManager:

Classes

class  PageStack
 

Public Member Functions

virtual physical_uintptr_t allocatePage ()
 
virtual void freePage (physical_uintptr_t page)
 
virtual bool allocateRegion (MemoryRegion &Region, size_t cPages, size_t pageConstraints, size_t Flags, physical_uintptr_t start=-1)
 
void initialise (Translations &translations, uintptr_t ramMax)
 
void unmapRegion (MemoryRegion *pRegion)
 
- Public Member Functions inherited from PhysicalMemoryManager
virtual physical_uintptr_t allocatePage (size_t pageConstraints=0)=0
 
virtual void pin (physical_uintptr_t page)=0
 
void allocateMemoryRegionList (Vector< MemoryRegionInfo * > &MemoryRegions)
 
void freeMemoryRegionList (Vector< MemoryRegionInfo * > &MemoryRegions)
 
virtual size_t freePageCount () const
 

Static Public Member Functions

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

Protected Member Functions

 PpcCommonPhysicalMemoryManager ()
 
virtual ~PpcCommonPhysicalMemoryManager ()
 
- Protected Member Functions inherited from PhysicalMemoryManager
 PhysicalMemoryManager ()
 
virtual ~PhysicalMemoryManager ()
 

Private Member Functions

 PpcCommonPhysicalMemoryManager (const PpcCommonPhysicalMemoryManager &)
 
PpcCommonPhysicalMemoryManageroperator= (const PpcCommonPhysicalMemoryManager &)
 

Private Attributes

PageStack m_PageStack
 
bool m_InitialMode
 
physical_uintptr_t m_NextPage
 
RangeList< uint64_t > m_PhysicalRanges
 
RangeList< uintptr_t > m_MemoryRegions
 

Static Private Attributes

static PpcCommonPhysicalMemoryManager m_Instance
 

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
 
static const size_t anonymous = 1 << 8
 
- Protected Attributes inherited from PhysicalMemoryManager
Vector< MemoryRegion * > m_MemoryRegions
 

Detailed Description

Implementation of the PhysicalMemoryManager for common ppc.

The common PPC implementation of the PhysicalMemoryManager.

This implementation has two modes - the initial mode and the 'normal' mode. In the initial mode the PMM will allocate a contiguous set of frames starting from PMM_INITIAL_START. There is no way to free pages in this mode.

In 'normal' mode the PMM uses a page stack and a rangelist for allocation/ deallocation.

The PMM is in initial mode as soon as the constructor is called - a call to 'initialise' will put it into normal mode.

Definition at line 42 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.

Constructor & Destructor Documentation

PpcCommonPhysicalMemoryManager::PpcCommonPhysicalMemoryManager ( )
protected

The constructor

Definition at line 147 of file ppc_common/PhysicalMemoryManager.cc.

Referenced by instance().

+ Here is the caller graph for this function:

PpcCommonPhysicalMemoryManager::~PpcCommonPhysicalMemoryManager ( )
protectedvirtual
PpcCommonPhysicalMemoryManager::PpcCommonPhysicalMemoryManager ( const PpcCommonPhysicalMemoryManager )
private

The copy-constructor

Note
Not implemented (singleton)

Member Function Documentation

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

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 50 of file ppc_common/PhysicalMemoryManager.cc.

References PhysicalMemoryManager::continuous, PhysicalMemoryManager::force, VirtualAddressSpace::getKernelAddressSpace(), PhysicalMemoryManager::getPageSize(), PhysicalMemoryManager::m_MemoryRegions, MemoryRegion::m_PhysicalAddress, MemoryRegion::m_Size, MemoryRegion::m_VirtualAddress, VirtualAddressSpace::map(), PhysicalMemoryManager::nonRamMemory, panic(), Vector< T >::pushBack(), and WARNING.

Referenced by instance().

+ Here is the caller graph for this function:

void PpcCommonPhysicalMemoryManager::freePage ( physical_uintptr_t  page)
virtual

Free a page allocated with the allocatePage() function

Parameters
[in]pagephysical address of the page

Implements PhysicalMemoryManager.

Definition at line 43 of file ppc_common/PhysicalMemoryManager.cc.

References panic().

Referenced by instance().

+ Here is the caller graph for this function:

static PpcCommonPhysicalMemoryManager& PpcCommonPhysicalMemoryManager::instance ( )
inlinestatic
PpcCommonPhysicalMemoryManager& PpcCommonPhysicalMemoryManager::operator= ( const PpcCommonPhysicalMemoryManager )
private

The copy-constructor

Note
Not implemented (singleton)

Referenced by instance().

+ Here is the caller graph for this function:

void PpcCommonPhysicalMemoryManager::unmapRegion ( MemoryRegion pRegion)
virtual

Member Data Documentation

bool PpcCommonPhysicalMemoryManager::m_InitialMode
private

The current operating mode. True for 'initial', false for 'normal'.

Definition at line 118 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.

Referenced by ~PpcCommonPhysicalMemoryManager().

PpcCommonPhysicalMemoryManager PpcCommonPhysicalMemoryManager::m_Instance
staticprivate

The PpcCommonPhysicalMemoryManager class instance

Definition at line 131 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.

Referenced by instance().

RangeList<uintptr_t> PpcCommonPhysicalMemoryManager::m_MemoryRegions
private

Virtual memory available for MemoryRegions

Definition at line 128 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.

Referenced by unmapRegion(), and ~PpcCommonPhysicalMemoryManager().

physical_uintptr_t PpcCommonPhysicalMemoryManager::m_NextPage
private

Variable used in initial mode to keep track of where the next page to allocate is.

Definition at line 122 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.

Referenced by ~PpcCommonPhysicalMemoryManager().

PageStack PpcCommonPhysicalMemoryManager::m_PageStack
private

The page stack

Definition at line 115 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.

Referenced by ~PpcCommonPhysicalMemoryManager().

RangeList<uint64_t> PpcCommonPhysicalMemoryManager::m_PhysicalRanges
private

RangeList of free physical memory

Definition at line 125 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.

Referenced by ~PpcCommonPhysicalMemoryManager().


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