- Disable commented out define-check which i had only commented to check building.
[reactos.git] / reactos / hal / halx86 / up / spinlock.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/hal/halx86/up/spinlock.c
5 * PURPOSE: Implements spinlocks
6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
7 */
8
9 /* INCLUDES ****************************************************************/
10
11 #include <hal.h>
12 #define NDEBUG
13 #include <debug.h>
14
15 #undef KeAcquireSpinLock
16 #undef KeReleaseSpinLock
17
18 /* FUNCTIONS ***************************************************************/
19
20 /*
21 * @implemented
22 */
23 VOID
24 NTAPI
25 KeAcquireSpinLock(PKSPIN_LOCK SpinLock,
26 PKIRQL OldIrql)
27 {
28 /* Call the fastcall function */
29 *OldIrql = KfAcquireSpinLock(SpinLock);
30 }
31
32 /*
33 * @implemented
34 */
35 KIRQL
36 FASTCALL
37 KeAcquireSpinLockRaiseToSynch(PKSPIN_LOCK SpinLock)
38 {
39 /* Simply raise to dispatch */
40 return KfRaiseIrql(DISPATCH_LEVEL);
41 }
42
43 /*
44 * @implemented
45 */
46 VOID
47 NTAPI
48 KeReleaseSpinLock(PKSPIN_LOCK SpinLock,
49 KIRQL NewIrql)
50 {
51 /* Call the fastcall function */
52 KfReleaseSpinLock(SpinLock, NewIrql);
53 }
54
55 /*
56 * @implemented
57 */
58 KIRQL
59 FASTCALL
60 KfAcquireSpinLock(PKSPIN_LOCK SpinLock)
61 {
62 /* Simply raise to dispatch */
63 return KfRaiseIrql(DISPATCH_LEVEL);
64 }
65
66 /*
67 * @implemented
68 */
69 VOID
70 FASTCALL
71 KfReleaseSpinLock(PKSPIN_LOCK SpinLock,
72 KIRQL OldIrql)
73 {
74 /* Simply lower IRQL back */
75 KfLowerIrql(OldIrql);
76 }
77
78 /*
79 * @implemented
80 */
81 KIRQL
82 FASTCALL
83 KeAcquireQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
84 {
85 /* Simply raise to dispatch */
86 return KfRaiseIrql(DISPATCH_LEVEL);
87 }
88
89 /*
90 * @implemented
91 */
92 KIRQL
93 FASTCALL
94 KeAcquireQueuedSpinLockRaiseToSynch(IN PKLOCK_QUEUE_HANDLE LockHandle)
95 {
96 /* Simply raise to dispatch */
97 return KfRaiseIrql(DISPATCH_LEVEL);
98 }
99
100 /*
101 * @implemented
102 */
103 VOID
104 FASTCALL
105 KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock,
106 IN PKLOCK_QUEUE_HANDLE LockHandle)
107 {
108 /* Simply raise to dispatch */
109 LockHandle->OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
110 }
111
112 /*
113 * @implemented
114 */
115 VOID
116 FASTCALL
117 KeReleaseQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle,
118 IN KIRQL OldIrql)
119 {
120 /* Simply lower IRQL back */
121 KfLowerIrql(OldIrql);
122 }
123
124 /*
125 * @implemented
126 */
127 VOID
128 FASTCALL
129 KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
130 {
131 /* Simply lower IRQL back */
132 KfLowerIrql(LockHandle->OldIrql);
133 }
134
135 /*
136 * @implemented
137 */
138 BOOLEAN
139 FASTCALL
140 KeTryToAcquireQueuedSpinLockRaiseToSynch(IN PKLOCK_QUEUE_HANDLE LockHandle,
141 IN PKIRQL OldIrql)
142 {
143 /* Simply raise to dispatch */
144 *OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
145
146 /* Always return true on UP Machines */
147 return TRUE;
148 }
149
150 /*
151 * @implemented
152 */
153 BOOLEAN
154 FASTCALL
155 KeTryToAcquireQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle,
156 IN PKIRQL OldIrql)
157 {
158 /* Simply raise to dispatch */
159 *OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
160
161 /* Always return true on UP Machines */
162 return TRUE;
163 }
164
165
166 /* EOF */