diff --git a/reactos/ntoskrnl/include/internal/ke_x.h b/reactos/ntoskrnl/include/internal/ke_x.h index f9580053cc3..5a5634cc6af 100644 --- a/reactos/ntoskrnl/include/internal/ke_x.h +++ b/reactos/ntoskrnl/include/internal/ke_x.h @@ -9,43 +9,43 @@ // // Enters a Guarded Region // -#define KeEnterGuardedRegion() \ -{ \ - PKTHREAD Thread = KeGetCurrentThread(); \ - \ - /* Sanity checks */ \ - ASSERT_IRQL_LESS_OR_EQUAL(APC_LEVEL); \ - ASSERT(Thread == KeGetCurrentThread()); \ - ASSERT((Thread->SpecialApcDisable <= 0) && \ - (Thread->SpecialApcDisable != -32768)); \ - \ - /* Disable Special APCs */ \ - Thread->SpecialApcDisable--; \ +#define KeEnterGuardedRegion() \ +{ \ + PKTHREAD Thread = KeGetCurrentThread(); \ + \ + /* Sanity checks */ \ + ASSERT_IRQL_LESS_OR_EQUAL(APC_LEVEL); \ + ASSERT(Thread == KeGetCurrentThread()); \ + ASSERT((Thread->SpecialApcDisable <= 0) && \ + (Thread->SpecialApcDisable != -32768)); \ + \ + /* Disable Special APCs */ \ + Thread->SpecialApcDisable--; \ } // // Leaves a Guarded Region // -#define KeLeaveGuardedRegion() \ -{ \ - PKTHREAD Thread = KeGetCurrentThread(); \ - \ - /* Sanity checks */ \ - ASSERT_IRQL_LESS_OR_EQUAL(APC_LEVEL); \ - ASSERT(Thread == KeGetCurrentThread()); \ - ASSERT(Thread->SpecialApcDisable < 0); \ - \ - /* Leave region and check if APCs are OK now */ \ - if (!(++Thread->SpecialApcDisable)) \ - { \ - /* Check for Kernel APCs on the list */ \ - if (!IsListEmpty(&Thread->ApcState. \ - ApcListHead[KernelMode])) \ - { \ - /* Check for APC Delivery */ \ - KiCheckForKernelApcDelivery(); \ - } \ - } \ +#define KeLeaveGuardedRegion() \ +{ \ + PKTHREAD Thread = KeGetCurrentThread(); \ + \ + /* Sanity checks */ \ + ASSERT_IRQL_LESS_OR_EQUAL(APC_LEVEL); \ + ASSERT(Thread == KeGetCurrentThread()); \ + ASSERT(Thread->SpecialApcDisable < 0); \ + \ + /* Leave region and check if APCs are OK now */ \ + if (!(++Thread->SpecialApcDisable)) \ + { \ + /* Check for Kernel APCs on the list */ \ + if (!IsListEmpty(&Thread->ApcState. \ + ApcListHead[KernelMode])) \ + { \ + /* Check for APC Delivery */ \ + KiCheckForKernelApcDelivery(); \ + } \ + } \ } // diff --git a/reactos/ntoskrnl/ke/gmutex.c b/reactos/ntoskrnl/ke/gmutex.c index 19d11cf7dbd..b8a92bcb1dd 100644 --- a/reactos/ntoskrnl/ke/gmutex.c +++ b/reactos/ntoskrnl/ke/gmutex.c @@ -131,6 +131,9 @@ KiReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex) /* PUBLIC FUNCTIONS **********************************************************/ +/* + * @implemented + */ VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex) @@ -144,6 +147,9 @@ KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex) KeInitializeGate(&GuardedMutex->Gate); } +/* + * @implemented + */ VOID FASTCALL KeAcquireGuardedMutexUnsafe(IN OUT PKGUARDED_MUTEX GuardedMutex) @@ -164,6 +170,9 @@ KeAcquireGuardedMutexUnsafe(IN OUT PKGUARDED_MUTEX GuardedMutex) GuardedMutex->Owner = Thread; } +/* + * @implemented + */ VOID FASTCALL KeReleaseGuardedMutexUnsafe(IN OUT PKGUARDED_MUTEX GuardedMutex) @@ -179,6 +188,9 @@ KeReleaseGuardedMutexUnsafe(IN OUT PKGUARDED_MUTEX GuardedMutex) KiReleaseGuardedMutex(GuardedMutex); } +/* + * @implemented + */ VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex) @@ -200,6 +212,9 @@ KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex) GuardedMutex->SpecialApcDisable = Thread->SpecialApcDisable; } +/* + * @implemented + */ VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex) @@ -217,6 +232,9 @@ KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex) KeLeaveGuardedRegion(); } +/* + * @implemented + */ BOOLEAN FASTCALL KeTryToAcquireGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex) @@ -251,21 +269,12 @@ KeTryToAcquireGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex) * Enters a guarded region. This causes all (incl. special kernel) APCs * to be disabled. */ -#undef KeEnterGuardedRegion VOID NTAPI -KeEnterGuardedRegion(VOID) +_KeEnterGuardedRegion(VOID) { - PKTHREAD Thread = KeGetCurrentThread(); - - /* Sanity checks */ - ASSERT_IRQL_LESS_OR_EQUAL(APC_LEVEL); - ASSERT(Thread == KeGetCurrentThread()); - ASSERT((Thread->SpecialApcDisable <= 0) && - (Thread->SpecialApcDisable != -32768)); - - /* Disable Special APCs */ - Thread->SpecialApcDisable--; + /* Use the inlined version */ + KeEnterGuardedRegion(); } /** @@ -273,28 +282,12 @@ KeEnterGuardedRegion(VOID) * * Leaves a guarded region and delivers pending APCs if possible. */ -#undef KeLeaveGuardedRegion VOID NTAPI -KeLeaveGuardedRegion(VOID) +_KeLeaveGuardedRegion(VOID) { - PKTHREAD Thread = KeGetCurrentThread(); - - /* Sanity checks */ - ASSERT_IRQL_LESS_OR_EQUAL(APC_LEVEL); - ASSERT(Thread == KeGetCurrentThread()); - ASSERT(Thread->SpecialApcDisable < 0); - - /* Boost the enable count and check if Special APCs are enabled */ - if (!(++Thread->SpecialApcDisable)) - { - /* Check if there are Kernel APCs on the list */ - if (!IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode])) - { - /* Check for APC Delivery */ - KiCheckForKernelApcDelivery(); - } - } + /* Use the inlined version */ + KeLeaveGuardedRegion(); } /* EOF */ diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index b649232d783..59e18b11cff 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -535,7 +535,7 @@ KeDeregisterBugCheckReasonCallback@4 KeDetachProcess@0 KeDisconnectInterrupt@4 KeEnterCriticalRegion@0=_KeEnterCriticalRegion@0 -KeEnterGuardedRegion@0 +KeEnterGuardedRegion@0=_KeEnterGuardedRegion@0 KeEnterKernelDebugger@0 KeFindConfigurationEntry@16 KeFindConfigurationNextEntry@20 @@ -577,7 +577,7 @@ KeInsertQueueDpc@12 KeIsAttachedProcess@0 KeIsExecutingDpc@0 KeLeaveCriticalRegion@0=_KeLeaveCriticalRegion@0 -KeLeaveGuardedRegion@0 +KeLeaveGuardedRegion@0=_KeLeaveGuardedRegion@0 KeLoaderBlock DATA KeNumberProcessors DATA KeProfileInterrupt@4