+BOOLEAN MmRosNotifyAvailablePage(PFN_NUMBER Page)
+{
+ PLIST_ENTRY Entry;
+ PMM_ALLOCATION_REQUEST Request;
+ PMMPFN Pfn1;
+
+ /* Make sure the PFN lock is held */
+ ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+
+ if (!MiMinimumAvailablePages)
+ {
+ /* Dirty way to know if we were initialized. */
+ return FALSE;
+ }
+
+ Entry = ExInterlockedRemoveHeadList(&AllocationListHead, &AllocationListLock);
+ if (!Entry)
+ return FALSE;
+
+ Request = CONTAINING_RECORD(Entry, MM_ALLOCATION_REQUEST, ListEntry);
+ MiZeroPhysicalPage(Page);
+ Request->Page = Page;
+
+ Pfn1 = MiGetPfnEntry(Page);
+ ASSERT(Pfn1->u3.e2.ReferenceCount == 0);
+ Pfn1->u3.e2.ReferenceCount = 1;
+ Pfn1->u3.e1.PageLocation = ActiveAndValid;
+
+ /* This marks the PFN as a ReactOS PFN */
+ Pfn1->u4.AweAllocation = TRUE;
+
+ /* Allocate the extra ReactOS Data and zero it out */
+ Pfn1->u1.SwapEntry = 0;
+ Pfn1->RmapListHead = NULL;
+
+ KeSetEvent(&Request->Event, IO_NO_INCREMENT, FALSE);
+
+ return TRUE;
+}
+