Implement tracking of available physical pages
This commit is contained in:
@@ -18,6 +18,7 @@ namespace MM
|
|||||||
class Pfn
|
class Pfn
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
STATIC PFN_NUMBER AvailablePages;
|
||||||
STATIC PLOADER_MEMORY_DESCRIPTOR FreeDescriptor;
|
STATIC PLOADER_MEMORY_DESCRIPTOR FreeDescriptor;
|
||||||
STATIC ULONG_PTR HighestPhysicalPage;
|
STATIC ULONG_PTR HighestPhysicalPage;
|
||||||
STATIC ULONG_PTR LowestPhysicalPage;
|
STATIC ULONG_PTR LowestPhysicalPage;
|
||||||
@@ -31,6 +32,10 @@ namespace MM
|
|||||||
STATIC XTAPI ULONGLONG GetNumberOfPhysicalPages(VOID);
|
STATIC XTAPI ULONGLONG GetNumberOfPhysicalPages(VOID);
|
||||||
STATIC XTAPI PFN_NUMBER GetPfnDatabaseSize(VOID);
|
STATIC XTAPI PFN_NUMBER GetPfnDatabaseSize(VOID);
|
||||||
STATIC XTAPI VOID ScanMemoryDescriptors(VOID);
|
STATIC XTAPI VOID ScanMemoryDescriptors(VOID);
|
||||||
|
|
||||||
|
private:
|
||||||
|
STATIC XTAPI VOID DecrementAvailablePages(VOID);
|
||||||
|
STATIC XTAPI VOID IncrementAvailablePages(VOID);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ PFN_NUMBER MM::Manager::NumberOfSystemPtes;
|
|||||||
/* Instance of the page map routines for the current PML level */
|
/* Instance of the page map routines for the current PML level */
|
||||||
MM::PPAGEMAP MM::Paging::PmlRoutines;
|
MM::PPAGEMAP MM::Paging::PmlRoutines;
|
||||||
|
|
||||||
|
/* Total number of physical pages available for allocation */
|
||||||
|
PFN_NUMBER MM::Pfn::AvailablePages;
|
||||||
|
|
||||||
/* Biggest free memory descriptor */
|
/* Biggest free memory descriptor */
|
||||||
PLOADER_MEMORY_DESCRIPTOR MM::Pfn::FreeDescriptor;
|
PLOADER_MEMORY_DESCRIPTOR MM::Pfn::FreeDescriptor;
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,21 @@ MM::Pfn::ComputePfnDatabaseSize(VOID)
|
|||||||
PfnDatabaseSize >>= MM_PAGE_SHIFT;
|
PfnDatabaseSize >>= MM_PAGE_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrements the global count of available pages.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
MM::Pfn::DecrementAvailablePages(VOID)
|
||||||
|
{
|
||||||
|
/* Decrement the global count of available pages */
|
||||||
|
AvailablePages--;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the total number of physical pages managed by the system.
|
* Retrieves the total number of physical pages managed by the system.
|
||||||
*
|
*
|
||||||
@@ -90,6 +105,21 @@ MM::Pfn::GetPfnDatabaseSize(VOID)
|
|||||||
return PfnDatabaseSize;
|
return PfnDatabaseSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increments the global count of available pages.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
MM::Pfn::IncrementAvailablePages(VOID)
|
||||||
|
{
|
||||||
|
/* Increment the global count of available pages */
|
||||||
|
AvailablePages++;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scans memory descriptors provided by the boot loader.
|
* Scans memory descriptors provided by the boot loader.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user