3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/hal/x86/spinlock.c
6 * PURPOSE: Implements spinlocks
7 * PROGRAMMER: David Welch (welch@cwcom.net)
8 * Eric Kohl (ekohl@rz-online.de)
14 * NOTE: On a uniprocessor machine spinlocks are implemented by raising
18 /* INCLUDES ****************************************************************/
20 #include <ddk/ntddk.h>
22 #include <internal/debug.h>
24 /* FUNCTIONS ***************************************************************/
32 * FUNCTION: Acquires a spinlock
34 * SpinLock = Spinlock to acquire
35 * OldIrql (OUT) = Caller supplied storage for the previous irql
38 KeRaiseIrql(DISPATCH_LEVEL,OldIrql);
39 KeAcquireSpinLockAtDpcLevel(SpinLock);
45 KeAcquireSpinLockRaiseToSynch (
49 ASSERT_IRQL(SYNCH_LEVEL);
50 KeAcquireSpinLockAtDpcLevel(SpinLock);
53 #endif /* LIBCAPTIVE */
61 * FUNCTION: Releases a spinlock
63 * SpinLock = Spinlock to release
64 * NewIrql = Irql level before acquiring the spinlock
67 KeReleaseSpinLockFromDpcLevel(SpinLock);
78 KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
79 KeAcquireSpinLockAtDpcLevel(SpinLock);
90 * FUNCTION: Releases a spinlock
92 * SpinLock = Spinlock to release
93 * NewIrql = Irql level before acquiring the spinlock
96 KeReleaseSpinLockFromDpcLevel(SpinLock);