mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
On systems with large enough memory (or lots of drivers already loaded), we actually need another PDE to hold the new PTEs to represent the PFN database, since we go past the initial PDEs that come from FreeLDR. On those systems, we would try allocating a new page to hold the PDE, and crash, since the PFN database isn't setup. We now have an MmAllocPageEarly routine which is called during Mm bootstrapping to resolve this issue.
svn path=/trunk/; revision=32383
This commit is contained in:
parent
8f7384d246
commit
8a623c61d3
2 changed files with 24 additions and 4 deletions
|
@ -237,6 +237,20 @@ MmGetContinuousPages(ULONG NumberOfBytes,
|
|||
return 0;
|
||||
}
|
||||
|
||||
PFN_TYPE
|
||||
NTAPI
|
||||
MmAllocEarlyPage(VOID)
|
||||
{
|
||||
PFN_TYPE Pfn;
|
||||
|
||||
/* Use one of our highest usable pages */
|
||||
Pfn = MiFreeDescriptor->BasePage + MiFreeDescriptor->PageCount - 1;
|
||||
MiFreeDescriptor->PageCount--;
|
||||
|
||||
/* Return it */
|
||||
return Pfn;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
MmInitializePageList(VOID)
|
||||
|
@ -269,8 +283,7 @@ MmInitializePageList(VOID)
|
|||
if (!MmIsPagePresent(NULL, Address))
|
||||
{
|
||||
/* Use one of our highest usable pages */
|
||||
Pfn = MiFreeDescriptor->BasePage + MiFreeDescriptor->PageCount - 1;
|
||||
MiFreeDescriptor->PageCount--;
|
||||
Pfn = MmAllocEarlyPage();
|
||||
|
||||
/* Set the PFN */
|
||||
Status = MmCreateVirtualMappingForKernel(Address,
|
||||
|
@ -733,6 +746,14 @@ MmAllocPage(ULONG Consumer, SWAPENTRY SavedSwapEntry)
|
|||
{
|
||||
if (IsListEmpty(&FreeUnzeroedPageListHead))
|
||||
{
|
||||
/* Check if this allocation is for the PFN DB itself */
|
||||
if (MmStats.NrTotalPages == 0)
|
||||
{
|
||||
/* Allocate an early page -- we'll account for it later */
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return MmAllocEarlyPage();
|
||||
}
|
||||
|
||||
DPRINT1("MmAllocPage(): Out of memory\n");
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return 0;
|
||||
|
|
|
@ -351,8 +351,7 @@ MmInit1(VOID)
|
|||
|
||||
/* Count RAM */
|
||||
MiCountFreePagesInLoaderBlock(KeLoaderBlock);
|
||||
MmStats.NrTotalPages = MmNumberOfPhysicalPages;
|
||||
DbgPrint("Used memory %dKb\n", (MmStats.NrTotalPages * PAGE_SIZE) / 1024);
|
||||
DbgPrint("Used memory %dKb\n", (MmNumberOfPhysicalPages * PAGE_SIZE) / 1024);
|
||||
|
||||
/* Initialize the kernel address space */
|
||||
MmInitializeKernelAddressSpace();
|
||||
|
|
Loading…
Reference in a new issue