Move PFN database size tracking to memory layout
Some checks failed
Builds / ExectOS (amd64, release) (push) Failing after 20s
Builds / ExectOS (i686, release) (push) Failing after 22s
Builds / ExectOS (i686, debug) (push) Failing after 29s
Builds / ExectOS (amd64, debug) (push) Failing after 30s

This commit is contained in:
2026-01-29 22:26:31 +01:00
parent 58669d3074
commit 5e3fb7a5a3
8 changed files with 26 additions and 41 deletions

View File

@@ -99,19 +99,27 @@ MM::Pfn::AllocatePhysicalPage(IN ULONG Color)
/**
* Calculates the total number of pages required for the PFN database and its associated color tables.
*
* @param DatabaseSize
* A pointer to a variable that will receive the number of pages required for the PFN database.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
MM::Pfn::ComputePfnDatabaseSize(VOID)
MM::Pfn::ComputePfnDatabaseSize(OUT PPFN_NUMBER DatabaseSize)
{
PFN_NUMBER PfnDatabaseSize;
/* Calculate the total number of pages required for the PFN database */
PfnDatabaseSize = (HighestPhysicalPage + 1) * sizeof(MMPFN);
PfnDatabaseSize += (MM::Colors::GetPagingColors() * sizeof(MMCOLOR_TABLES) * 2);
PfnDatabaseSize = ROUND_UP(PfnDatabaseSize, MM_PAGE_SIZE);
PfnDatabaseSize >>= MM_PAGE_SHIFT;
/* Return the PFN database size */
*DatabaseSize = PfnDatabaseSize;
}
/**
@@ -373,21 +381,6 @@ MM::Pfn::GetNumberOfPhysicalPages(VOID)
return NumberOfPhysicalPages;
}
/**
* Gets the size of the PFN database and its associated structures, in pages.
*
* @return This routine returns the total number of pages required for the PFN database and its associated structures.
*
* @since XT 1.0
*/
XTAPI
PFN_NUMBER
MM::Pfn::GetPfnDatabaseSize(VOID)
{
/* Return the pre-calculated size of the PFN database in pages */
return PfnDatabaseSize;
}
/**
* Retrieves a pointer to the PFN database entry for a given physical page.
*