mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 01:12:06 +00:00
[NTOSKRNL]
- Implement MiUnlockProcessWorkingSetShared() and make use of it in MiUnlockProcessWorkingSetForFault(). - Complete implementation of MiLockProcessWorkingSetForFault() svn path=/trunk/; revision=60871
This commit is contained in:
parent
54f8e25e93
commit
3683c7c49a
|
@ -1192,6 +1192,30 @@ MiUnlockProcessWorkingSet(IN PEPROCESS Process,
|
||||||
KeLeaveGuardedRegion();
|
KeLeaveGuardedRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Unlocks the working set for the given process
|
||||||
|
//
|
||||||
|
FORCEINLINE
|
||||||
|
VOID
|
||||||
|
MiUnlockProcessWorkingSetShared(IN PEPROCESS Process,
|
||||||
|
IN PETHREAD Thread)
|
||||||
|
{
|
||||||
|
/* Make sure we are the owner of a safe acquisition (because shared) */
|
||||||
|
ASSERT(MI_WS_OWNER(Process));
|
||||||
|
ASSERT(!MI_IS_WS_UNSAFE(Process));
|
||||||
|
|
||||||
|
/* Ensure we are in a shared acquisition */
|
||||||
|
ASSERT(Thread->OwnsProcessWorkingSetShared == TRUE);
|
||||||
|
ASSERT(Thread->OwnsProcessWorkingSetExclusive == FALSE);
|
||||||
|
|
||||||
|
/* Don't claim the lock anylonger */
|
||||||
|
Thread->OwnsProcessWorkingSetShared = FALSE;
|
||||||
|
|
||||||
|
/* Release the lock and re-enable APCs */
|
||||||
|
ExReleasePushLockShared(&Process->Vm.WorkingSetMutex);
|
||||||
|
KeLeaveGuardedRegion();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Unlocks the working set for the given process
|
// Unlocks the working set for the given process
|
||||||
//
|
//
|
||||||
|
@ -1330,7 +1354,7 @@ MiUnlockProcessWorkingSetForFault(IN PEPROCESS Process,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Owner is shared (implies safe), release normally */
|
/* Owner is shared (implies safe), release normally */
|
||||||
ASSERT(FALSE);
|
MiUnlockProcessWorkingSetShared(Process, Thread);
|
||||||
*Safe = TRUE;
|
*Safe = TRUE;
|
||||||
*Shared = TRUE;
|
*Shared = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1343,16 +1367,24 @@ MiLockProcessWorkingSetForFault(IN PEPROCESS Process,
|
||||||
IN BOOLEAN Safe,
|
IN BOOLEAN Safe,
|
||||||
IN BOOLEAN Shared)
|
IN BOOLEAN Shared)
|
||||||
{
|
{
|
||||||
ASSERT(Shared == FALSE);
|
|
||||||
|
|
||||||
/* Check if this was a safe lock or not */
|
/* Check if this was a safe lock or not */
|
||||||
if (Safe)
|
if (Safe)
|
||||||
{
|
{
|
||||||
/* Reacquire safely */
|
if (Shared)
|
||||||
MiLockProcessWorkingSet(Process, Thread);
|
{
|
||||||
|
/* Reacquire safely & shared */
|
||||||
|
MiLockProcessWorkingSetShared(Process, Thread);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Reacquire safely */
|
||||||
|
MiLockProcessWorkingSet(Process, Thread);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Unsafe lock cannot be shared */
|
||||||
|
ASSERT(Shared == FALSE);
|
||||||
/* Reacquire unsafely */
|
/* Reacquire unsafely */
|
||||||
MiLockProcessWorkingSetUnsafe(Process, Thread);
|
MiLockProcessWorkingSetUnsafe(Process, Thread);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue