Return type KIRQL fixed to allow compilation.
[reactos.git] / reactos / ntoskrnl / hal / x86 / spinlock.c
1 /* $Id: spinlock.c,v 1.11 2000/06/09 22:22:32 ea Exp $
2 *
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)
9 * UPDATE HISTORY:
10 * 09/06/2000 Created
11 */
12
13 /*
14 * NOTE: On a uniprocessor machine spinlocks are implemented by raising
15 * the irq level
16 */
17
18 /* INCLUDES ****************************************************************/
19
20 #include <ddk/ntddk.h>
21
22 #include <internal/debug.h>
23
24 /* FUNCTIONS ***************************************************************/
25
26 VOID
27 STDCALL
28 KeAcquireSpinLock (
29 PKSPIN_LOCK SpinLock,
30 PKIRQL OldIrql
31 )
32 /*
33 * FUNCTION: Acquires a spinlock
34 * ARGUMENTS:
35 * SpinLock = Spinlock to acquire
36 * OldIrql (OUT) = Caller supplied storage for the previous irql
37 */
38 {
39 KeRaiseIrql(DISPATCH_LEVEL,OldIrql);
40 KeAcquireSpinLockAtDpcLevel(SpinLock);
41 }
42
43 KIRQL
44 FASTCALL
45 KeAcquireSpinLockRaiseToSynch (
46 PKSPIN_LOCK SpinLock
47 )
48 {
49 UNIMPLEMENTED;
50 }
51
52 VOID
53 STDCALL
54 KeReleaseSpinLock (
55 PKSPIN_LOCK SpinLock,
56 KIRQL NewIrql
57 )
58 /*
59 * FUNCTION: Releases a spinlock
60 * ARGUMENTS:
61 * SpinLock = Spinlock to release
62 * NewIrql = Irql level before acquiring the spinlock
63 */
64 {
65 KeReleaseSpinLockFromDpcLevel(SpinLock);
66 KeLowerIrql(NewIrql);
67 }
68
69 KIRQL
70 FASTCALL
71 KfAcquireSpinLock (
72 PKSPIN_LOCK SpinLock
73 )
74 {
75 KIRQL OldIrql;
76
77 KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
78 KeAcquireSpinLockAtDpcLevel(SpinLock);
79
80 return OldIrql;
81 }
82
83 VOID
84 FASTCALL
85 KfReleaseSpinLock (
86 PKSPIN_LOCK SpinLock,
87 KIRQL NewIrql
88 )
89 /*
90 * FUNCTION: Releases a spinlock
91 * ARGUMENTS:
92 * SpinLock = Spinlock to release
93 * NewIrql = Irql level before acquiring the spinlock
94 */
95 {
96 KeReleaseSpinLockFromDpcLevel(SpinLock);
97 KeLowerIrql(NewIrql);
98 }
99
100 /* EOF */