Author: sir_richard
Date: Tue Oct 5 05:00:19 2010
New Revision: 48990
URL:
http://svn.reactos.org/svn/reactos?rev=48990&view=rev
Log:
[NTOS]: Use the Spare flag in the VAD as a ReactOS/MemoryArea specific flag to signify
that this VAD is associated with a MEMORY_AREA and should be unlinked at process exit, but
not freed. This is because MemoryAreas themselves are cleaned up later, and in the future
their associated VADs (not yet in Trunk) will also be parsed. In the process death
scenario, those VADs will be freed, but not unlinked (since it would already have been
unlinked).
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Tue Oct 5 05:00:19 2010
@@ -125,7 +125,7 @@
/* Build the rest of the VAD now */
Vad->StartingVpn = (*Base) >> PAGE_SHIFT;
- Vad->EndingVpn = ((*Base) + Size - 1) >> PAGE_SHIFT;
+ Vad->EndingVpn = ((*Base) + Size - 1) >> PAGE_SHIFT;
Vad->u3.Secured.StartVpn = *Base;
Vad->u3.Secured.EndVpn = (Vad->EndingVpn << PAGE_SHIFT) | (PAGE_SIZE -
1);
Vad->u1.Parent = NULL;
@@ -1195,6 +1195,14 @@
/* Release the working set */
MiUnlockProcessWorkingSet(Process, Thread);
+ /* Skip ARM3 fake VADs, they'll be freed by MmDeleteProcessAddresSpace */
+ if (Vad->u.VadFlags.Spare == 1)
+ {
+ /* Set a flag so MmDeleteMemoryArea knows to free, but not to remove */
+ Vad->u.VadFlags.Spare = 2;
+ continue;
+ }
+
/* Free the VAD memory */
ExFreePool(Vad);
}