https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7523a7b13880b47d21f2e…
commit 7523a7b13880b47d21f2ef17761450e5893e6f49
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Mon Dec 30 15:34:38 2019 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Tue Dec 31 15:30:27 2019 +0100
[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
---
ntoskrnl/include/internal/ke_x.h | 34 +++++++++--------
ntoskrnl/ke/apc.c | 22 +++++------
ntoskrnl/ke/gate.c | 14 +++----
ntoskrnl/ke/procobj.c | 48 +++++++++++------------
ntoskrnl/ke/queue.c | 12 +++---
ntoskrnl/ke/thrdobj.c | 82 ++++++++++++++++++++--------------------
ntoskrnl/ke/timerobj.c | 6 +--
ntoskrnl/ke/wait.c | 16 ++++----
ntoskrnl/mm/ARM3/pagfault.c | 2 +-
9 files changed, 120 insertions(+), 116 deletions(-)
diff --git a/ntoskrnl/include/internal/ke_x.h b/ntoskrnl/include/internal/ke_x.h
index 3aa3e7ab74c..84cb68e2c76 100644
--- a/ntoskrnl/include/internal/ke_x.h
+++ b/ntoskrnl/include/internal/ke_x.h
@@ -157,17 +157,18 @@ KiReleaseDispatcherLock(IN KIRQL OldIrql)
FORCEINLINE
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;
}
FORCEINLINE
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;
}
@@ -360,16 +361,17 @@ KiReleaseDispatcherLock(IN KIRQL OldIrql)
FORCEINLINE
VOID
-KiAcquireDispatcherLockAtDpcLevel(VOID)
+KiAcquireDispatcherLockAtSynchLevel(VOID)
{
/* Acquire the dispatcher lock */
+ ASSERT(KeGetCurrentIrql() >= SYNCH_LEVEL);
KeAcquireQueuedSpinLockAtDpcLevel(&KeGetCurrentPrcb()->
LockQueue[LockQueueDispatcherLock]);
}
FORCEINLINE
VOID
-KiReleaseDispatcherLockFromDpcLevel(VOID)
+KiReleaseDispatcherLockFromSynchLevel(VOID)
{
/* Release the dispatcher lock */
KeReleaseQueuedSpinLockFromDpcLevel(&KeGetCurrentPrcb()->
@@ -597,7 +599,7 @@ KiReleaseTimerLock(IN PKSPIN_LOCK_QUEUE LockQueue)
FORCEINLINE
VOID
-KiAcquireApcLock(IN PKTHREAD Thread,
+KiAcquireApcLockRaiseToSynch(IN PKTHREAD Thread,
IN PKLOCK_QUEUE_HANDLE Handle)
{
/* Acquire the lock and raise to synchronization level */
@@ -606,16 +608,17 @@ KiAcquireApcLock(IN PKTHREAD Thread,
FORCEINLINE
VOID
-KiAcquireApcLockAtDpcLevel(IN PKTHREAD Thread,
+KiAcquireApcLockAtSynchLevel(IN PKTHREAD Thread,
IN PKLOCK_QUEUE_HANDLE Handle)
{
/* Acquire the lock */
+ ASSERT(KeGetCurrentIrql() >= SYNCH_LEVEL);
KeAcquireInStackQueuedSpinLockAtDpcLevel(&Thread->ApcQueueLock, Handle);
}
FORCEINLINE
VOID
-KiAcquireApcLockAtApcLevel(IN PKTHREAD Thread,
+KiAcquireApcLockRaiseToDpc(IN PKTHREAD Thread,
IN PKLOCK_QUEUE_HANDLE Handle)
{
/* Acquire the lock */
@@ -632,7 +635,7 @@ KiReleaseApcLock(IN PKLOCK_QUEUE_HANDLE Handle)
FORCEINLINE
VOID
-KiReleaseApcLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE Handle)
+KiReleaseApcLockFromSynchLevel(IN PKLOCK_QUEUE_HANDLE Handle)
{
/* Release the lock */
KeReleaseInStackQueuedSpinLockFromDpcLevel(Handle);
@@ -640,7 +643,7 @@ KiReleaseApcLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE Handle)
FORCEINLINE
VOID
-KiAcquireProcessLock(IN PKPROCESS Process,
+KiAcquireProcessLockRaiseToSynch(IN PKPROCESS Process,
IN PKLOCK_QUEUE_HANDLE Handle)
{
/* Acquire the lock and raise to synchronization level */
@@ -651,15 +654,15 @@ FORCEINLINE
VOID
KiReleaseProcessLock(IN PKLOCK_QUEUE_HANDLE Handle)
{
- /* Release the lock */
+ /* Release the lock and restore previous IRQL */
KeReleaseInStackQueuedSpinLock(Handle);
}
FORCEINLINE
VOID
-KiReleaseProcessLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE Handle)
+KiReleaseProcessLockFromSynchLevel(IN PKLOCK_QUEUE_HANDLE Handle)
{
- /* Release the lock */
+ /* Release the lock without lowering IRQL */
KeReleaseInStackQueuedSpinLockFromDpcLevel(Handle);
}
@@ -916,10 +919,11 @@ KxInsertTimer(IN PKTIMER Timer,
IN ULONG Hand)
{
PKSPIN_LOCK_QUEUE LockQueue;
+ ASSERT(KeGetCurrentIrql() >= SYNCH_LEVEL);
/* Acquire the lock and release the dispatcher lock */
LockQueue = KiAcquireTimerLock(Hand);
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Try to insert the timer */
if (KiInsertTimerTable(Timer, Hand))
diff --git a/ntoskrnl/ke/apc.c b/ntoskrnl/ke/apc.c
index c4bab2a4c02..65169ca3c56 100644
--- a/ntoskrnl/ke/apc.c
+++ b/ntoskrnl/ke/apc.c
@@ -264,7 +264,7 @@ KiInsertQueueApc(IN PKAPC Apc,
}
/* Release dispatcher lock */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Check if an interrupt was requested */
KiRequestApcInterrupt(RequestInterrupt, Thread->NextProcessor);
@@ -330,7 +330,7 @@ KiDeliverApc(IN KPROCESSOR_MODE DeliveryMode,
while (!IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode]))
{
/* Lock the APC Queue */
- KiAcquireApcLockAtApcLevel(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToDpc(Thread, &ApcLock);
/* Check if the list became empty now */
if (IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode]))
@@ -441,7 +441,7 @@ KiDeliverApc(IN KPROCESSOR_MODE DeliveryMode,
(Thread->ApcState.UserApcPending))
{
/* Lock the APC Queue */
- KiAcquireApcLockAtApcLevel(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToDpc(Thread, &ApcLock);
/* It's not pending anymore */
Thread->ApcState.UserApcPending = FALSE;
@@ -744,7 +744,7 @@ KeInsertQueueApc(IN PKAPC Apc,
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Get the APC lock */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Make sure we can Queue APCs and that this one isn't already inserted */
if (!(Thread->ApcQueueable) || (Apc->Inserted))
@@ -764,7 +764,7 @@ KeInsertQueueApc(IN PKAPC Apc,
}
/* Release the APC lock and return success */
- KiReleaseApcLockFromDpcLevel(&ApcLock);
+ KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql);
return State;
}
@@ -802,7 +802,7 @@ KeFlushQueueApc(IN PKTHREAD Thread,
if (PreviousMode == UserMode)
{
/* Get the APC lock */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Select user list and check if it's empty */
if (IsListEmpty(&Thread->ApcState.ApcListHead[UserMode]))
@@ -822,7 +822,7 @@ KeFlushQueueApc(IN PKTHREAD Thread,
}
/* Otherwise, acquire the APC lock */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
}
/* Get the first entry and check if the list is empty now */
@@ -892,8 +892,8 @@ KeRemoveQueueApc(IN PKAPC Apc)
ASSERT_APC(Apc);
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
- /* Get the APC lock */
- KiAcquireApcLock(Thread, &ApcLock);
+ /* Get the APC lock (this raises IRQL to SYNCH_LEVEL) */
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Check if it's inserted */
Inserted = Apc->Inserted;
@@ -904,7 +904,7 @@ KeRemoveQueueApc(IN PKAPC Apc)
ApcState = Thread->ApcStatePointer[(UCHAR)Apc->ApcStateIndex];
/* Acquire the dispatcher lock and remove it from the list */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
if (RemoveEntryList(&Apc->ApcListEntry))
{
/* Set the correct state based on the APC Mode */
@@ -921,7 +921,7 @@ KeRemoveQueueApc(IN PKAPC Apc)
}
/* Release dispatcher lock */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
}
/* Release the lock and return */
diff --git a/ntoskrnl/ke/gate.c b/ntoskrnl/ke/gate.c
index 12f8a02e096..f078f929001 100644
--- a/ntoskrnl/ke/gate.c
+++ b/ntoskrnl/ke/gate.c
@@ -44,7 +44,7 @@ KeWaitForGate(IN PKGATE Gate,
do
{
/* Acquire the APC lock */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Check if a kernel APC is pending and we're below APC_LEVEL */
if ((Thread->ApcState.KernelApcPending) &&
@@ -58,7 +58,7 @@ KeWaitForGate(IN PKGATE Gate,
{
/* Check if we have a queue and lock the dispatcher if so */
Queue = Thread->Queue;
- if (Queue) KiAcquireDispatcherLockAtDpcLevel();
+ if (Queue) KiAcquireDispatcherLockAtSynchLevel();
/* Lock the thread */
KiAcquireThreadLock(Thread);
@@ -77,7 +77,7 @@ KeWaitForGate(IN PKGATE Gate,
KiReleaseThreadLock(Thread);
/* Release the gate lock */
- if (Queue) KiReleaseDispatcherLockFromDpcLevel();
+ if (Queue) KiReleaseDispatcherLockFromSynchLevel();
/* Release the APC lock and return */
KiReleaseApcLock(&ApcLock);
@@ -116,11 +116,11 @@ KeWaitForGate(IN PKGATE Gate,
KiActivateWaiterQueue(Queue);
/* Release the dispatcher lock */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
}
/* Release the APC lock but stay at DPC level */
- KiReleaseApcLockFromDpcLevel(&ApcLock);
+ KiReleaseApcLockFromSynchLevel(&ApcLock);
/* Find a new thread to run */
Status = KiSwapThread(Thread, KeGetCurrentPrcb());
@@ -203,7 +203,7 @@ KeSignalGateBoostPriority(IN PKGATE Gate)
if (WaitThread->Queue)
{
/* Acquire the dispatcher lock */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Check if we still have one */
if (WaitThread->Queue)
@@ -213,7 +213,7 @@ KeSignalGateBoostPriority(IN PKGATE Gate)
}
/* Release lock */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
}
/* Make the thread ready */
diff --git a/ntoskrnl/ke/procobj.c b/ntoskrnl/ke/procobj.c
index 865d7881f81..abf5a4f3fc4 100644
--- a/ntoskrnl/ke/procobj.c
+++ b/ntoskrnl/ke/procobj.c
@@ -92,10 +92,10 @@ KiAttachProcess(IN PKTHREAD Thread,
#endif
/* Release dispatcher lock */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Release lock */
- KiReleaseApcLockFromDpcLevel(ApcLock);
+ KiReleaseApcLockFromSynchLevel(ApcLock);
/* Swap Processes */
KiSwapProcess(Process, SavedApcState->Process);
@@ -236,7 +236,7 @@ KeSetQuantumProcess(IN PKPROCESS Process,
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the process */
- KiAcquireProcessLock(Process, &ProcessLock);
+ KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock);
/* Set new quantum */
Process->QuantumReset = Quantum;
@@ -275,10 +275,10 @@ KeSetAffinityProcess(IN PKPROCESS Process,
ASSERT((Affinity & KeActiveProcessors) != 0);
/* Lock the process */
- KiAcquireProcessLock(Process, &ProcessLock);
+ KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock);
/* Acquire the dispatcher lock */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Capture old affinity and update it */
OldAffinity = Process->Affinity;
@@ -298,10 +298,10 @@ KeSetAffinityProcess(IN PKPROCESS Process,
}
/* Release Dispatcher Database */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Release the process lock */
- KiReleaseProcessLockFromDpcLevel(&ProcessLock);
+ KiReleaseProcessLockFromSynchLevel(&ProcessLock);
KiExitDispatcher(ProcessLock.OldIrql);
/* Return previous affinity */
@@ -365,7 +365,7 @@ KeSetPriorityAndQuantumProcess(IN PKPROCESS Process,
if (!Priority) Priority = LOW_PRIORITY + 1;
/* Lock the process */
- KiAcquireProcessLock(Process, &ProcessLock);
+ KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock);
/* Check if we are modifying the quantum too */
if (Quantum) Process->QuantumReset = Quantum;
@@ -507,10 +507,10 @@ KeSetPriorityAndQuantumProcess(IN PKPROCESS Process,
}
/* Release Dispatcher Database */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Release the process lock */
- KiReleaseProcessLockFromDpcLevel(&ProcessLock);
+ KiReleaseProcessLockFromSynchLevel(&ProcessLock);
KiExitDispatcher(ProcessLock.OldIrql);
/* Return previous priority */
@@ -531,7 +531,7 @@ KeQueryValuesProcess(IN PKPROCESS Process,
ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
/* Lock the process */
- KiAcquireProcessLock(Process, &ProcessLock);
+ KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock);
/* Initialize user and kernel times */
TotalKernel = Process->KernelTime;
@@ -600,10 +600,10 @@ KeAttachProcess(IN PKPROCESS Process)
else
{
/* Acquire APC Lock */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Acquire the dispatcher lock */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Legit attach attempt: do it! */
KiAttachProcess(Thread, Process, &ApcLock, &Thread->SavedApcState);
@@ -626,7 +626,7 @@ KeDetachProcess(VOID)
if (Thread->ApcStateIndex == OriginalApcEnvironment) return;
/* Acquire APC Lock */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Check for invalid attach attempts */
if ((Thread->ApcState.KernelApcInProgress) ||
@@ -641,7 +641,7 @@ KeDetachProcess(VOID)
Process = Thread->ApcState.Process;
/* Acquire dispatcher lock */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Decrease the stack count */
ASSERT(Process->StackCount != 0);
@@ -655,7 +655,7 @@ KeDetachProcess(VOID)
}
/* Release dispatcher lock */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Restore the APC State */
KiMoveApcState(&Thread->SavedApcState, &Thread->ApcState);
@@ -665,7 +665,7 @@ KeDetachProcess(VOID)
Thread->ApcStateIndex = OriginalApcEnvironment;
/* Release lock */
- KiReleaseApcLockFromDpcLevel(&ApcLock);
+ KiReleaseApcLockFromSynchLevel(&ApcLock);
/* Swap Processes */
KiSwapProcess(Thread->ApcState.Process, Process);
@@ -726,10 +726,10 @@ KeStackAttachProcess(IN PKPROCESS Process,
}
/* Acquire APC Lock */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Acquire dispatcher lock */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Check if the Current Thread is already attached */
if (Thread->ApcStateIndex != OriginalApcEnvironment)
@@ -764,7 +764,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
for (;;)
{
/* Acquire APC Lock */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Check if a kernel APC is pending */
if (Thread->ApcState.KernelApcPending)
@@ -799,7 +799,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
Process = Thread->ApcState.Process;
/* Acquire dispatcher lock */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Decrease the stack count */
ASSERT(Process->StackCount != 0);
@@ -813,7 +813,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
}
/* Release dispatcher lock */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Check if there's an APC state to restore */
if (ApcState->Process)
@@ -832,7 +832,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
}
/* Release lock */
- KiReleaseApcLockFromDpcLevel(&ApcLock);
+ KiReleaseApcLockFromSynchLevel(&ApcLock);
/* Swap Processes */
KiSwapProcess(Thread->ApcState.Process, Process);
@@ -869,7 +869,7 @@ KeQueryRuntimeProcess(IN PKPROCESS Process,
TotalKernel = Process->KernelTime;
/* Lock the process */
- KiAcquireProcessLock(Process, &ProcessLock);
+ KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock);
/* Loop all child threads and sum up their times */
ListHead = &Process->ThreadListHead;
diff --git a/ntoskrnl/ke/queue.c b/ntoskrnl/ke/queue.c
index 0ddbfa6a88a..1b02a88aeed 100644
--- a/ntoskrnl/ke/queue.c
+++ b/ntoskrnl/ke/queue.c
@@ -265,7 +265,7 @@ KeRemoveQueue(IN PKQUEUE Queue,
/* Raise IRQL to synch, prepare the wait, then lock the database */
Thread->WaitIrql = KeRaiseIrqlToSynchLevel();
KxQueueThreadWait();
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
}
/*
@@ -339,7 +339,7 @@ KeRemoveQueue(IN PKQUEUE Queue,
{
/* Increment the count and unlock the dispatcher */
Queue->CurrentCount++;
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
KiExitDispatcher(Thread->WaitIrql);
}
else
@@ -394,7 +394,7 @@ KeRemoveQueue(IN PKQUEUE Queue,
else
{
/* Otherwise, unlock the dispatcher */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
}
/* Do the actual swap */
@@ -419,13 +419,13 @@ KeRemoveQueue(IN PKQUEUE Queue,
/* Start another wait */
Thread->WaitIrql = KeRaiseIrqlToSynchLevel();
KxQueueThreadWait();
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
Queue->CurrentCount--;
}
}
/* Unlock Database and return */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
KiExitDispatcher(Thread->WaitIrql);
return QueueEntry;
}
@@ -477,7 +477,7 @@ KeRundownQueue(IN PKQUEUE Queue)
}
/* Release the dispatcher lock */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Exit the dispatcher and return the first entry (if any) */
KiExitDispatcher(OldIrql);
diff --git a/ntoskrnl/ke/thrdobj.c b/ntoskrnl/ke/thrdobj.c
index 142ff18291a..627f42c7395 100644
--- a/ntoskrnl/ke/thrdobj.c
+++ b/ntoskrnl/ke/thrdobj.c
@@ -138,8 +138,8 @@ KeAlertResumeThread(IN PKTHREAD Thread)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the Dispatcher Database and the APC Queue */
- KiAcquireApcLock(Thread, &ApcLock);
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
+ KiAcquireDispatcherLockAtSynchLevel();
/* Return if Thread is already alerted. */
if (!Thread->Alerted[KernelMode])
@@ -174,8 +174,8 @@ KeAlertResumeThread(IN PKTHREAD Thread)
}
/* Release Locks and return the Old State */
- KiReleaseDispatcherLockFromDpcLevel();
- KiReleaseApcLockFromDpcLevel(&ApcLock);
+ KiReleaseDispatcherLockFromSynchLevel();
+ KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql);
return PreviousCount;
}
@@ -191,8 +191,8 @@ KeAlertThread(IN PKTHREAD Thread,
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the Dispatcher Database and the APC Queue */
- KiAcquireApcLock(Thread, &ApcLock);
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
+ KiAcquireDispatcherLockAtSynchLevel();
/* Save the Previous State */
PreviousState = Thread->Alerted[AlertMode];
@@ -216,8 +216,8 @@ KeAlertThread(IN PKTHREAD Thread,
}
/* Release the Dispatcher Lock */
- KiReleaseDispatcherLockFromDpcLevel();
- KiReleaseApcLockFromDpcLevel(&ApcLock);
+ KiReleaseDispatcherLockFromSynchLevel();
+ KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql);
/* Return the old state */
@@ -281,7 +281,7 @@ KeForceResumeThread(IN PKTHREAD Thread)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the APC Queue */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Save the old Suspend Count */
PreviousCount = Thread->SuspendCount + Thread->FreezeCount;
@@ -294,18 +294,18 @@ KeForceResumeThread(IN PKTHREAD Thread)
Thread->FreezeCount = 0;
/* Lock the dispatcher */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Signal and satisfy */
Thread->SuspendSemaphore.Header.SignalState++;
KiWaitTest(&Thread->SuspendSemaphore.Header, IO_NO_INCREMENT);
/* Release the dispatcher */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
}
/* Release Lock and return the Old State */
- KiReleaseApcLockFromDpcLevel(&ApcLock);
+ KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql);
return PreviousCount;
}
@@ -322,14 +322,14 @@ KeFreezeAllThreads(VOID)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the process */
- KiAcquireProcessLock(Process, &LockHandle);
+ KiAcquireProcessLockRaiseToSynch(Process, &LockHandle);
/* If someone is already trying to free us, try again */
while (CurrentThread->FreezeCount)
{
/* Release and re-acquire the process lock so the APC will go through */
KiReleaseProcessLock(&LockHandle);
- KiAcquireProcessLock(Process, &LockHandle);
+ KiAcquireProcessLockRaiseToSynch(Process, &LockHandle);
}
/* Enter a critical region */
@@ -344,7 +344,7 @@ KeFreezeAllThreads(VOID)
Current = CONTAINING_RECORD(NextEntry, KTHREAD, ThreadListEntry);
/* Lock it */
- KiAcquireApcLockAtDpcLevel(Current, &ApcLock);
+ KiAcquireApcLockAtSynchLevel(Current, &ApcLock);
/* Make sure it's not ours, and check if APCs are enabled */
if ((Current != CurrentThread) && (Current->ApcQueueable))
@@ -369,26 +369,26 @@ KeFreezeAllThreads(VOID)
else
{
/* Lock the dispatcher */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Unsignal the semaphore, the APC was already inserted */
Current->SuspendSemaphore.Header.SignalState--;
/* Release the dispatcher */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
}
}
}
/* Release the APC lock */
- KiReleaseApcLockFromDpcLevel(&ApcLock);
+ KiReleaseApcLockFromSynchLevel(&ApcLock);
/* Move to the next thread */
NextEntry = NextEntry->Flink;
} while (NextEntry != ListHead);
/* Release the process lock and exit the dispatcher */
- KiReleaseProcessLockFromDpcLevel(&LockHandle);
+ KiReleaseProcessLockFromSynchLevel(&LockHandle);
KiExitDispatcher(LockHandle.OldIrql);
}
@@ -402,7 +402,7 @@ KeResumeThread(IN PKTHREAD Thread)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the APC Queue */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Save the Old Count */
PreviousCount = Thread->SuspendCount;
@@ -417,19 +417,19 @@ KeResumeThread(IN PKTHREAD Thread)
if ((!Thread->SuspendCount) && (!Thread->FreezeCount))
{
/* Acquire the dispatcher lock */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Signal the Suspend Semaphore */
Thread->SuspendSemaphore.Header.SignalState++;
KiWaitTest(&Thread->SuspendSemaphore.Header, IO_NO_INCREMENT);
/* Release the dispatcher lock */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
}
}
/* Release APC Queue lock and return the Old State */
- KiReleaseApcLockFromDpcLevel(&ApcLock);
+ KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql);
return PreviousCount;
}
@@ -516,7 +516,7 @@ KeStartThread(IN OUT PKTHREAD Thread)
Thread->SystemAffinityActive = FALSE;
/* Lock the process */
- KiAcquireProcessLock(Process, &LockHandle);
+ KiAcquireProcessLockRaiseToSynch(Process, &LockHandle);
/* Setup volatile data */
Thread->Priority = Process->BasePriority;
@@ -553,7 +553,7 @@ KeStartThread(IN OUT PKTHREAD Thread)
Thread->UserIdealProcessor = IdealProcessor;
/* Lock the Dispatcher Database */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Insert the thread into the process list */
InsertTailList(&Process->ThreadListHead, &Thread->ThreadListEntry);
@@ -563,7 +563,7 @@ KeStartThread(IN OUT PKTHREAD Thread)
Process->StackCount++;
/* Release locks and return */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
KiReleaseProcessLock(&LockHandle);
}
@@ -615,7 +615,7 @@ KeSuspendThread(PKTHREAD Thread)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the APC Queue */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Save the Old Count */
PreviousCount = Thread->SuspendCount;
@@ -647,19 +647,19 @@ KeSuspendThread(PKTHREAD Thread)
else
{
/* Lock the dispatcher */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Unsignal the semaphore, the APC was already inserted */
Thread->SuspendSemaphore.Header.SignalState--;
/* Release the dispatcher */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
}
}
}
/* Release Lock and return the Old State */
- KiReleaseApcLockFromDpcLevel(&ApcLock);
+ KiReleaseApcLockFromSynchLevel(&ApcLock);
KiExitDispatcher(ApcLock.OldIrql);
return PreviousCount;
}
@@ -676,7 +676,7 @@ KeThawAllThreads(VOID)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the process */
- KiAcquireProcessLock(Process, &LockHandle);
+ KiAcquireProcessLockRaiseToSynch(Process, &LockHandle);
/* Loop the Process's Threads */
ListHead = &Process->ThreadListHead;
@@ -687,7 +687,7 @@ KeThawAllThreads(VOID)
Current = CONTAINING_RECORD(NextEntry, KTHREAD, ThreadListEntry);
/* Lock it */
- KiAcquireApcLockAtDpcLevel(Current, &ApcLock);
+ KiAcquireApcLockAtSynchLevel(Current, &ApcLock);
/* Make sure we are frozen */
OldCount = Current->FreezeCount;
@@ -700,26 +700,26 @@ KeThawAllThreads(VOID)
if (!(Current->SuspendCount) && (!Current->FreezeCount))
{
/* Lock the dispatcher */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Signal the suspend semaphore and wake it */
Current->SuspendSemaphore.Header.SignalState++;
KiWaitTest(&Current->SuspendSemaphore, 0);
/* Unlock the dispatcher */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
}
}
/* Release the APC lock */
- KiReleaseApcLockFromDpcLevel(&ApcLock);
+ KiReleaseApcLockFromSynchLevel(&ApcLock);
/* Go to the next one */
NextEntry = NextEntry->Flink;
} while (NextEntry != ListHead);
/* Release the process lock and exit the dispatcher */
- KiReleaseProcessLockFromDpcLevel(&LockHandle);
+ KiReleaseProcessLockFromSynchLevel(&LockHandle);
KiExitDispatcher(LockHandle.OldIrql);
/* Leave the critical region */
@@ -737,7 +737,7 @@ KeTestAlertThread(IN KPROCESSOR_MODE AlertMode)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the Dispatcher Database and the APC Queue */
- KiAcquireApcLock(Thread, &ApcLock);
+ KiAcquireApcLockRaiseToSynch(Thread, &ApcLock);
/* Save the old State */
OldState = Thread->Alerted[AlertMode];
@@ -1383,7 +1383,7 @@ KeTerminateThread(IN KPRIORITY Increment)
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Lock the process */
- KiAcquireProcessLock(Process, &LockHandle);
+ KiAcquireProcessLockRaiseToSynch(Process, &LockHandle);
/* Make sure we won't get Swapped */
KiSetThreadSwapBusy(Thread);
@@ -1415,7 +1415,7 @@ KeTerminateThread(IN KPRIORITY Increment)
} while (Entry != SavedEntry);
/* Acquire the dispatcher lock */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Check if the reaper wasn't active */
if (!Entry)
@@ -1446,7 +1446,7 @@ KeTerminateThread(IN KPRIORITY Increment)
RemoveEntryList(&Thread->ThreadListEntry);
/* Release the process lock */
- KiReleaseProcessLockFromDpcLevel(&LockHandle);
+ KiReleaseProcessLockFromSynchLevel(&LockHandle);
/* Set us as terminated, decrease the Process's stack count */
Thread->State = Terminated;
@@ -1464,6 +1464,6 @@ KeTerminateThread(IN KPRIORITY Increment)
KiRundownThread(Thread);
/* Swap to a new thread */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
KiSwapThread(Thread, KeGetCurrentPrcb());
}
diff --git a/ntoskrnl/ke/timerobj.c b/ntoskrnl/ke/timerobj.c
index 43a348ec008..26f12720dda 100644
--- a/ntoskrnl/ke/timerobj.c
+++ b/ntoskrnl/ke/timerobj.c
@@ -184,13 +184,13 @@ KiCompleteTimer(IN PKTIMER Timer,
KiReleaseTimerLock(LockQueue);
/* Acquire dispatcher lock */
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
/* Signal the timer if it's still on our list */
if (!IsListEmpty(&ListHead)) RequestInterrupt = KiSignalTimer(Timer);
/* Release the dispatcher lock */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Request a DPC if needed */
if (RequestInterrupt) HalRequestSoftwareInterrupt(DISPATCH_LEVEL);
@@ -321,7 +321,7 @@ KeSetTimerEx(IN OUT PKTIMER Timer,
RequestInterrupt = KiSignalTimer(Timer);
/* Release the dispatcher lock */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Check if we need to do an interrupt */
if (RequestInterrupt) HalRequestSoftwareInterrupt(DISPATCH_LEVEL);
diff --git a/ntoskrnl/ke/wait.c b/ntoskrnl/ke/wait.c
index bae1e8fcd60..3863b8e4779 100644
--- a/ntoskrnl/ke/wait.c
+++ b/ntoskrnl/ke/wait.c
@@ -386,7 +386,7 @@ WaitStart:
/* Setup a new wait */
Thread->WaitIrql = KeRaiseIrqlToSynchLevel();
KxDelayThreadWait();
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
}
/* We're done! */
@@ -403,7 +403,7 @@ NoWait:
}
/* Unlock the dispatcher and adjust the quantum for a no-wait */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
KiAdjustQuantumThread(Thread);
return STATUS_SUCCESS;
}
@@ -540,7 +540,7 @@ KeWaitForSingleObject(IN PVOID Object,
else
{
/* Otherwise, unlock the dispatcher */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
}
/* Do the actual swap */
@@ -562,7 +562,7 @@ WaitStart:
/* Setup a new wait */
Thread->WaitIrql = KeRaiseIrqlToSynchLevel();
KxSingleThreadWait();
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
}
/* Wait complete */
@@ -571,7 +571,7 @@ WaitStart:
DontWait:
/* Release dispatcher lock but maintain high IRQL */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Adjust the Quantum and return the wait status */
KiAdjustQuantumThread(Thread);
@@ -835,7 +835,7 @@ KeWaitForMultipleObjects(IN ULONG Count,
else
{
/* Otherwise, unlock the dispatcher */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
}
/* Swap the thread */
@@ -858,7 +858,7 @@ WaitStart:
/* Setup a new wait */
Thread->WaitIrql = KeRaiseIrqlToSynchLevel();
KxMultiThreadWait();
- KiAcquireDispatcherLockAtDpcLevel();
+ KiAcquireDispatcherLockAtSynchLevel();
}
/* We are done */
@@ -867,7 +867,7 @@ WaitStart:
DontWait:
/* Release dispatcher lock but maintain high IRQL */
- KiReleaseDispatcherLockFromDpcLevel();
+ KiReleaseDispatcherLockFromSynchLevel();
/* Adjust the Quantum and return the wait status */
KiAdjustQuantumThread(Thread);
diff --git a/ntoskrnl/mm/ARM3/pagfault.c b/ntoskrnl/mm/ARM3/pagfault.c
index de642510df0..1ab109e9f65 100644
--- a/ntoskrnl/mm/ARM3/pagfault.c
+++ b/ntoskrnl/mm/ARM3/pagfault.c
@@ -2576,7 +2576,7 @@ MmSetExecuteOptions(IN ULONG ExecuteOptions)
}
/* Change the NX state in the process lock */
- KiAcquireProcessLock(CurrentProcess, &ProcessLock);
+ KiAcquireProcessLockRaiseToSynch(CurrentProcess, &ProcessLock);
/* Don't change anything if the permanent flag was set */
if (!CurrentProcess->Flags.Permanent)