[NTOS:KE] Rename some locking functions to reflect the IRQL level changes

* KiAcquireApcLock -> KiAcquireApcLockRaiseToSynch
* KiAcquireApcLockAtDpcLevel -> KiAcquireApcLockAtSynchLevel
* KiReleaseApcLockFromDpcLevel -> KiReleaseApcLockFromSynchLevel
* KiAcquireApcLockAtApcLevel -> KiAcquireApcLockRaiseToDpc
* KiAcquireProcessLock -> KiAcquireProcessLockRaiseToSynch
* KiReleaseProcessLockFromDpcLevel -> KiReleaseProcessLockFromSynchLevel
* KiAcquireDispatcherLockAtDpcLevel -> KiAcquireDispatcherLockAtSynchLevel
* KiReleaseDispatcherLockFromDpcLevel -> KiReleaseDispatcherLockFromSynchLevel
* Add some ASSERTs
This commit is contained in:
Timo Kreuzer 2019-12-30 15:34:38 +01:00
parent 3b430eefdd
commit 7523a7b138
9 changed files with 120 additions and 116 deletions

View file

@ -157,17 +157,18 @@ KiReleaseDispatcherLock(IN KIRQL OldIrql)
FORCEINLINE FORCEINLINE
VOID VOID
KiAcquireDispatcherLockAtDpcLevel(VOID) KiAcquireDispatcherLockAtSynchLevel(VOID)
{ {
/* This is a no-op at DPC Level for UP systems */ /* This is a no-op at SYNCH_LEVEL for UP systems */
ASSERT(KeGetCurrentIrql() >= SYNCH_LEVEL);
return; return;
} }
FORCEINLINE FORCEINLINE
VOID VOID
KiReleaseDispatcherLockFromDpcLevel(VOID) KiReleaseDispatcherLockFromSynchLevel(VOID)
{ {
/* This is a no-op at DPC Level for UP systems */ /* This is a no-op at SYNCH_LEVEL for UP systems */
return; return;
} }
@ -360,16 +361,17 @@ KiReleaseDispatcherLock(IN KIRQL OldIrql)
FORCEINLINE FORCEINLINE
VOID VOID
KiAcquireDispatcherLockAtDpcLevel(VOID) KiAcquireDispatcherLockAtSynchLevel(VOID)
{ {
/* Acquire the dispatcher lock */ /* Acquire the dispatcher lock */
ASSERT(KeGetCurrentIrql() >= SYNCH_LEVEL);
KeAcquireQueuedSpinLockAtDpcLevel(&KeGetCurrentPrcb()-> KeAcquireQueuedSpinLockAtDpcLevel(&KeGetCurrentPrcb()->
LockQueue[LockQueueDispatcherLock]); LockQueue[LockQueueDispatcherLock]);
} }
FORCEINLINE FORCEINLINE
VOID VOID
KiReleaseDispatcherLockFromDpcLevel(VOID) KiReleaseDispatcherLockFromSynchLevel(VOID)
{ {
/* Release the dispatcher lock */ /* Release the dispatcher lock */
KeReleaseQueuedSpinLockFromDpcLevel(&KeGetCurrentPrcb()-> KeReleaseQueuedSpinLockFromDpcLevel(&KeGetCurrentPrcb()->
@ -597,7 +599,7 @@ KiReleaseTimerLock(IN PKSPIN_LOCK_QUEUE LockQueue)
FORCEINLINE FORCEINLINE
VOID VOID
KiAcquireApcLock(IN PKTHREAD Thread, KiAcquireApcLockRaiseToSynch(IN PKTHREAD Thread,
IN PKLOCK_QUEUE_HANDLE Handle) IN PKLOCK_QUEUE_HANDLE Handle)
{ {
/* Acquire the lock and raise to synchronization level */ /* Acquire the lock and raise to synchronization level */
@ -606,16 +608,17 @@ KiAcquireApcLock(IN PKTHREAD Thread,
FORCEINLINE FORCEINLINE
VOID VOID
KiAcquireApcLockAtDpcLevel(IN PKTHREAD Thread, KiAcquireApcLockAtSynchLevel(IN PKTHREAD Thread,
IN PKLOCK_QUEUE_HANDLE Handle) IN PKLOCK_QUEUE_HANDLE Handle)
{ {
/* Acquire the lock */ /* Acquire the lock */
ASSERT(KeGetCurrentIrql() >= SYNCH_LEVEL);
KeAcquireInStackQueuedSpinLockAtDpcLevel(&Thread->ApcQueueLock, Handle); KeAcquireInStackQueuedSpinLockAtDpcLevel(&Thread->ApcQueueLock, Handle);
} }
FORCEINLINE FORCEINLINE
VOID VOID
KiAcquireApcLockAtApcLevel(IN PKTHREAD Thread, KiAcquireApcLockRaiseToDpc(IN PKTHREAD Thread,
IN PKLOCK_QUEUE_HANDLE Handle) IN PKLOCK_QUEUE_HANDLE Handle)
{ {
/* Acquire the lock */ /* Acquire the lock */
@ -632,7 +635,7 @@ KiReleaseApcLock(IN PKLOCK_QUEUE_HANDLE Handle)
FORCEINLINE FORCEINLINE
VOID VOID
KiReleaseApcLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE Handle) KiReleaseApcLockFromSynchLevel(IN PKLOCK_QUEUE_HANDLE Handle)
{ {
/* Release the lock */ /* Release the lock */
KeReleaseInStackQueuedSpinLockFromDpcLevel(Handle); KeReleaseInStackQueuedSpinLockFromDpcLevel(Handle);
@ -640,7 +643,7 @@ KiReleaseApcLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE Handle)
FORCEINLINE FORCEINLINE
VOID VOID
KiAcquireProcessLock(IN PKPROCESS Process, KiAcquireProcessLockRaiseToSynch(IN PKPROCESS Process,
IN PKLOCK_QUEUE_HANDLE Handle) IN PKLOCK_QUEUE_HANDLE Handle)
{ {
/* Acquire the lock and raise to synchronization level */ /* Acquire the lock and raise to synchronization level */
@ -651,15 +654,15 @@ FORCEINLINE
VOID VOID
KiReleaseProcessLock(IN PKLOCK_QUEUE_HANDLE Handle) KiReleaseProcessLock(IN PKLOCK_QUEUE_HANDLE Handle)
{ {
/* Release the lock */ /* Release the lock and restore previous IRQL */
KeReleaseInStackQueuedSpinLock(Handle); KeReleaseInStackQueuedSpinLock(Handle);
} }
FORCEINLINE FORCEINLINE
VOID VOID
KiReleaseProcessLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE Handle) KiReleaseProcessLockFromSynchLevel(IN PKLOCK_QUEUE_HANDLE Handle)
{ {
/* Release the lock */ /* Release the lock without lowering IRQL */
KeReleaseInStackQueuedSpinLockFromDpcLevel(Handle); KeReleaseInStackQueuedSpinLockFromDpcLevel(Handle);
} }
@ -916,10 +919,11 @@ KxInsertTimer(IN PKTIMER Timer,
IN ULONG Hand) IN ULONG Hand)
{ {
PKSPIN_LOCK_QUEUE LockQueue; PKSPIN_LOCK_QUEUE LockQueue;
ASSERT(KeGetCurrentIrql() >= SYNCH_LEVEL);
/* Acquire the lock and release the dispatcher lock */ /* Acquire the lock and release the dispatcher lock */
LockQueue = KiAcquireTimerLock(Hand); LockQueue = KiAcquireTimerLock(Hand);
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Try to insert the timer */ /* Try to insert the timer */
if (KiInsertTimerTable(Timer, Hand)) if (KiInsertTimerTable(Timer, Hand))

View file

@ -264,7 +264,7 @@ KiInsertQueueApc(IN PKAPC Apc,
} }
/* Release dispatcher lock */ /* Release dispatcher lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Check if an interrupt was requested */ /* Check if an interrupt was requested */
KiRequestApcInterrupt(RequestInterrupt, Thread->NextProcessor); KiRequestApcInterrupt(RequestInterrupt, Thread->NextProcessor);
@ -330,7 +330,7 @@ KiDeliverApc(IN KPROCESSOR_MODE DeliveryMode,
while (!IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode])) while (!IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode]))
{ {
/* Lock the APC Queue */ /* Lock the APC Queue */
KiAcquireApcLockAtApcLevel(Thread, &ApcLock); KiAcquireApcLockRaiseToDpc(Thread, &ApcLock);
/* Check if the list became empty now */ /* Check if the list became empty now */
if (IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode])) if (IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode]))
@ -441,7 +441,7 @@ KiDeliverApc(IN KPROCESSOR_MODE DeliveryMode,
(Thread->ApcState.UserApcPending)) (Thread->ApcState.UserApcPending))
{ {
/* Lock the APC Queue */ /* Lock the APC Queue */
KiAcquireApcLockAtApcLevel(Thread, &ApcLock); KiAcquireApcLockRaiseToDpc(Thread, &ApcLock);
/* It's not pending anymore */ /* It's not pending anymore */
Thread->ApcState.UserApcPending = FALSE; Thread->ApcState.UserApcPending = FALSE;
@ -744,7 +744,7 @@ KeInsertQueueApc(IN PKAPC Apc,
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Get the APC lock */ /* Get the APC lock */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Make sure we can Queue APCs and that this one isn't already inserted */ /* Make sure we can Queue APCs and that this one isn't already inserted */
if (!(Thread->ApcQueueable) || (Apc->Inserted)) if (!(Thread->ApcQueueable) || (Apc->Inserted))
@ -764,7 +764,7 @@ KeInsertQueueApc(IN PKAPC Apc,
} }
/* Release the APC lock and return success */ /* Release the APC lock and return success */
KiReleaseApcLockFromDpcLevel(&ApcLock); KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql); KiExitDispatcher(ApcLock.OldIrql);
return State; return State;
} }
@ -802,7 +802,7 @@ KeFlushQueueApc(IN PKTHREAD Thread,
if (PreviousMode == UserMode) if (PreviousMode == UserMode)
{ {
/* Get the APC lock */ /* Get the APC lock */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Select user list and check if it's empty */ /* Select user list and check if it's empty */
if (IsListEmpty(&Thread->ApcState.ApcListHead[UserMode])) if (IsListEmpty(&Thread->ApcState.ApcListHead[UserMode]))
@ -822,7 +822,7 @@ KeFlushQueueApc(IN PKTHREAD Thread,
} }
/* Otherwise, acquire the APC lock */ /* Otherwise, acquire the APC lock */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
} }
/* Get the first entry and check if the list is empty now */ /* Get the first entry and check if the list is empty now */
@ -892,8 +892,8 @@ KeRemoveQueueApc(IN PKAPC Apc)
ASSERT_APC(Apc); ASSERT_APC(Apc);
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Get the APC lock */ /* Get the APC lock (this raises IRQL to SYNCH_LEVEL) */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Check if it's inserted */ /* Check if it's inserted */
Inserted = Apc->Inserted; Inserted = Apc->Inserted;
@ -904,7 +904,7 @@ KeRemoveQueueApc(IN PKAPC Apc)
ApcState = Thread->ApcStatePointer[(UCHAR)Apc->ApcStateIndex]; ApcState = Thread->ApcStatePointer[(UCHAR)Apc->ApcStateIndex];
/* Acquire the dispatcher lock and remove it from the list */ /* Acquire the dispatcher lock and remove it from the list */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
if (RemoveEntryList(&Apc->ApcListEntry)) if (RemoveEntryList(&Apc->ApcListEntry))
{ {
/* Set the correct state based on the APC Mode */ /* Set the correct state based on the APC Mode */
@ -921,7 +921,7 @@ KeRemoveQueueApc(IN PKAPC Apc)
} }
/* Release dispatcher lock */ /* Release dispatcher lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
} }
/* Release the lock and return */ /* Release the lock and return */

View file

@ -44,7 +44,7 @@ KeWaitForGate(IN PKGATE Gate,
do do
{ {
/* Acquire the APC lock */ /* Acquire the APC lock */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Check if a kernel APC is pending and we're below APC_LEVEL */ /* Check if a kernel APC is pending and we're below APC_LEVEL */
if ((Thread->ApcState.KernelApcPending) && if ((Thread->ApcState.KernelApcPending) &&
@ -58,7 +58,7 @@ KeWaitForGate(IN PKGATE Gate,
{ {
/* Check if we have a queue and lock the dispatcher if so */ /* Check if we have a queue and lock the dispatcher if so */
Queue = Thread->Queue; Queue = Thread->Queue;
if (Queue) KiAcquireDispatcherLockAtDpcLevel(); if (Queue) KiAcquireDispatcherLockAtSynchLevel();
/* Lock the thread */ /* Lock the thread */
KiAcquireThreadLock(Thread); KiAcquireThreadLock(Thread);
@ -77,7 +77,7 @@ KeWaitForGate(IN PKGATE Gate,
KiReleaseThreadLock(Thread); KiReleaseThreadLock(Thread);
/* Release the gate lock */ /* Release the gate lock */
if (Queue) KiReleaseDispatcherLockFromDpcLevel(); if (Queue) KiReleaseDispatcherLockFromSynchLevel();
/* Release the APC lock and return */ /* Release the APC lock and return */
KiReleaseApcLock(&ApcLock); KiReleaseApcLock(&ApcLock);
@ -116,11 +116,11 @@ KeWaitForGate(IN PKGATE Gate,
KiActivateWaiterQueue(Queue); KiActivateWaiterQueue(Queue);
/* Release the dispatcher lock */ /* Release the dispatcher lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
} }
/* Release the APC lock but stay at DPC level */ /* Release the APC lock but stay at DPC level */
KiReleaseApcLockFromDpcLevel(&ApcLock); KiReleaseApcLockFromSynchLevel(&ApcLock);
/* Find a new thread to run */ /* Find a new thread to run */
Status = KiSwapThread(Thread, KeGetCurrentPrcb()); Status = KiSwapThread(Thread, KeGetCurrentPrcb());
@ -203,7 +203,7 @@ KeSignalGateBoostPriority(IN PKGATE Gate)
if (WaitThread->Queue) if (WaitThread->Queue)
{ {
/* Acquire the dispatcher lock */ /* Acquire the dispatcher lock */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Check if we still have one */ /* Check if we still have one */
if (WaitThread->Queue) if (WaitThread->Queue)
@ -213,7 +213,7 @@ KeSignalGateBoostPriority(IN PKGATE Gate)
} }
/* Release lock */ /* Release lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
} }
/* Make the thread ready */ /* Make the thread ready */

View file

@ -92,10 +92,10 @@ KiAttachProcess(IN PKTHREAD Thread,
#endif #endif
/* Release dispatcher lock */ /* Release dispatcher lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Release lock */ /* Release lock */
KiReleaseApcLockFromDpcLevel(ApcLock); KiReleaseApcLockFromSynchLevel(ApcLock);
/* Swap Processes */ /* Swap Processes */
KiSwapProcess(Process, SavedApcState->Process); KiSwapProcess(Process, SavedApcState->Process);
@ -236,7 +236,7 @@ KeSetQuantumProcess(IN PKPROCESS Process,
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the process */ /* Lock the process */
KiAcquireProcessLock(Process, &ProcessLock); KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock);
/* Set new quantum */ /* Set new quantum */
Process->QuantumReset = Quantum; Process->QuantumReset = Quantum;
@ -275,10 +275,10 @@ KeSetAffinityProcess(IN PKPROCESS Process,
ASSERT((Affinity & KeActiveProcessors) != 0); ASSERT((Affinity & KeActiveProcessors) != 0);
/* Lock the process */ /* Lock the process */
KiAcquireProcessLock(Process, &ProcessLock); KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock);
/* Acquire the dispatcher lock */ /* Acquire the dispatcher lock */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Capture old affinity and update it */ /* Capture old affinity and update it */
OldAffinity = Process->Affinity; OldAffinity = Process->Affinity;
@ -298,10 +298,10 @@ KeSetAffinityProcess(IN PKPROCESS Process,
} }
/* Release Dispatcher Database */ /* Release Dispatcher Database */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Release the process lock */ /* Release the process lock */
KiReleaseProcessLockFromDpcLevel(&ProcessLock); KiReleaseProcessLockFromSynchLevel(&ProcessLock);
KiExitDispatcher(ProcessLock.OldIrql); KiExitDispatcher(ProcessLock.OldIrql);
/* Return previous affinity */ /* Return previous affinity */
@ -365,7 +365,7 @@ KeSetPriorityAndQuantumProcess(IN PKPROCESS Process,
if (!Priority) Priority = LOW_PRIORITY + 1; if (!Priority) Priority = LOW_PRIORITY + 1;
/* Lock the process */ /* Lock the process */
KiAcquireProcessLock(Process, &ProcessLock); KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock);
/* Check if we are modifying the quantum too */ /* Check if we are modifying the quantum too */
if (Quantum) Process->QuantumReset = Quantum; if (Quantum) Process->QuantumReset = Quantum;
@ -507,10 +507,10 @@ KeSetPriorityAndQuantumProcess(IN PKPROCESS Process,
} }
/* Release Dispatcher Database */ /* Release Dispatcher Database */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Release the process lock */ /* Release the process lock */
KiReleaseProcessLockFromDpcLevel(&ProcessLock); KiReleaseProcessLockFromSynchLevel(&ProcessLock);
KiExitDispatcher(ProcessLock.OldIrql); KiExitDispatcher(ProcessLock.OldIrql);
/* Return previous priority */ /* Return previous priority */
@ -531,7 +531,7 @@ KeQueryValuesProcess(IN PKPROCESS Process,
ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL); ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
/* Lock the process */ /* Lock the process */
KiAcquireProcessLock(Process, &ProcessLock); KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock);
/* Initialize user and kernel times */ /* Initialize user and kernel times */
TotalKernel = Process->KernelTime; TotalKernel = Process->KernelTime;
@ -600,10 +600,10 @@ KeAttachProcess(IN PKPROCESS Process)
else else
{ {
/* Acquire APC Lock */ /* Acquire APC Lock */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Acquire the dispatcher lock */ /* Acquire the dispatcher lock */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Legit attach attempt: do it! */ /* Legit attach attempt: do it! */
KiAttachProcess(Thread, Process, &ApcLock, &Thread->SavedApcState); KiAttachProcess(Thread, Process, &ApcLock, &Thread->SavedApcState);
@ -626,7 +626,7 @@ KeDetachProcess(VOID)
if (Thread->ApcStateIndex == OriginalApcEnvironment) return; if (Thread->ApcStateIndex == OriginalApcEnvironment) return;
/* Acquire APC Lock */ /* Acquire APC Lock */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Check for invalid attach attempts */ /* Check for invalid attach attempts */
if ((Thread->ApcState.KernelApcInProgress) || if ((Thread->ApcState.KernelApcInProgress) ||
@ -641,7 +641,7 @@ KeDetachProcess(VOID)
Process = Thread->ApcState.Process; Process = Thread->ApcState.Process;
/* Acquire dispatcher lock */ /* Acquire dispatcher lock */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Decrease the stack count */ /* Decrease the stack count */
ASSERT(Process->StackCount != 0); ASSERT(Process->StackCount != 0);
@ -655,7 +655,7 @@ KeDetachProcess(VOID)
} }
/* Release dispatcher lock */ /* Release dispatcher lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Restore the APC State */ /* Restore the APC State */
KiMoveApcState(&Thread->SavedApcState, &Thread->ApcState); KiMoveApcState(&Thread->SavedApcState, &Thread->ApcState);
@ -665,7 +665,7 @@ KeDetachProcess(VOID)
Thread->ApcStateIndex = OriginalApcEnvironment; Thread->ApcStateIndex = OriginalApcEnvironment;
/* Release lock */ /* Release lock */
KiReleaseApcLockFromDpcLevel(&ApcLock); KiReleaseApcLockFromSynchLevel(&ApcLock);
/* Swap Processes */ /* Swap Processes */
KiSwapProcess(Thread->ApcState.Process, Process); KiSwapProcess(Thread->ApcState.Process, Process);
@ -726,10 +726,10 @@ KeStackAttachProcess(IN PKPROCESS Process,
} }
/* Acquire APC Lock */ /* Acquire APC Lock */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Acquire dispatcher lock */ /* Acquire dispatcher lock */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Check if the Current Thread is already attached */ /* Check if the Current Thread is already attached */
if (Thread->ApcStateIndex != OriginalApcEnvironment) if (Thread->ApcStateIndex != OriginalApcEnvironment)
@ -764,7 +764,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
for (;;) for (;;)
{ {
/* Acquire APC Lock */ /* Acquire APC Lock */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Check if a kernel APC is pending */ /* Check if a kernel APC is pending */
if (Thread->ApcState.KernelApcPending) if (Thread->ApcState.KernelApcPending)
@ -799,7 +799,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
Process = Thread->ApcState.Process; Process = Thread->ApcState.Process;
/* Acquire dispatcher lock */ /* Acquire dispatcher lock */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Decrease the stack count */ /* Decrease the stack count */
ASSERT(Process->StackCount != 0); ASSERT(Process->StackCount != 0);
@ -813,7 +813,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
} }
/* Release dispatcher lock */ /* Release dispatcher lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Check if there's an APC state to restore */ /* Check if there's an APC state to restore */
if (ApcState->Process) if (ApcState->Process)
@ -832,7 +832,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
} }
/* Release lock */ /* Release lock */
KiReleaseApcLockFromDpcLevel(&ApcLock); KiReleaseApcLockFromSynchLevel(&ApcLock);
/* Swap Processes */ /* Swap Processes */
KiSwapProcess(Thread->ApcState.Process, Process); KiSwapProcess(Thread->ApcState.Process, Process);
@ -869,7 +869,7 @@ KeQueryRuntimeProcess(IN PKPROCESS Process,
TotalKernel = Process->KernelTime; TotalKernel = Process->KernelTime;
/* Lock the process */ /* Lock the process */
KiAcquireProcessLock(Process, &ProcessLock); KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock);
/* Loop all child threads and sum up their times */ /* Loop all child threads and sum up their times */
ListHead = &Process->ThreadListHead; ListHead = &Process->ThreadListHead;

View file

@ -265,7 +265,7 @@ KeRemoveQueue(IN PKQUEUE Queue,
/* Raise IRQL to synch, prepare the wait, then lock the database */ /* Raise IRQL to synch, prepare the wait, then lock the database */
Thread->WaitIrql = KeRaiseIrqlToSynchLevel(); Thread->WaitIrql = KeRaiseIrqlToSynchLevel();
KxQueueThreadWait(); KxQueueThreadWait();
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
} }
/* /*
@ -339,7 +339,7 @@ KeRemoveQueue(IN PKQUEUE Queue,
{ {
/* Increment the count and unlock the dispatcher */ /* Increment the count and unlock the dispatcher */
Queue->CurrentCount++; Queue->CurrentCount++;
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
KiExitDispatcher(Thread->WaitIrql); KiExitDispatcher(Thread->WaitIrql);
} }
else else
@ -394,7 +394,7 @@ KeRemoveQueue(IN PKQUEUE Queue,
else else
{ {
/* Otherwise, unlock the dispatcher */ /* Otherwise, unlock the dispatcher */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
} }
/* Do the actual swap */ /* Do the actual swap */
@ -419,13 +419,13 @@ KeRemoveQueue(IN PKQUEUE Queue,
/* Start another wait */ /* Start another wait */
Thread->WaitIrql = KeRaiseIrqlToSynchLevel(); Thread->WaitIrql = KeRaiseIrqlToSynchLevel();
KxQueueThreadWait(); KxQueueThreadWait();
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
Queue->CurrentCount--; Queue->CurrentCount--;
} }
} }
/* Unlock Database and return */ /* Unlock Database and return */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
KiExitDispatcher(Thread->WaitIrql); KiExitDispatcher(Thread->WaitIrql);
return QueueEntry; return QueueEntry;
} }
@ -477,7 +477,7 @@ KeRundownQueue(IN PKQUEUE Queue)
} }
/* Release the dispatcher lock */ /* Release the dispatcher lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Exit the dispatcher and return the first entry (if any) */ /* Exit the dispatcher and return the first entry (if any) */
KiExitDispatcher(OldIrql); KiExitDispatcher(OldIrql);

View file

@ -138,8 +138,8 @@ KeAlertResumeThread(IN PKTHREAD Thread)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the Dispatcher Database and the APC Queue */ /* Lock the Dispatcher Database and the APC Queue */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Return if Thread is already alerted. */ /* Return if Thread is already alerted. */
if (!Thread->Alerted[KernelMode]) if (!Thread->Alerted[KernelMode])
@ -174,8 +174,8 @@ KeAlertResumeThread(IN PKTHREAD Thread)
} }
/* Release Locks and return the Old State */ /* Release Locks and return the Old State */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
KiReleaseApcLockFromDpcLevel(&ApcLock); KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql); KiExitDispatcher(ApcLock.OldIrql);
return PreviousCount; return PreviousCount;
} }
@ -191,8 +191,8 @@ KeAlertThread(IN PKTHREAD Thread,
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the Dispatcher Database and the APC Queue */ /* Lock the Dispatcher Database and the APC Queue */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Save the Previous State */ /* Save the Previous State */
PreviousState = Thread->Alerted[AlertMode]; PreviousState = Thread->Alerted[AlertMode];
@ -216,8 +216,8 @@ KeAlertThread(IN PKTHREAD Thread,
} }
/* Release the Dispatcher Lock */ /* Release the Dispatcher Lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
KiReleaseApcLockFromDpcLevel(&ApcLock); KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql); KiExitDispatcher(ApcLock.OldIrql);
/* Return the old state */ /* Return the old state */
@ -281,7 +281,7 @@ KeForceResumeThread(IN PKTHREAD Thread)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the APC Queue */ /* Lock the APC Queue */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Save the old Suspend Count */ /* Save the old Suspend Count */
PreviousCount = Thread->SuspendCount + Thread->FreezeCount; PreviousCount = Thread->SuspendCount + Thread->FreezeCount;
@ -294,18 +294,18 @@ KeForceResumeThread(IN PKTHREAD Thread)
Thread->FreezeCount = 0; Thread->FreezeCount = 0;
/* Lock the dispatcher */ /* Lock the dispatcher */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Signal and satisfy */ /* Signal and satisfy */
Thread->SuspendSemaphore.Header.SignalState++; Thread->SuspendSemaphore.Header.SignalState++;
KiWaitTest(&Thread->SuspendSemaphore.Header, IO_NO_INCREMENT); KiWaitTest(&Thread->SuspendSemaphore.Header, IO_NO_INCREMENT);
/* Release the dispatcher */ /* Release the dispatcher */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
} }
/* Release Lock and return the Old State */ /* Release Lock and return the Old State */
KiReleaseApcLockFromDpcLevel(&ApcLock); KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql); KiExitDispatcher(ApcLock.OldIrql);
return PreviousCount; return PreviousCount;
} }
@ -322,14 +322,14 @@ KeFreezeAllThreads(VOID)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the process */ /* Lock the process */
KiAcquireProcessLock(Process, &LockHandle); KiAcquireProcessLockRaiseToSynch(Process, &LockHandle);
/* If someone is already trying to free us, try again */ /* If someone is already trying to free us, try again */
while (CurrentThread->FreezeCount) while (CurrentThread->FreezeCount)
{ {
/* Release and re-acquire the process lock so the APC will go through */ /* Release and re-acquire the process lock so the APC will go through */
KiReleaseProcessLock(&LockHandle); KiReleaseProcessLock(&LockHandle);
KiAcquireProcessLock(Process, &LockHandle); KiAcquireProcessLockRaiseToSynch(Process, &LockHandle);
} }
/* Enter a critical region */ /* Enter a critical region */
@ -344,7 +344,7 @@ KeFreezeAllThreads(VOID)
Current = CONTAINING_RECORD(NextEntry, KTHREAD, ThreadListEntry); Current = CONTAINING_RECORD(NextEntry, KTHREAD, ThreadListEntry);
/* Lock it */ /* Lock it */
KiAcquireApcLockAtDpcLevel(Current, &ApcLock); KiAcquireApcLockAtSynchLevel(Current, &ApcLock);
/* Make sure it's not ours, and check if APCs are enabled */ /* Make sure it's not ours, and check if APCs are enabled */
if ((Current != CurrentThread) && (Current->ApcQueueable)) if ((Current != CurrentThread) && (Current->ApcQueueable))
@ -369,26 +369,26 @@ KeFreezeAllThreads(VOID)
else else
{ {
/* Lock the dispatcher */ /* Lock the dispatcher */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Unsignal the semaphore, the APC was already inserted */ /* Unsignal the semaphore, the APC was already inserted */
Current->SuspendSemaphore.Header.SignalState--; Current->SuspendSemaphore.Header.SignalState--;
/* Release the dispatcher */ /* Release the dispatcher */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
} }
} }
} }
/* Release the APC lock */ /* Release the APC lock */
KiReleaseApcLockFromDpcLevel(&ApcLock); KiReleaseApcLockFromSynchLevel(&ApcLock);
/* Move to the next thread */ /* Move to the next thread */
NextEntry = NextEntry->Flink; NextEntry = NextEntry->Flink;
} while (NextEntry != ListHead); } while (NextEntry != ListHead);
/* Release the process lock and exit the dispatcher */ /* Release the process lock and exit the dispatcher */
KiReleaseProcessLockFromDpcLevel(&LockHandle); KiReleaseProcessLockFromSynchLevel(&LockHandle);
KiExitDispatcher(LockHandle.OldIrql); KiExitDispatcher(LockHandle.OldIrql);
} }
@ -402,7 +402,7 @@ KeResumeThread(IN PKTHREAD Thread)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the APC Queue */ /* Lock the APC Queue */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Save the Old Count */ /* Save the Old Count */
PreviousCount = Thread->SuspendCount; PreviousCount = Thread->SuspendCount;
@ -417,19 +417,19 @@ KeResumeThread(IN PKTHREAD Thread)
if ((!Thread->SuspendCount) && (!Thread->FreezeCount)) if ((!Thread->SuspendCount) && (!Thread->FreezeCount))
{ {
/* Acquire the dispatcher lock */ /* Acquire the dispatcher lock */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Signal the Suspend Semaphore */ /* Signal the Suspend Semaphore */
Thread->SuspendSemaphore.Header.SignalState++; Thread->SuspendSemaphore.Header.SignalState++;
KiWaitTest(&Thread->SuspendSemaphore.Header, IO_NO_INCREMENT); KiWaitTest(&Thread->SuspendSemaphore.Header, IO_NO_INCREMENT);
/* Release the dispatcher lock */ /* Release the dispatcher lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
} }
} }
/* Release APC Queue lock and return the Old State */ /* Release APC Queue lock and return the Old State */
KiReleaseApcLockFromDpcLevel(&ApcLock); KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql); KiExitDispatcher(ApcLock.OldIrql);
return PreviousCount; return PreviousCount;
} }
@ -516,7 +516,7 @@ KeStartThread(IN OUT PKTHREAD Thread)
Thread->SystemAffinityActive = FALSE; Thread->SystemAffinityActive = FALSE;
/* Lock the process */ /* Lock the process */
KiAcquireProcessLock(Process, &LockHandle); KiAcquireProcessLockRaiseToSynch(Process, &LockHandle);
/* Setup volatile data */ /* Setup volatile data */
Thread->Priority = Process->BasePriority; Thread->Priority = Process->BasePriority;
@ -553,7 +553,7 @@ KeStartThread(IN OUT PKTHREAD Thread)
Thread->UserIdealProcessor = IdealProcessor; Thread->UserIdealProcessor = IdealProcessor;
/* Lock the Dispatcher Database */ /* Lock the Dispatcher Database */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Insert the thread into the process list */ /* Insert the thread into the process list */
InsertTailList(&Process->ThreadListHead, &Thread->ThreadListEntry); InsertTailList(&Process->ThreadListHead, &Thread->ThreadListEntry);
@ -563,7 +563,7 @@ KeStartThread(IN OUT PKTHREAD Thread)
Process->StackCount++; Process->StackCount++;
/* Release locks and return */ /* Release locks and return */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
KiReleaseProcessLock(&LockHandle); KiReleaseProcessLock(&LockHandle);
} }
@ -615,7 +615,7 @@ KeSuspendThread(PKTHREAD Thread)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the APC Queue */ /* Lock the APC Queue */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Save the Old Count */ /* Save the Old Count */
PreviousCount = Thread->SuspendCount; PreviousCount = Thread->SuspendCount;
@ -647,19 +647,19 @@ KeSuspendThread(PKTHREAD Thread)
else else
{ {
/* Lock the dispatcher */ /* Lock the dispatcher */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Unsignal the semaphore, the APC was already inserted */ /* Unsignal the semaphore, the APC was already inserted */
Thread->SuspendSemaphore.Header.SignalState--; Thread->SuspendSemaphore.Header.SignalState--;
/* Release the dispatcher */ /* Release the dispatcher */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
} }
} }
} }
/* Release Lock and return the Old State */ /* Release Lock and return the Old State */
KiReleaseApcLockFromDpcLevel(&ApcLock); KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql); KiExitDispatcher(ApcLock.OldIrql);
return PreviousCount; return PreviousCount;
} }
@ -676,7 +676,7 @@ KeThawAllThreads(VOID)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the process */ /* Lock the process */
KiAcquireProcessLock(Process, &LockHandle); KiAcquireProcessLockRaiseToSynch(Process, &LockHandle);
/* Loop the Process's Threads */ /* Loop the Process's Threads */
ListHead = &Process->ThreadListHead; ListHead = &Process->ThreadListHead;
@ -687,7 +687,7 @@ KeThawAllThreads(VOID)
Current = CONTAINING_RECORD(NextEntry, KTHREAD, ThreadListEntry); Current = CONTAINING_RECORD(NextEntry, KTHREAD, ThreadListEntry);
/* Lock it */ /* Lock it */
KiAcquireApcLockAtDpcLevel(Current, &ApcLock); KiAcquireApcLockAtSynchLevel(Current, &ApcLock);
/* Make sure we are frozen */ /* Make sure we are frozen */
OldCount = Current->FreezeCount; OldCount = Current->FreezeCount;
@ -700,26 +700,26 @@ KeThawAllThreads(VOID)
if (!(Current->SuspendCount) && (!Current->FreezeCount)) if (!(Current->SuspendCount) && (!Current->FreezeCount))
{ {
/* Lock the dispatcher */ /* Lock the dispatcher */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Signal the suspend semaphore and wake it */ /* Signal the suspend semaphore and wake it */
Current->SuspendSemaphore.Header.SignalState++; Current->SuspendSemaphore.Header.SignalState++;
KiWaitTest(&Current->SuspendSemaphore, 0); KiWaitTest(&Current->SuspendSemaphore, 0);
/* Unlock the dispatcher */ /* Unlock the dispatcher */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
} }
} }
/* Release the APC lock */ /* Release the APC lock */
KiReleaseApcLockFromDpcLevel(&ApcLock); KiReleaseApcLockFromSynchLevel(&ApcLock);
/* Go to the next one */ /* Go to the next one */
NextEntry = NextEntry->Flink; NextEntry = NextEntry->Flink;
} while (NextEntry != ListHead); } while (NextEntry != ListHead);
/* Release the process lock and exit the dispatcher */ /* Release the process lock and exit the dispatcher */
KiReleaseProcessLockFromDpcLevel(&LockHandle); KiReleaseProcessLockFromSynchLevel(&LockHandle);
KiExitDispatcher(LockHandle.OldIrql); KiExitDispatcher(LockHandle.OldIrql);
/* Leave the critical region */ /* Leave the critical region */
@ -737,7 +737,7 @@ KeTestAlertThread(IN KPROCESSOR_MODE AlertMode)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the Dispatcher Database and the APC Queue */ /* Lock the Dispatcher Database and the APC Queue */
KiAcquireApcLock(Thread, &ApcLock); KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Save the old State */ /* Save the old State */
OldState = Thread->Alerted[AlertMode]; OldState = Thread->Alerted[AlertMode];
@ -1383,7 +1383,7 @@ KeTerminateThread(IN KPRIORITY Increment)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the process */ /* Lock the process */
KiAcquireProcessLock(Process, &LockHandle); KiAcquireProcessLockRaiseToSynch(Process, &LockHandle);
/* Make sure we won't get Swapped */ /* Make sure we won't get Swapped */
KiSetThreadSwapBusy(Thread); KiSetThreadSwapBusy(Thread);
@ -1415,7 +1415,7 @@ KeTerminateThread(IN KPRIORITY Increment)
} while (Entry != SavedEntry); } while (Entry != SavedEntry);
/* Acquire the dispatcher lock */ /* Acquire the dispatcher lock */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Check if the reaper wasn't active */ /* Check if the reaper wasn't active */
if (!Entry) if (!Entry)
@ -1446,7 +1446,7 @@ KeTerminateThread(IN KPRIORITY Increment)
RemoveEntryList(&Thread->ThreadListEntry); RemoveEntryList(&Thread->ThreadListEntry);
/* Release the process lock */ /* Release the process lock */
KiReleaseProcessLockFromDpcLevel(&LockHandle); KiReleaseProcessLockFromSynchLevel(&LockHandle);
/* Set us as terminated, decrease the Process's stack count */ /* Set us as terminated, decrease the Process's stack count */
Thread->State = Terminated; Thread->State = Terminated;
@ -1464,6 +1464,6 @@ KeTerminateThread(IN KPRIORITY Increment)
KiRundownThread(Thread); KiRundownThread(Thread);
/* Swap to a new thread */ /* Swap to a new thread */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
KiSwapThread(Thread, KeGetCurrentPrcb()); KiSwapThread(Thread, KeGetCurrentPrcb());
} }

View file

@ -184,13 +184,13 @@ KiCompleteTimer(IN PKTIMER Timer,
KiReleaseTimerLock(LockQueue); KiReleaseTimerLock(LockQueue);
/* Acquire dispatcher lock */ /* Acquire dispatcher lock */
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
/* Signal the timer if it's still on our list */ /* Signal the timer if it's still on our list */
if (!IsListEmpty(&ListHead)) RequestInterrupt = KiSignalTimer(Timer); if (!IsListEmpty(&ListHead)) RequestInterrupt = KiSignalTimer(Timer);
/* Release the dispatcher lock */ /* Release the dispatcher lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Request a DPC if needed */ /* Request a DPC if needed */
if (RequestInterrupt) HalRequestSoftwareInterrupt(DISPATCH_LEVEL); if (RequestInterrupt) HalRequestSoftwareInterrupt(DISPATCH_LEVEL);
@ -321,7 +321,7 @@ KeSetTimerEx(IN OUT PKTIMER Timer,
RequestInterrupt = KiSignalTimer(Timer); RequestInterrupt = KiSignalTimer(Timer);
/* Release the dispatcher lock */ /* Release the dispatcher lock */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Check if we need to do an interrupt */ /* Check if we need to do an interrupt */
if (RequestInterrupt) HalRequestSoftwareInterrupt(DISPATCH_LEVEL); if (RequestInterrupt) HalRequestSoftwareInterrupt(DISPATCH_LEVEL);

View file

@ -386,7 +386,7 @@ WaitStart:
/* Setup a new wait */ /* Setup a new wait */
Thread->WaitIrql = KeRaiseIrqlToSynchLevel(); Thread->WaitIrql = KeRaiseIrqlToSynchLevel();
KxDelayThreadWait(); KxDelayThreadWait();
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
} }
/* We're done! */ /* We're done! */
@ -403,7 +403,7 @@ NoWait:
} }
/* Unlock the dispatcher and adjust the quantum for a no-wait */ /* Unlock the dispatcher and adjust the quantum for a no-wait */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
KiAdjustQuantumThread(Thread); KiAdjustQuantumThread(Thread);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -540,7 +540,7 @@ KeWaitForSingleObject(IN PVOID Object,
else else
{ {
/* Otherwise, unlock the dispatcher */ /* Otherwise, unlock the dispatcher */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
} }
/* Do the actual swap */ /* Do the actual swap */
@ -562,7 +562,7 @@ WaitStart:
/* Setup a new wait */ /* Setup a new wait */
Thread->WaitIrql = KeRaiseIrqlToSynchLevel(); Thread->WaitIrql = KeRaiseIrqlToSynchLevel();
KxSingleThreadWait(); KxSingleThreadWait();
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
} }
/* Wait complete */ /* Wait complete */
@ -571,7 +571,7 @@ WaitStart:
DontWait: DontWait:
/* Release dispatcher lock but maintain high IRQL */ /* Release dispatcher lock but maintain high IRQL */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Adjust the Quantum and return the wait status */ /* Adjust the Quantum and return the wait status */
KiAdjustQuantumThread(Thread); KiAdjustQuantumThread(Thread);
@ -835,7 +835,7 @@ KeWaitForMultipleObjects(IN ULONG Count,
else else
{ {
/* Otherwise, unlock the dispatcher */ /* Otherwise, unlock the dispatcher */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
} }
/* Swap the thread */ /* Swap the thread */
@ -858,7 +858,7 @@ WaitStart:
/* Setup a new wait */ /* Setup a new wait */
Thread->WaitIrql = KeRaiseIrqlToSynchLevel(); Thread->WaitIrql = KeRaiseIrqlToSynchLevel();
KxMultiThreadWait(); KxMultiThreadWait();
KiAcquireDispatcherLockAtDpcLevel(); KiAcquireDispatcherLockAtSynchLevel();
} }
/* We are done */ /* We are done */
@ -867,7 +867,7 @@ WaitStart:
DontWait: DontWait:
/* Release dispatcher lock but maintain high IRQL */ /* Release dispatcher lock but maintain high IRQL */
KiReleaseDispatcherLockFromDpcLevel(); KiReleaseDispatcherLockFromSynchLevel();
/* Adjust the Quantum and return the wait status */ /* Adjust the Quantum and return the wait status */
KiAdjustQuantumThread(Thread); KiAdjustQuantumThread(Thread);

View file

@ -2576,7 +2576,7 @@ MmSetExecuteOptions(IN ULONG ExecuteOptions)
} }
/* Change the NX state in the process lock */ /* Change the NX state in the process lock */
KiAcquireProcessLock(CurrentProcess, &ProcessLock); KiAcquireProcessLockRaiseToSynch(CurrentProcess, &ProcessLock);
/* Don't change anything if the permanent flag was set */ /* Don't change anything if the permanent flag was set */
if (!CurrentProcess->Flags.Permanent) if (!CurrentProcess->Flags.Permanent)