Author: arty
Date: Tue Jun 12 22:31:54 2012
New Revision: 56727
URL:
http://svn.reactos.org/svn/reactos?rev=56727&view=rev
Log:
[NTOSKRNL]
When a VAD is truncated using VirtualFree, truncate the corresponding MemoryArea
so new allocations will match in both spaces.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/virtual.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] Tue Jun 12 22:31:54 2012
@@ -4214,6 +4214,8 @@
//
if ((EndingAddress >> PAGE_SHIFT) == Vad->EndingVpn)
{
+ PMEMORY_AREA MemoryArea;
+
//
// This is pretty easy and similar to case A. We compute the
// amount of pages to decommit, update the VAD's commit charge
@@ -4226,7 +4228,12 @@
Vad,
Process);
Vad->u.VadFlags.CommitCharge -= CommitReduction;
+ // For ReactOS: shrink the corresponding memory area
+ MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
(PVOID)StartingAddress);
+ ASSERT(Vad->StartingVpn << PAGE_SHIFT ==
(ULONG_PTR)MemoryArea->StartingAddress);
+ ASSERT((Vad->EndingVpn + 1) << PAGE_SHIFT ==
(ULONG_PTR)MemoryArea->EndingAddress);
Vad->EndingVpn = ((ULONG_PTR)StartingAddress - 1) >>
PAGE_SHIFT;
+ MemoryArea->EndingAddress = (PVOID)(((Vad->EndingVpn + 1)
<< PAGE_SHIFT) - 1);
}
else
{