Author: fireball Date: Sun Feb 17 16:08:28 2008 New Revision: 32400
URL: http://svn.reactos.org/svn/reactos?rev=32400&view=rev Log: - Zero early-allocated pages for PFN DB itself, as suggested on the ros-dev mailing list, and hyperspace mapping seems to work, at least on x86. Fixes the "warm reboot-bug" in 2nd stage.
Modified: trunk/reactos/ntoskrnl/mm/freelist.c
Modified: trunk/reactos/ntoskrnl/mm/freelist.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/freelist.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/mm/freelist.c (original) +++ trunk/reactos/ntoskrnl/mm/freelist.c Sun Feb 17 16:08:28 2008 @@ -242,11 +242,11 @@ MmAllocEarlyPage(VOID) { PFN_TYPE Pfn; - + /* Use one of our highest usable pages */ Pfn = MiFreeDescriptor->BasePage + MiFreeDescriptor->PageCount - 1; MiFreeDescriptor->PageCount--; - + /* Return it */ return Pfn; } @@ -285,7 +285,7 @@ { /* Use one of our highest usable pages */ Pfn = MmAllocEarlyPage(); - + /* Set the PFN */ Status = MmCreateVirtualMappingForKernel(Address, PAGE_READWRITE, @@ -303,7 +303,7 @@ MmSetPageProtect(NULL, Address, PAGE_READWRITE); } } - + /* Clear the PFN database */ RtlZeroMemory(MmPageArray, (MmPageArraySize + 1) * sizeof(PHYSICAL_PAGE));
@@ -386,8 +386,7 @@ MmStats.NrTotalPages = MmStats.NrFreePages + MmStats.NrSystemPages + MmStats.NrUserPages; MmInitializeBalancer(MmStats.NrFreePages, MmStats.NrSystemPages); } -#endif - +#else VOID NTAPI MmInitializePageList() @@ -427,9 +426,8 @@ 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, PAGE_READWRITE, @@ -579,6 +577,7 @@ MmStats.NrTotalPages = MmStats.NrFreePages + MmStats.NrSystemPages + MmStats.NrUserPages; MmInitializeBalancer(MmStats.NrFreePages, MmStats.NrSystemPages); } +#endif
VOID NTAPI @@ -945,7 +944,9 @@ { /* Allocate an early page -- we'll account for it later */ KeReleaseSpinLock(&PageListLock, oldIrql); - return MmAllocEarlyPage(); + PfnOffset = MmAllocEarlyPage(); + MiZeroPage(PfnOffset); + return PfnOffset; }
DPRINT1("MmAllocPage(): Out of memory\n");