Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/hal/hal.c | 19 ++++++++++++++++--- dlls/hal/hal.spec | 2 +- include/ddk/wdm.h | 3 +++ 3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/hal/hal.c b/dlls/hal/hal.c index 924fd9e6d9..fca4f23403 100644 --- a/dlls/hal/hal.c +++ b/dlls/hal/hal.c @@ -69,11 +69,24 @@ BOOLEAN WINAPI DECLSPEC_HIDDEN __regs_ExTryToAcquireFastMutex(PFAST_MUTEX FastMu }
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 ) diff --git a/dlls/hal/hal.spec b/dlls/hal/hal.spec index 9b74701401..521697b79b 100644 --- a/dlls/hal/hal.spec +++ b/dlls/hal/hal.spec @@ -68,7 +68,7 @@ @ stub IoSetPartitionInformation @ stub IoWritePartitionTable @ stub KdComPortInUse -@ stub KeAcquireSpinLock +@ stdcall -arch=i386 KeAcquireSpinLock(ptr ptr) @ stub KeFlushWriteBuffer @ stdcall -arch=arm,arm64,i386 KeGetCurrentIrql() @ stub KeLowerIrql diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 6193c023ea..6b62811a67 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1446,6 +1446,9 @@ void WINAPI IoReleaseCancelSpinLock(KIRQL); NTSTATUS WINAPI IoSetDeviceInterfaceState(UNICODE_STRING*,BOOLEAN); NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG);
+#ifdef __i386__ +void WINAPI KeAcquireSpinLock(KSPIN_LOCK*,KIRQL*); +#endif BOOLEAN WINAPI KeCancelTimer(KTIMER*); void WINAPI KeClearEvent(PRKEVENT); NTSTATUS WINAPI KeDelayExecutionThread(KPROCESSOR_MODE,BOOLEAN,LARGE_INTEGER*);