From 0d65391a4f72812f5d40f73028841cd2223a0c19 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sun, 28 Jan 2007 16:23:52 +0000 Subject: [PATCH] - Merge Arty's Mm Page Referencing patch. I was able to complete first-stage setup (albeit only on the second try) and booting to second stage (after three tries). There are still freelist.c bugchecks but this patch is defintely a step in the right direction. svn path=/trunk/; revision=25656 --- reactos/ntoskrnl/mm/freelist.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/mm/freelist.c b/reactos/ntoskrnl/mm/freelist.c index 9680ca54bc8..920f0151c31 100644 --- a/reactos/ntoskrnl/mm/freelist.c +++ b/reactos/ntoskrnl/mm/freelist.c @@ -479,7 +479,9 @@ MmInitializePageList(ULONG_PTR FirstPhysKernelAddress, MmPageArray[j].Flags.Type = MM_PHYSICAL_PAGE_USED; MmPageArray[j].Flags.Zero = 0; MmPageArray[j].Flags.Consumer = MC_NPPOOL; - MmPageArray[j].ReferenceCount = 1; + /* Reference count 2, because we're having ReferenceCount track + MapCount as well. */ + MmPageArray[j].ReferenceCount = 2; MmPageArray[j].MapCount = 1; InsertTailList(&UsedPageListHeads[MC_NPPOOL], &MmPageArray[j].ListEntry); @@ -519,7 +521,7 @@ MmInitializePageList(ULONG_PTR FirstPhysKernelAddress, MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED; MmPageArray[i].Flags.Zero = 0; MmPageArray[i].Flags.Consumer = MC_NPPOOL; - MmPageArray[i].ReferenceCount = 1; + MmPageArray[i].ReferenceCount = 2; MmPageArray[i].MapCount = 1; InsertTailList(&UsedPageListHeads[MC_NPPOOL], &MmPageArray[i].ListEntry); @@ -588,6 +590,7 @@ MmMarkPageMapped(PFN_TYPE Pfn) KEBUGCHECK(0); } MmPageArray[Pfn].MapCount++; + MmPageArray[Pfn].ReferenceCount++; KeReleaseSpinLock(&PageListLock, oldIrql); } } @@ -612,6 +615,7 @@ MmMarkPageUnmapped(PFN_TYPE Pfn) KEBUGCHECK(0); } MmPageArray[Pfn].MapCount--; + MmPageArray[Pfn].ReferenceCount--; KeReleaseSpinLock(&PageListLock, oldIrql); } }