Compute PTE count per page from entry size
This commit is contained in:
@@ -38,10 +38,12 @@ MM::Manager::InitializeMemoryLayout(VOID)
|
||||
{
|
||||
ULONG_PTR PagedPoolSize, PteCount;
|
||||
PFN_NUMBER PfnDatabaseSize;
|
||||
ULONG PtesPerPage;
|
||||
|
||||
/* Calculate size of paged pool (at least 32MiB) */
|
||||
PteCount = ((SIZE_TO_PAGES(33554432) + (MM_PTE_PER_PAGE - 1)) / MM_PTE_PER_PAGE);
|
||||
PagedPoolSize = PteCount * MM_PTE_PER_PAGE * MM_PAGE_SIZE;
|
||||
/* Get the number of PTEs per page and calculate size of paged pool (at least 32MiB) */
|
||||
PtesPerPage = MM::Pte::GetPtesPerPage();
|
||||
PteCount = ((SIZE_TO_PAGES(33554432) + (PtesPerPage - 1)) / PtesPerPage);
|
||||
PagedPoolSize = PteCount * PtesPerPage * MM_PAGE_SIZE;
|
||||
|
||||
/* Retrieve the PFN database size */
|
||||
PfnDatabaseSize = MM::Pfn::GetPfnDatabaseSize();
|
||||
|
||||
@@ -9,6 +9,21 @@
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/**
|
||||
* Calculates the number of Page Table Entries (PTEs) that fit within a single page.
|
||||
*
|
||||
* @return This routine returns the number of PTEs per page.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
ULONG
|
||||
MM::Pte::GetPtesPerPage(VOID)
|
||||
{
|
||||
/* Calculate and return the number of PTEs per page */
|
||||
return MM_PAGE_SIZE / MM::Paging::GetPteSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a range of virtual addresses at the P5E (PML5) level.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user