hal: Implement KeAcquireSpinLock().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-01-23 23:50:36 -06:00 committed by Alexandre Julliard
parent 55463d4aa8
commit 389b8fc393
3 changed files with 20 additions and 4 deletions

View File

@ -69,11 +69,24 @@ BOOLEAN WINAPI DECLSPEC_HIDDEN __regs_ExTryToAcquireFastMutex(PFAST_MUTEX FastMu
} }
DEFINE_FASTCALL1_ENTRYPOINT( KfAcquireSpinLock ) DEFINE_FASTCALL1_ENTRYPOINT( KfAcquireSpinLock )
KIRQL WINAPI DECLSPEC_HIDDEN __regs_KfAcquireSpinLock(PKSPIN_LOCK SpinLock) KIRQL WINAPI DECLSPEC_HIDDEN __regs_KfAcquireSpinLock( KSPIN_LOCK *lock )
{ {
FIXME( "(%p) stub!\n", SpinLock ); KIRQL irql;
KeAcquireSpinLock( lock, &irql );
return irql;
}
return 0; 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();
*irql = 0;
} }
DEFINE_FASTCALL2_ENTRYPOINT( KfReleaseSpinLock ) DEFINE_FASTCALL2_ENTRYPOINT( KfReleaseSpinLock )

View File

@ -68,7 +68,7 @@
@ stub IoSetPartitionInformation @ stub IoSetPartitionInformation
@ stub IoWritePartitionTable @ stub IoWritePartitionTable
@ stub KdComPortInUse @ stub KdComPortInUse
@ stub KeAcquireSpinLock @ stdcall -arch=i386 KeAcquireSpinLock(ptr ptr)
@ stub KeFlushWriteBuffer @ stub KeFlushWriteBuffer
@ stdcall -arch=arm,arm64,i386 KeGetCurrentIrql() @ stdcall -arch=arm,arm64,i386 KeGetCurrentIrql()
@ stub KeLowerIrql @ stub KeLowerIrql

View File

@ -1419,6 +1419,9 @@ void WINAPI IoReleaseCancelSpinLock(KIRQL);
NTSTATUS WINAPI IoSetDeviceInterfaceState(UNICODE_STRING*,BOOLEAN); NTSTATUS WINAPI IoSetDeviceInterfaceState(UNICODE_STRING*,BOOLEAN);
NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG); NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG);
#ifdef __i386__
void WINAPI KeAcquireSpinLock(KSPIN_LOCK*,KIRQL*);
#endif
BOOLEAN WINAPI KeCancelTimer(KTIMER*); BOOLEAN WINAPI KeCancelTimer(KTIMER*);
void WINAPI KeClearEvent(PRKEVENT); void WINAPI KeClearEvent(PRKEVENT);
NTSTATUS WINAPI KeDelayExecutionThread(KPROCESSOR_MODE,BOOLEAN,LARGE_INTEGER*); NTSTATUS WINAPI KeDelayExecutionThread(KPROCESSOR_MODE,BOOLEAN,LARGE_INTEGER*);