Author: tkreuzer
Date: Sun Apr 1 13:34:18 2012
New Revision: 56300
URL:
http://svn.reactos.org/svn/reactos?rev=56300&view=rev
Log:
[NTOSKRNL]
- If neccessary unlock the working set in MiMakeSystemAddressValid before calling
MmAccessFault, fixes a failed ASSERT, when coming from NtFreeVirtualMemory
- Remove duplicated ASSERT
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?r…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Sun Apr 1 13:34:18 2012
@@ -917,7 +917,6 @@
//ASSERT(Process->Vm.Flags.AcquiredUnsafe == 0);
/* Okay, now we can own it exclusively */
- ASSERT(Thread->OwnsProcessWorkingSetExclusive == FALSE);
Thread->OwnsProcessWorkingSetExclusive = TRUE;
}
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] Sun Apr 1 13:34:18 2012
@@ -34,7 +34,8 @@
IN PEPROCESS CurrentProcess)
{
NTSTATUS Status;
- BOOLEAN LockChange = FALSE;
+ BOOLEAN WsWasLocked = FALSE, LockChange = FALSE;
+ PETHREAD CurrentThread = PsGetCurrentThread();
/* Must be a non-pool page table, since those are double-mapped already */
ASSERT(PageTableVirtualAddress > MM_HIGHEST_USER_ADDRESS);
@@ -47,6 +48,14 @@
/* Check if the page table is valid */
while (!MmIsAddressValid(PageTableVirtualAddress))
{
+ /* Check if the WS is locked */
+ if (CurrentThread->OwnsProcessWorkingSetExclusive)
+ {
+ /* Unlock the working set and remember it was locked */
+ MiUnlockProcessWorkingSet(CurrentProcess, CurrentThread);
+ WsWasLocked = TRUE;
+ }
+
/* Fault it in */
Status = MmAccessFault(FALSE, PageTableVirtualAddress, KernelMode, NULL);
if (!NT_SUCCESS(Status))
@@ -58,6 +67,9 @@
(ULONG_PTR)CurrentProcess,
(ULONG_PTR)PageTableVirtualAddress);
}
+
+ /* Lock the working set again */
+ if (WsWasLocked) MiLockProcessWorkingSet(CurrentProcess, CurrentThread);
/* This flag will be useful later when we do better locking */
LockChange = TRUE;