20 #ifndef KERNEL_PROCESSOR_X86_COMMON_PHYSICALMEMORYMANAGER_H 21 #define KERNEL_PROCESSOR_X86_COMMON_PHYSICALMEMORYMANAGER_H 23 #include "pedigree/kernel/Atomic.h" 24 #include "pedigree/kernel/Spinlock.h" 25 #include "pedigree/kernel/compiler.h" 26 #include "pedigree/kernel/processor/PhysicalMemoryManager.h" 27 #include "pedigree/kernel/processor/types.h" 28 #include "pedigree/kernel/utilities/HashTable.h" 29 #include "pedigree/kernel/utilities/RangeList.h" 30 #include "pedigree/kernel/utilities/utility.h" 38 extern size_t g_AllocedPages;
59 virtual physical_uintptr_t
allocatePage(
size_t pageConstraints = 0);
62 MemoryRegion &Region,
size_t cPages,
size_t pageConstraints,
63 size_t Flags, physical_uintptr_t start = -1);
65 virtual void pin(physical_uintptr_t page);
129 physical_uintptr_t
allocate(
size_t constraints);
138 inline size_t freePages()
const 143 void setCapacity(
size_t newCapacity)
148 void increaseCapacity(
size_t by)
173 bool maybeMap(
size_t index, uint64_t physicalAddress);
179 static const size_t StackCount = 3;
249 return p.m_Page == m_Page;
254 physical_uintptr_t m_Page;
260 page() : active(
false), refcount(0)
Bootstrap structure passed to the kernel entry point.
physical_uintptr_t allocate(size_t constraints)
static X86CommonPhysicalMemoryManager & instance()
static size_t getPageSize() PURE
bool maybeMap(size_t index, uint64_t physicalAddress)
#define INITIALISATION_ONLY
virtual void freePageUnlocked(physical_uintptr_t page)
X86CommonPhysicalMemoryManager & operator=(const X86CommonPhysicalMemoryManager &)
RangeList< uintptr_t > m_MemoryRegions
void initialisationDone()
The Stack of pages (below4GB, below64GB, no constraint).
void initialise64(const BootstrapStruct_t &Info) INITIALISATION_ONLY
void free(uint64_t physicalAddress, size_t length)
void * m_Stack[StackCount]
virtual bool allocateRegion(MemoryRegion &Region, size_t cPages, size_t pageConstraints, size_t Flags, physical_uintptr_t start=-1)
void unmapRegion(MemoryRegion *pRegion)
X86CommonPhysicalMemoryManager() INITIALISATION_ONLY
PageStack & operator=(const PageStack &)
uintptr_t physicalAddress(physical_uintptr_t address) PURE
RangeList< uint64_t > m_PhysicalRanges
virtual void pin(physical_uintptr_t page)
Special memory entity in the kernel's virtual address space.
virtual ~X86CommonPhysicalMemoryManager()
virtual void freePage(physical_uintptr_t page)
Atomic< bool > m_StackReady[StackCount]
PageStack() INITIALISATION_ONLY
static X86CommonPhysicalMemoryManager m_Instance
size_t m_StackMax[StackCount]
size_t m_StackSize[StackCount]
RangeList< uint32_t > m_RangeBelow1MB
static const size_t StackCount
virtual physical_uintptr_t allocatePage(size_t pageConstraints=0)
void initialise(const BootstrapStruct_t &Info) INITIALISATION_ONLY
bool operator==(const Iterator< originalT, Struct, FunctionPrev, FunctionNext, T1 > &x1, const Iterator< originalT, Struct, FunctionPrev, FunctionNext, T2 > &x2)
Implementation of the PhysicalMemoryManager for common x86.
virtual size_t freePageCount() const
RangeList< uint32_t > m_RangeBelow16MB
HashTable< PageHashable, struct page > m_PageMetadata