Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/ntoskrnl.c | 9 --------- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- dlls/ntoskrnl.exe/sync.c | 20 ++++++++++++++++++++ include/ddk/wdm.h | 3 +++ 4 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 26668408a6..e6bb5930bd 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -3859,15 +3859,6 @@ void WINAPI KeReleaseInStackQueuedSpinLock( KLOCK_QUEUE_HANDLE *handle ) FIXME( "stub: %p\n", handle ); }
-/*********************************************************************** - * KeAcquireSpinLockRaiseToDpc (NTOSKRNL.EXE.@) - */ -KIRQL WINAPI KeAcquireSpinLockRaiseToDpc(KSPIN_LOCK *spinlock) -{ - FIXME( "stub: %p\n", spinlock ); - return 0; -} - /*********************************************************************** * IoCreateNotificationEvent (NTOSKRNL.EXE.@) */ diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index c4a4213287..3de7c1cac7 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -511,7 +511,7 @@ @ stdcall Ke386SetIoAccessMap(long ptr) @ stub KeAcquireInterruptSpinLock @ stub KeAcquireSpinLockAtDpcLevel -@ stdcall -arch=x86_64 KeAcquireSpinLockRaiseToDpc(ptr) +@ stdcall -arch=arm,arm64,x86_64 KeAcquireSpinLockRaiseToDpc(ptr) @ stub KeAddSystemServiceTable @ stub KeAreApcsDisabled @ stub KeAttachProcess diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 832b0480b9..74e84a6505 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -384,6 +384,15 @@ void WINAPI KeInitializeSpinLock( KSPIN_LOCK *lock ) }
#ifndef __i386__ +static inline void small_pause(void) +{ +#ifdef __x86_64__ + __asm__ __volatile__( "rep;nop" : : : "memory" ); +#else + __asm__ __volatile__( "" : : : "memory" ); +#endif +} + /*********************************************************************** * KeReleaseSpinLock (NTOSKRNL.EXE.@) */ @@ -392,4 +401,15 @@ void WINAPI KeReleaseSpinLock( KSPIN_LOCK *lock, KIRQL irql ) TRACE("lock %p, irql %u.\n", lock, irql); InterlockedExchangePointer( (void **)lock, 0 ); } + +/*********************************************************************** + * KeAcquireSpinLockRaiseToDpc (NTOSKRNL.EXE.@) + */ +KIRQL WINAPI KeAcquireSpinLockRaiseToDpc( KSPIN_LOCK *lock ) +{ + TRACE("lock %p.\n", lock); + while (!InterlockedCompareExchangePointer( (void **)lock, (void *)1, (void *)0 )) + small_pause(); + return 0; +} #endif diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 6b62811a67..258fdb3893 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1448,6 +1448,9 @@ NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG);
#ifdef __i386__ void WINAPI KeAcquireSpinLock(KSPIN_LOCK*,KIRQL*); +#else +#define KeAcquireSpinLock( lock, irql ) *(irql) = KeAcquireSpinLockRaiseToDpc( lock ) +KIRQL WINAPI KeAcquireSpinLockRaiseToDpc(KSPIN_LOCK*); #endif BOOLEAN WINAPI KeCancelTimer(KTIMER*); void WINAPI KeClearEvent(PRKEVENT);