From: Hartmut Birr Date: Sat, 29 Oct 2005 14:09:00 +0000 (+0000) Subject: Lock always the address space if we changing the virtual mapping. X-Git-Tag: backups/ros-branch-0_2_9@19949~1037 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=470db6b8ebf4621a70e81df165a3e50469b46508;hp=d74ef35a6002c07b9d19a34203282460c4ef54a0;ds=sidebyside Lock always the address space if we changing the virtual mapping. This is necessary because we can create or remove a page table. svn path=/trunk/; revision=18848 --- diff --git a/reactos/ntoskrnl/mm/anonmem.c b/reactos/ntoskrnl/mm/anonmem.c index e880d56ad03..ffb125750dd 100644 --- a/reactos/ntoskrnl/mm/anonmem.c +++ b/reactos/ntoskrnl/mm/anonmem.c @@ -171,6 +171,7 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace, */ if (!WasDirty) { + MmLockAddressSpace(AddressSpace); MmDeleteVirtualMapping(AddressSpace->Process, Address, FALSE, NULL, NULL); MmDeleteAllRmaps(Page, NULL, NULL); if ((SwapEntry = MmGetSavedSwapEntryPage(Page)) != 0) @@ -178,6 +179,7 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace, MmCreatePageFileMapping(AddressSpace->Process, Address, SwapEntry); MmSetSavedSwapEntryPage(Page, 0); } + MmUnlockAddressSpace(AddressSpace); MmReleasePageMemoryConsumer(MC_USER, Page); PageOp->Status = STATUS_SUCCESS; KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE); @@ -222,8 +224,10 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace, * Otherwise we have succeeded, free the page */ DPRINT("MM: Swapped out virtual memory page 0x%.8X!\n", Page << PAGE_SHIFT); + MmLockAddressSpace(AddressSpace); MmDeleteVirtualMapping(AddressSpace->Process, Address, FALSE, NULL, NULL); MmCreatePageFileMapping(AddressSpace->Process, Address, SwapEntry); + MmUnlockAddressSpace(AddressSpace); MmDeleteAllRmaps(Page, NULL, NULL); MmSetSavedSwapEntryPage(Page, 0); MmReleasePageMemoryConsumer(MC_USER, Page); @@ -997,7 +1001,7 @@ MmQueryAnonMem(PMEMORY_AREA MemoryArea, Info->BaseAddress = RegionBase; Info->AllocationBase = MemoryArea->StartingAddress; Info->AllocationProtect = MemoryArea->Attributes; - Info->RegionSize = (char*)RegionBase + Region->Length - (char*)Info->BaseAddress; + Info->RegionSize = Region->Length; Info->State = Region->Type; Info->Protect = Region->Protect; Info->Type = MEM_PRIVATE;