|
The Pedigree Project 0.1
|
The Stack of pages (below4GB, below64GB, no constraint). More...
Collaboration diagram for X86CommonPhysicalMemoryManager::PageStack:Public Member Functions | |
| PageStack () INITIALISATION_ONLY | |
| physical_uintptr_t | allocate (size_t constraints, bool waitForReady=true) |
| void | free (uint64_t physicalAddress, size_t length, bool newMemory=false) |
| ~PageStack () | |
| size_t | freePages () const |
| size_t | totalPages () const |
Protected Member Functions | |
| void | markAbove4GReady () |
| void | markBelow4GReady () |
Private Member Functions | |
| PageStack (const PageStack &) | |
| PageStack & | operator= (const PageStack &) |
| void | initialise () |
| 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_TotalPages |
| size_t | m_DesiredCapacity [StackCount] |
| 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 1012 of file x86_common/PhysicalMemoryManager.cc.
|
inline |
The destructor does nothing
Definition at line 136 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
private |
The copy-constructor
| physical_uintptr_t X86CommonPhysicalMemoryManager::PageStack::allocate | ( | size_t | constraints, |
| bool | waitForReady = true |
||
| ) |
Allocate a page with certain constraints
| [in] | constraints | either below4GB or below64GB or 0 |
Definition at line 876 of file x86_common/PhysicalMemoryManager.cc.
References PhysicalMemoryManager::below4GB, PhysicalMemoryManager::below64GB, g_FreePages, initialise(), m_FreePages, m_Stack, m_StackReady, m_StackSize, and ProcessorBase::pause().
Referenced by HostedPhysicalMemoryManager::allocatePage(), and X86CommonPhysicalMemoryManager::allocatePage().
Here is the caller graph for this function:| void X86CommonPhysicalMemoryManager::PageStack::free | ( | uint64_t | physicalAddress, |
| size_t | length, | ||
| bool | newMemory = false |
||
| ) |
Free a physical page
| [in] | physicalAddress | physical address of the page |
Definition at line 949 of file x86_common/PhysicalMemoryManager.cc.
References g_FreePages, PhysicalMemoryManager::getPageSize(), X86CommonPhysicalMemoryManager::initialise(), panic(), physicalAddress(), and UNLIKELY.
Referenced by HostedPhysicalMemoryManager::freePageUnlocked(), X86CommonPhysicalMemoryManager::freePageUnlocked(), HostedPhysicalMemoryManager::initialise(), X86CommonPhysicalMemoryManager::initialise(), and X86CommonPhysicalMemoryManager::initialise64().
Here is the caller graph for this function:
|
inline |
Definition at line 138 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
private |
Initialize the stacks if needed. This is needed to avoid a dependency on the order of construction of VirtualAddressSpace objects for the kernel address space. Otherwise we can try to get page stack addresses from an unconstructed VirtualAddressSpace object.
Definition at line 1034 of file x86_common/PhysicalMemoryManager.cc.
References VirtualAddressSpace::getKernelAddressSpace(), VirtualAddressSpace::getKernelVirtualPagestack(), VirtualAddressSpace::getKernelVirtualPagestackAdd1(), VirtualAddressSpace::getKernelVirtualPagestackAdd2(), and LIKELY.
Referenced by allocate().
Here is the caller graph for this function:
|
protected |
Mark all stacks tracking pages above 4GB mark ready.
Definition at line 1047 of file x86_common/PhysicalMemoryManager.cc.
Referenced by X86CommonPhysicalMemoryManager::initialise64().
Here is the caller graph for this function:
|
protected |
Mark stacks tracking pages below 4GB mark ready.
Definition at line 1053 of file x86_common/PhysicalMemoryManager.cc.
Referenced by HostedPhysicalMemoryManager::initialise(), and X86CommonPhysicalMemoryManager::initialise().
Here is the caller graph for this function:
|
private |
Potentially use the given page to map paging structures for future stack frees.
Definition at line 1057 of file x86_common/PhysicalMemoryManager.cc.
References EMIT_IF, VirtualAddressSpace::getKernelAddressSpace(), PhysicalMemoryManager::getPageSize(), VirtualAddressSpace::isMapped(), VirtualAddressSpace::KernelMode, VirtualAddressSpace::map(), X64VirtualAddressSpace::mapPageStructures(), physicalAddress(), and VirtualAddressSpace::Write.
The copy-constructor
|
inline |
Definition at line 142 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
friend |
Definition at line 120 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
private |
Each physical-address class needs its own backing storage.
Definition at line 191 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
private |
Current pages available.
Definition at line 188 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
Referenced by allocate().
|
private |
Pointer to the base address of the stack. The stack grows upwards.
Definition at line 182 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
Referenced by allocate().
|
private |
Size of the currently mapped stack
Definition at line 184 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
private |
Whether or not a particular stack is ready for use.
Definition at line 194 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
Referenced by allocate().
|
private |
Currently used size of the stack
Definition at line 186 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
Referenced by allocate().
|
private |
Definition at line 189 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.
|
staticprivate |
The number of Stacks
Definition at line 178 of file kernel/core/processor/x86_common/PhysicalMemoryManager.h.