Zebediah Figura : hal: Implement plain spinlock functions on top of DPC-level ones.

Alexandre Julliard julliard at winehq.org
Mon Jan 28 16:17:01 CST 2019


Module: wine
Branch: master
Commit: 286ef484982c96504fdf4c43f5e2d182fcd9e771
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=286ef484982c96504fdf4c43f5e2d182fcd9e771

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sun Jan 27 20:45:34 2019 -0600

hal: Implement plain spinlock functions on top of DPC-level ones.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hal/Makefile.in |  1 +
 dlls/hal/hal.c       | 10 ++--------
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/dlls/hal/Makefile.in b/dlls/hal/Makefile.in
index cc2620e..63211a1 100644
--- a/dlls/hal/Makefile.in
+++ b/dlls/hal/Makefile.in
@@ -1,5 +1,6 @@
 MODULE    = hal.dll
 IMPORTLIB = hal
+IMPORTS   = ntoskrnl
 
 C_SRCS = \
 	hal.c
diff --git a/dlls/hal/hal.c b/dlls/hal/hal.c
index fca4f23..5b3ee44 100644
--- a/dlls/hal/hal.c
+++ b/dlls/hal/hal.c
@@ -76,16 +76,10 @@ KIRQL WINAPI DECLSPEC_HIDDEN __regs_KfAcquireSpinLock( KSPIN_LOCK *lock )
     return irql;
 }
 
-static inline void small_pause(void)
-{
-    __asm__ __volatile__( "rep;nop" : : : "memory" );
-}
-
 void WINAPI KeAcquireSpinLock( KSPIN_LOCK *lock, KIRQL *irql )
 {
     TRACE("lock %p, irql %p.\n", lock, irql);
-    while (!InterlockedCompareExchangePointer( (void **)lock, (void *)1, (void *)0 ))
-        small_pause();
+    KeAcquireSpinLockAtDpcLevel( lock );
     *irql = 0;
 }
 
@@ -98,7 +92,7 @@ void WINAPI DECLSPEC_HIDDEN __regs_KfReleaseSpinLock( KSPIN_LOCK *lock, KIRQL ir
 void WINAPI KeReleaseSpinLock( KSPIN_LOCK *lock, KIRQL irql )
 {
     TRACE("lock %p, irql %u.\n", lock, irql);
-    InterlockedExchangePointer( (void **)lock, 0 );
+    KeReleaseSpinLockFromDpcLevel( lock );
 }
 #endif /* __i386__ */
 




More information about the wine-cvs mailing list