The Pedigree Project
0.1
|
The Stack of pages (below4GB, below64GB, no constraint). More...
Public Member Functions | |
PageStack () INITIALISATION_ONLY | |
physical_uintptr_t | allocate (size_t constraints) |
void | free (uint64_t physicalAddress, size_t length) |
~PageStack () | |
size_t | freePages () const |
void | setCapacity (size_t newCapacity) |
void | increaseCapacity (size_t by) |
Protected Member Functions | |
void | markAbove4GReady () |
void | markBelow4GReady () |
Private Member Functions | |
PageStack (const PageStack &) | |
PageStack & | operator= (const PageStack &) |
bool | maybeMap (size_t index, uint64_t physicalAddress) |
Private Attributes | |
void * | m_Stack [StackCount] |
size_t | m_StackMax [StackCount] |
size_t | m_StackSize [StackCount] |
size_t | m_FreePages |
size_t | m_Capacity |
size_t | m_DesiredCapacity |
Atomic< bool > | m_StackReady [StackCount] |
Static Private Attributes | |
static const size_t | StackCount = 3 |
Friends | |
class | X86CommonPhysicalMemoryManager |
The Stack of pages (below4GB, below64GB, no constraint).
The actual page stack contains is a Stack of the pages with the constraints below4GB and below64GB and those pages without address size constraints.
Definition at line 119 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
X86CommonPhysicalMemoryManager::PageStack::PageStack | ( | ) |
Default constructor does nothing
Definition at line 1060 of file x86_common/PhysicalMemoryManager.cc.
Referenced by ~PageStack().
|
inline |
The destructor does nothing
Definition at line 134 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
References m_DesiredCapacity, m_FreePages, markAbove4GReady(), markBelow4GReady(), maybeMap(), operator=(), PageStack(), and StackCount.
|
private |
The copy-constructor
physical_uintptr_t X86CommonPhysicalMemoryManager::PageStack::allocate | ( | size_t | constraints | ) |
Allocate a page with certain constraints
[in] | constraints | either below4GB or below64GB or 0 |
Definition at line 903 of file x86_common/PhysicalMemoryManager.cc.
References PhysicalMemoryManager::below4GB, PhysicalMemoryManager::below64GB, g_FreePages, PhysicalMemoryManager::getPageSize(), Processor::pause(), and physicalAddress().
void X86CommonPhysicalMemoryManager::PageStack::free | ( | uint64_t | physicalAddress, |
size_t | length | ||
) |
Free a physical page
[in] | physicalAddress | physical address of the page |
Definition at line 989 of file x86_common/PhysicalMemoryManager.cc.
References g_FreePages, PhysicalMemoryManager::getPageSize(), physicalAddress(), and UNLIKELY.
Referenced by X86CommonPhysicalMemoryManager::unmapRegion().
|
protected |
Mark all stacks tracking pages above 4GB mark ready.
Definition at line 1082 of file x86_common/PhysicalMemoryManager.cc.
Referenced by ~PageStack().
|
protected |
Mark stacks tracking pages below 4GB mark ready.
Definition at line 1090 of file x86_common/PhysicalMemoryManager.cc.
Referenced by ~PageStack().
|
private |
Potentially use the given page to map paging structures for future stack frees.
Definition at line 1095 of file x86_common/PhysicalMemoryManager.cc.
References FATAL, VirtualAddressSpace::getKernelAddressSpace(), PhysicalMemoryManager::getPageSize(), X64VirtualAddressSpace::isMapped(), VirtualAddressSpace::KernelMode, X64VirtualAddressSpace::mapPageStructures(), and VirtualAddressSpace::Write.
Referenced by ~PageStack().
The copy-constructor
Referenced by ~PageStack().
|
private |
Current capacity (i.e. mapped pages).
Definition at line 192 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
private |
Desired capacity. New pages will be mapped until demand is met.
Definition at line 194 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
Referenced by ~PageStack().
|
private |
Current pages available.
Definition at line 190 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
Referenced by ~PageStack().
|
private |
Pointer to the base address of the stack. The stack grows upwards.
Definition at line 184 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
private |
Size of the currently mapped stack
Definition at line 186 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
private |
Whether or not a particular stack is ready for use.
Definition at line 197 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
private |
Currently used size of the stack
Definition at line 188 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
staticprivate |
The number of Stacks
Definition at line 179 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
Referenced by ~PageStack().