1 /* 2 * PROJECT: ReactOS Kernel 3 * LICENSE: GPL - See COPYING in the top level directory 4 * FILE: ntoskrnl/ke/gmutex.c 5 * PURPOSE: Implements Guarded Mutex 6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) 7 * Filip Navara (navaraf@reactos.org) 8 */ 9 10 /* INCLUDES ******************************************************************/ 11 12 #include <ntoskrnl.h> 13 #define NDEBUG 14 #include <debug.h> 15 16 /* Undefine some macros we implement here */ 17 #undef KeInitializeGuardedMutex 18 #undef KeAcquireGuardedMutex 19 #undef KeReleaseGuardedMutex 20 #undef KeAcquireGuardedMutexUnsafe 21 #undef KeReleaseGuardedMutexUnsafe 22 #undef KeTryToAcquireGuardedMutex 23 24 /* PUBLIC FUNCTIONS **********************************************************/ 25 26 /* 27 * @implemented 28 */ 29 VOID 30 FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)31KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex) 32 { 33 /* Call the inline */ 34 _KeInitializeGuardedMutex(GuardedMutex); 35 } 36 37 /* 38 * @implemented 39 */ 40 VOID 41 FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)42KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex) 43 { 44 /* Call the inline */ 45 _KeAcquireGuardedMutex(GuardedMutex); 46 } 47 48 /* 49 * @implemented 50 */ 51 VOID 52 FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)53KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex) 54 { 55 /* Call the inline */ 56 _KeReleaseGuardedMutex(GuardedMutex); 57 } 58 59 /* 60 * @implemented 61 */ 62 VOID 63 FASTCALL KeAcquireGuardedMutexUnsafe(IN OUT PKGUARDED_MUTEX GuardedMutex)64KeAcquireGuardedMutexUnsafe(IN OUT PKGUARDED_MUTEX GuardedMutex) 65 { 66 /* Call the inline */ 67 _KeAcquireGuardedMutexUnsafe(GuardedMutex); 68 } 69 70 /* 71 * @implemented 72 */ 73 VOID 74 FASTCALL KeReleaseGuardedMutexUnsafe(IN OUT PKGUARDED_MUTEX GuardedMutex)75KeReleaseGuardedMutexUnsafe(IN OUT PKGUARDED_MUTEX GuardedMutex) 76 { 77 /* Call the inline */ 78 _KeReleaseGuardedMutexUnsafe(GuardedMutex); 79 } 80 81 /* 82 * @implemented 83 */ 84 BOOLEAN 85 FASTCALL KeTryToAcquireGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)86KeTryToAcquireGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex) 87 { 88 /* Call the inline */ 89 return _KeTryToAcquireGuardedMutex(GuardedMutex); 90 } 91 92 /** 93 * @name KeEnterGuardedRegion 94 * 95 * Enters a guarded region. This causes all (incl. special kernel) APCs 96 * to be disabled. 97 */ 98 VOID 99 NTAPI _KeEnterGuardedRegion(VOID)100_KeEnterGuardedRegion(VOID) 101 { 102 /* Use the inlined version */ 103 KeEnterGuardedRegion(); 104 } 105 106 /** 107 * @name KeLeaveGuardedRegion 108 * 109 * Leaves a guarded region and delivers pending APCs if possible. 110 */ 111 VOID 112 NTAPI _KeLeaveGuardedRegion(VOID)113_KeLeaveGuardedRegion(VOID) 114 { 115 /* Use the inlined version */ 116 KeLeaveGuardedRegion(); 117 } 118 119 /* EOF */ 120