mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 13:30:27 +00:00
hal: Implement plain spinlock functions on top of DPC-level ones.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
05f5cce6c8
commit
286ef48498
|
@ -1,5 +1,6 @@
|
|||
MODULE = hal.dll
|
||||
IMPORTLIB = hal
|
||||
IMPORTS = ntoskrnl
|
||||
|
||||
C_SRCS = \
|
||||
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__ */
|
||||
|
||||
|
|
Loading…
Reference in a new issue