Index: C:/ROS/reactos/ntoskrnl/mm/section.c =================================================================== --- ntoskrnl/mm/section.c (revision 58327) +++ ntoskrnl/mm/section.c (working copy) @@ -677,7 +677,7 @@ pssSegments[i].Length.QuadPart = pishSectionHeaders[i].Misc.VirtualSize; pssSegments[i].Length.LowPart = ALIGN_UP_BY(pssSegments[i].Length.LowPart, nSectionAlignment); - if (pssSegments[i].Length.QuadPart < pssSegments[i].Length.QuadPart) + if (pssSegments[i].Length.QuadPart < pssSegments[i].Length.QuadPart) // BUGBUG: always false DIE(("Cannot align the virtual size of section %u\n", i)); if(pssSegments[i].Length.QuadPart == 0) @@ -758,7 +758,7 @@ KeBugCheck(MEMORY_MANAGEMENT); } MmFreePageTablesSectionSegment(Segment, NULL); - ExFreePool(Segment); + ExFreePoolWithTag(Segment, TAG_MM_SECTION_SEGMENT); FileObject->SectionObjectPointer->DataSectionObject = NULL; } } @@ -1394,52 +1394,6 @@ } /* - * Map anonymous memory for BSS sections - */ - if (Segment->Image.Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) - { - /* We'll be unlocking the address space below. Prevent us from being preempted - * in faulting in the page. */ - MmCreatePageFileMapping(Process, Address, MM_WAIT_ENTRY); - MmUnlockSectionSegment(Segment); - MI_SET_USAGE(MI_USAGE_SECTION); - if (Process) MI_SET_PROCESS2(Process->ImageFileName); - if (!Process) MI_SET_PROCESS2("Kernel Section"); - Status = MmRequestPageMemoryConsumer(MC_USER, FALSE, &Page); - if (!NT_SUCCESS(Status)) - { - MmUnlockAddressSpace(AddressSpace); - Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page); - MmLockAddressSpace(AddressSpace); - } - if (!NT_SUCCESS(Status)) - { - KeBugCheck(MEMORY_MANAGEMENT); - } - /* Remove the wait entry we placed, so that we can map the page */ - MmDeletePageFileMapping(Process, PAddress, &SwapEntry); - Status = MmCreateVirtualMapping(Process, - PAddress, - Region->Protect, - &Page, - 1); - if (!NT_SUCCESS(Status)) - { - DPRINT("MmCreateVirtualMapping failed, not out of memory\n"); - KeBugCheck(MEMORY_MANAGEMENT); - return(Status); - } - MmInsertRmap(Page, Process, Address); - - /* - * Cleanup and release locks - */ - MiSetPageEvent(Process, Address); - DPRINT("Address 0x%.8X\n", Address); - return(STATUS_SUCCESS); - } - - /* * Get the entry corresponding to the offset within the section */ Entry = MmGetPageEntrySectionSegment(Segment, &Offset); @@ -1508,7 +1462,7 @@ MmUnlockSectionSegment(Segment); MmDeletePageFileMapping(Process, PAddress, &FakeSwapEntry); - DPRINT("CreateVirtualMapping Page %x Process %p PAddress %p Attributes %x\n", + DPRINT("CreateVirtualMapping Page %x Process %p PAddress %p Attributes %x\n", Page, Process, PAddress, Attributes); Status = MmCreateVirtualMapping(Process, PAddress, @@ -2058,7 +2012,7 @@ Address); KeBugCheckEx(MEMORY_MANAGEMENT, SwapEntry, Page, (ULONG_PTR)Process, (ULONG_PTR)Address); } - MmReleasePageMemoryConsumer(MC_USER, Page); + MmReleasePageMemoryConsumer(MC_USER, Page); MiSetPageEvent(NULL, NULL); return(STATUS_SUCCESS); } @@ -2656,7 +2610,7 @@ { MmpFreePageFileSegment(Section->Segment); MmFreePageTablesSectionSegment(Section->Segment, NULL); - ExFreePool(Section->Segment); + ExFreePoolWithTag(Section->Segment, TAG_MM_SECTION_SEGMENT); Section->Segment = NULL; } else @@ -3797,7 +3751,7 @@ if (!NT_SUCCESS(Status)) { ExFreePool(ImageSectionObject->Segments); - ExFreePool(ImageSectionObject); + ExFreePoolWithTag(ImageSectionObject, TAG_MM_SECTION_SEGMENT); ObDereferenceObject(Section); ObDereferenceObject(FileObject); return(Status); @@ -3810,7 +3764,7 @@ * An other thread has initialized the same image in the background */ ExFreePool(ImageSectionObject->Segments); - ExFreePool(ImageSectionObject); + ExFreePoolWithTag(ImageSectionObject, TAG_MM_SECTION_SEGMENT); ImageSectionObject = FileObject->SectionObjectPointer->ImageSectionObject; Section->ImageSection = ImageSectionObject; SectionSegments = ImageSectionObject->Segments;