-/* $Id: spinlock.c,v 1.12 2002/09/07 15:12:57 chorns Exp $
+/* $Id: spinlock.c,v 1.13 2002/09/08 10:23:29 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
/* INCLUDES ****************************************************************/
-#include <ntoskrnl.h>
+#include <ddk/ntddk.h>
+#include <roscfg.h>
-#define NDEBUG
#include <internal/debug.h>
-
/* FUNCTIONS ***************************************************************/
BOOLEAN STDCALL
* SpinLock = Caller supplied storage for the spinlock
*/
{
- *SpinLock = 0;
+ SpinLock->Lock = 0;
}
-VOID FASTCALL
-KefAcquireSpinLockAtDpcLevel (PKSPIN_LOCK SpinLock)
+VOID STDCALL
+KeAcquireSpinLockAtDpcLevel (PKSPIN_LOCK SpinLock)
/*
* FUNCTION: Acquires a spinlock when the caller is already running at
* dispatch level
* FIXME: This depends on gcc assembling this test to a single load from
* the spinlock's value.
*/
- if ((ULONG)*SpinLock >= 2)
+ if ((ULONG)SpinLock->Lock >= 2)
{
- DbgPrint("Lock %x has bad value %x\n", SpinLock, *SpinLock);
+ DbgPrint("Lock %x has bad value %x\n", SpinLock, SpinLock->Lock);
KeBugCheck(0);
}
- while ((i = InterlockedExchange(SpinLock, 1)) == 1)
+ while ((i = InterlockedExchange(&SpinLock->Lock, 1)) == 1)
{
#ifndef MP
DbgPrint("Spinning on spinlock %x current value %x\n", SpinLock, i);
}
}
-#undef KeAcquireSpinLockAtDpcLevel
-
VOID STDCALL
-KeAcquireSpinLockAtDpcLevel (PKSPIN_LOCK SpinLock)
-/*
- * FUNCTION: Acquires a spinlock when the caller is already running at
- * dispatch level
- * ARGUMENTS:
- * SpinLock = Spinlock to acquire
- */
-{
- KefAcquireSpinLockAtDpcLevel (SpinLock);
-}
-
-VOID FASTCALL
-KefReleaseSpinLockFromDpcLevel (PKSPIN_LOCK SpinLock)
+KeReleaseSpinLockFromDpcLevel (PKSPIN_LOCK SpinLock)
/*
* FUNCTION: Releases a spinlock when the caller was running at dispatch
* level before acquiring it
* SpinLock = Spinlock to release
*/
{
- if (*SpinLock != 1)
+ if (SpinLock->Lock != 1)
{
DbgPrint("Releasing unacquired spinlock %x\n", SpinLock);
KeBugCheck(0);
}
- (void)InterlockedExchange(SpinLock, 0);
-}
-
-#undef KeReleaseSpinLockFromDpcLevel
-
-VOID STDCALL
-KeReleaseSpinLockFromDpcLevel (PKSPIN_LOCK SpinLock)
-/*
- * FUNCTION: Releases a spinlock when the caller was running at dispatch
- * level before acquiring it
- * ARGUMENTS:
- * SpinLock = Spinlock to release
- */
-{
- KefReleaseSpinLockFromDpcLevel (SpinLock);
+ (void)InterlockedExchange(&SpinLock->Lock, 0);
}
/* EOF */