X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=ntoskrnl%2Fmm%2Ffreelist.c;h=7eef9593f95976b4920310349c6b4a50e0e0f3ba;hp=e7bf276600a725ee90266b920998739b936b5da9;hb=406dfdbc870f3a6874c0959a87428c94f7526d3b;hpb=c4c880d59c726905c343733fd16377e924921e52 diff --git a/ntoskrnl/mm/freelist.c b/ntoskrnl/mm/freelist.c index e7bf276600a..7eef9593f95 100644 --- a/ntoskrnl/mm/freelist.c +++ b/ntoskrnl/mm/freelist.c @@ -79,6 +79,8 @@ MmGetLRUFirstUserPage(VOID) if (Position == 0xFFFFFFFF) return 0; /* Return it */ + ASSERT(Position != 0); + ASSERT_IS_ROS_PFN(MiGetPfnEntry(Position)); return Position; } @@ -89,6 +91,8 @@ MmInsertLRULastUserPage(PFN_NUMBER Pfn) KIRQL OldIrql; /* Set the page as a user page */ + ASSERT(Pfn != 0); + ASSERT_IS_ROS_PFN(MiGetPfnEntry(Pfn)); OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); RtlSetBit(&MiUserPfnBitMap, Pfn); KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); @@ -108,6 +112,8 @@ MmGetLRUNextUserPage(PFN_NUMBER PreviousPfn) if (Position == 0xFFFFFFFF) return 0; /* Return it */ + ASSERT(Position != 0); + ASSERT_IS_ROS_PFN(MiGetPfnEntry(Position)); return Position; } @@ -116,6 +122,8 @@ NTAPI MmRemoveLRUUserPage(PFN_NUMBER Page) { /* Unset the page as a user page */ + ASSERT(Page != 0); + ASSERT_IS_ROS_PFN(MiGetPfnEntry(Page)); RtlClearBit(&MiUserPfnBitMap, Page); } @@ -222,6 +230,8 @@ MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, while (PagesFound < PageCount) { /* Grab a page */ + MI_SET_USAGE(MI_USAGE_MDL); + MI_SET_PROCESS2("Kernel"); Page = MiRemoveAnyPage(0); if (Page == 0) { @@ -238,12 +248,14 @@ MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, // ASSERT(Pfn1->u3.e2.ReferenceCount == 0); - // - // Allocate it and mark it - // + /* Now setup the page and mark it */ + Pfn1->u3.e2.ReferenceCount = 1; + Pfn1->u2.ShareCount = 1; + MI_SET_PFN_DELETED(Pfn1); + Pfn1->u4.PteFrame = 0x1FFEDCB; Pfn1->u3.e1.StartOfAllocation = 1; Pfn1->u3.e1.EndOfAllocation = 1; - Pfn1->u3.e2.ReferenceCount = 1; + Pfn1->u4.VerifierAllocation = 0; // // Save it into the MDL @@ -278,6 +290,8 @@ MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, /* Remove the page from the free or zero list */ ASSERT(Pfn1->u3.e1.ReadInProgress == 0); + MI_SET_USAGE(MI_USAGE_MDL); + MI_SET_PROCESS2("Kernel"); MiUnlinkFreeOrZeroedPage(Pfn1); // @@ -362,21 +376,13 @@ MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, } // - // We're done, mark the pages as locked (should we lock them, though???) + // We're done, mark the pages as locked // Mdl->Process = NULL; Mdl->MdlFlags |= MDL_PAGES_LOCKED; return Mdl; } -VOID -NTAPI -MmDumpPfnDatabase(VOID) -{ - /* Pretty useless for now, to be improved later */ - return; -} - VOID NTAPI MmSetRmapListHeadPage(PFN_NUMBER Pfn, PMM_RMAP_ENTRY ListHead)