The Pedigree Project
0.1
|
Implementation of the PhysicalMemoryManager for common ppc. More...
#include <PhysicalMemoryManager.h>
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 PpcCommonPhysicalMemoryManager & | instance () |
Static Public Member Functions inherited from PhysicalMemoryManager | |
static PhysicalMemoryManager & | instance () |
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 &) | |
PpcCommonPhysicalMemoryManager & | operator= (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 |
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.
|
protected |
The constructor
Definition at line 147 of file ppc_common/PhysicalMemoryManager.cc.
Referenced by instance().
|
protectedvirtual |
The destructor
Definition at line 152 of file ppc_common/PhysicalMemoryManager.cc.
References RangeList< T, Reversed >::allocateSpecific(), RangeList< T, Reversed >::free(), PpcCommonPhysicalMemoryManager::PageStack::free(), Translations::getNumTranslations(), PhysicalMemoryManager::getPageSize(), Translations::getTranslation(), m_InitialMode, m_MemoryRegions, m_NextPage, m_PageStack, and m_PhysicalRanges.
Referenced by instance().
|
private |
The copy-constructor
|
virtual |
Allocate a memory-region with specific constraints the pages need to fullfill.
[in] | Region | reference to the MemoryRegion object |
[in] | cPages | the number of pages to allocate for the MemoryRegion object |
[in] | pageConstraints | the constraints the pages have to fullfill |
[in] | Flags | flags from the VirtualAddressSpace class namespace |
[in] | start | the physical address of the beginning of the region (optional) |
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().
|
virtual |
Free a page allocated with the allocatePage() function
[in] | page | physical address of the page |
Implements PhysicalMemoryManager.
Definition at line 43 of file ppc_common/PhysicalMemoryManager.cc.
References panic().
Referenced by instance().
|
inlinestatic |
Get the PpcCommonPhysicalMemoryManager instance
Definition at line 47 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.
References allocateRegion(), freePage(), m_Instance, operator=(), PpcCommonPhysicalMemoryManager(), unmapRegion(), and ~PpcCommonPhysicalMemoryManager().
|
private |
The copy-constructor
Referenced by instance().
|
virtual |
Unmaps a memory region - called ONLY from MemoryRegion's destructor.
Implements PhysicalMemoryManager.
Definition at line 202 of file ppc_common/PhysicalMemoryManager.cc.
References Vector< T >::end(), Vector< T >::erase(), RangeList< T, Reversed >::free(), VirtualAddressSpace::getKernelAddressSpace(), PhysicalMemoryManager::getPageSize(), m_MemoryRegions, PhysicalMemoryManager::m_MemoryRegions, MemoryRegion::size(), VirtualAddressSpace::unmap(), and MemoryRegion::virtualAddress().
Referenced by instance().
|
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().
|
staticprivate |
The PpcCommonPhysicalMemoryManager class instance
Definition at line 131 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.
Referenced by instance().
|
private |
Virtual memory available for MemoryRegions
Definition at line 128 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.
Referenced by unmapRegion(), and ~PpcCommonPhysicalMemoryManager().
|
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().
|
private |
The page stack
Definition at line 115 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.
Referenced by ~PpcCommonPhysicalMemoryManager().
|
private |
RangeList of free physical memory
Definition at line 125 of file kernel/core/processor/ppc_common/PhysicalMemoryManager.h.
Referenced by ~PpcCommonPhysicalMemoryManager().