16*pExEnterCriticalRegionAndAcquireFastMutexUnsafe)(
23*pExReleaseFastMutexUnsafeAndLeaveCriticalRegion)(
31#define CheckMutex(Mutex, ExpectedCount, ExpectedOwner, \
32 ExpectedContention, ExpectedOldIrql, \
35 ok_eq_long((Mutex)->Count, ExpectedCount); \
36 ok_eq_pointer((Mutex)->Owner, ExpectedOwner); \
37 ok_eq_ulong((Mutex)->Contention, ExpectedContention); \
38 ok_eq_ulong((Mutex)->OldIrql, (ULONG)ExpectedOldIrql); \
39 ok_bool_false(KeAreApcsDisabled(), "KeAreApcsDisabled returned"); \
40 ok_irql(ExpectedIrql); \
51 ok_irql(OriginalIrql);
62 if (!
skip(pExiAcquireFastMutex &&
63 pExiReleaseFastMutex &&
64 pExiTryToAcquireFastMutex,
"No fastcall fast mutex functions\n"))
66 pExiAcquireFastMutex(
Mutex);
70 pExiReleaseFastMutex(
Mutex);
81 if (!
skip(pExEnterCriticalRegionAndAcquireFastMutexUnsafe &&
82 pExReleaseFastMutexUnsafeAndLeaveCriticalRegion,
83 "Shortcut functions not available"))
85 pExEnterCriticalRegionAndAcquireFastMutexUnsafe(
Mutex);
87 pExReleaseFastMutexUnsafeAndLeaveCriticalRegion(
Mutex);
106 Mutex->OldIrql = 0x55555555LU;
122 Mutex->OldIrql = OriginalIrql;
133 ok_irql(OriginalIrql);
316 skip(
FALSE,
"ROSTESTS-367: Skipping kmtest:ExFastMutex because it hangs on Windows Server 2003 x64-Testbot.\n");
#define CheckMutex(Mutex, ExpectedCount, ExpectedOwner, ExpectedContention, ExpectedOldIrql, ExpectedIrql)
static NTSTATUS StartThread(PTHREAD_DATA ThreadData, PLARGE_INTEGER Timeout, KIRQL Irql, BOOLEAN Try, BOOLEAN RetExpected)
static VOID NTAPI AcquireMutexThread(PVOID Parameter)
static VOID FinishThread(PTHREAD_DATA ThreadData)
BOOLEAN(FASTCALL * PMUTEX_TRY_FUNCTION)(PFAST_MUTEX)
static VOID TestFastMutex(PFAST_MUTEX Mutex, KIRQL OriginalIrql)
VOID(FASTCALL * PMUTEX_FUNCTION)(PFAST_MUTEX)
static VOID TestFastMutexConcurrent(PFAST_MUTEX Mutex)
struct THREAD_DATA * PTHREAD_DATA
static VOID InitThreadData(PTHREAD_DATA ThreadData, PFAST_MUTEX Mutex, PMUTEX_FUNCTION Acquire, PMUTEX_TRY_FUNCTION TryAcquire, PMUTEX_FUNCTION Release)
#define ok_eq_hex(value, expected)
#define ok_eq_long(value, expected)
#define ok_bool_false(value, desc)
#define ok_bool_true(value, desc)
#define ok_eq_bool(value, expected)
#define KeRaiseIrql(irql, oldIrql)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeLowerIrql(oldIrql)
#define KeSetEvent(pEvt, foo, foo2)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
BOOLEAN FASTCALL ExTryToAcquireFastMutex(IN PFAST_MUTEX FastMutex)
#define KeGetCurrentThread
#define OBJ_KERNEL_HANDLE
PVOID KmtGetSystemRoutineAddress(IN PCWSTR RoutineName)
VOID KmtSetIrql(IN KIRQL NewIrql)
BOOLEAN KmtIsCheckedBuild
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
VOID FASTCALL ExReleaseFastMutexUnsafe(IN OUT PFAST_MUTEX FastMutex)
VOID FASTCALL ExAcquireFastMutexUnsafe(IN OUT PFAST_MUTEX FastMutex)
BOOLEAN NTAPI KeAreApcsDisabled(VOID)
POBJECT_TYPE PsThreadType
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
PMUTEX_TRY_FUNCTION TryAcquire
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
#define ObDereferenceObject
_Inout_opt_ PVOID Parameter