Sync with trunk (48237)
[reactos.git] / ntoskrnl / ke / amd64 / spinlock.c
1 /*
2 * PROJECT: ReactOS HAL
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: hal/halx86/up/spinlock.c
5 * PURPOSE: Spinlock and Queued Spinlock Support
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #include <ntoskrnl.h>
12 #define NDEBUG
13 #include <debug.h>
14
15 #undef KeAcquireSpinLock
16 #undef KeReleaseSpinLock
17
18 /* FUNCTIONS *****************************************************************/
19
20 /*
21 * @implemented
22 */
23 KIRQL
24 KeAcquireSpinLockRaiseToSynch(PKSPIN_LOCK SpinLock)
25 {
26 #ifndef CONFIG_SMP
27 KIRQL OldIrql;
28 /* Simply raise to dispatch */
29 KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
30 return OldIrql;
31 #else
32 UNIMPLEMENTED;
33 #endif
34 }
35
36 /*
37 * @implemented
38 */
39 KIRQL
40 NTAPI
41 KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock)
42 {
43 #ifndef CONFIG_SMP
44 KIRQL OldIrql;
45 /* Simply raise to dispatch */
46 KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
47 return OldIrql;
48 #else
49 UNIMPLEMENTED;
50 #endif
51 }
52
53 /*
54 * @implemented
55 */
56 VOID
57 NTAPI
58 KeReleaseSpinLock(PKSPIN_LOCK SpinLock,
59 KIRQL OldIrql)
60 {
61 #ifndef CONFIG_SMP
62 /* Simply lower IRQL back */
63 KeLowerIrql(OldIrql);
64 #else
65 UNIMPLEMENTED;
66 #endif
67 }
68
69 /*
70 * @implemented
71 */
72 KIRQL
73 KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
74 {
75 #ifndef CONFIG_SMP
76 KIRQL OldIrql;
77 /* Simply raise to dispatch */
78 KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
79 return OldIrql;
80 #else
81 UNIMPLEMENTED;
82 #endif
83 }
84
85 /*
86 * @implemented
87 */
88 KIRQL
89 KeAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
90 {
91 #ifndef CONFIG_SMP
92 KIRQL OldIrql;
93 /* Simply raise to dispatch */
94 KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
95 return OldIrql;
96 #else
97 UNIMPLEMENTED;
98 #endif
99 }
100
101 /*
102 * @implemented
103 */
104 VOID
105 KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock,
106 IN PKLOCK_QUEUE_HANDLE LockHandle)
107 {
108 #ifndef CONFIG_SMP
109 /* Simply raise to dispatch */
110 KeRaiseIrql(DISPATCH_LEVEL, &LockHandle->OldIrql);
111 #else
112 UNIMPLEMENTED;
113 #endif
114 }
115
116 /*
117 * @implemented
118 */
119 VOID
120 KeAcquireInStackQueuedSpinLockRaiseToSynch(IN PKSPIN_LOCK SpinLock,
121 IN PKLOCK_QUEUE_HANDLE LockHandle)
122 {
123 #ifndef CONFIG_SMP
124 /* Simply raise to synch */
125 KeRaiseIrql(SYNCH_LEVEL, &LockHandle->OldIrql);
126 #else
127 UNIMPLEMENTED;
128 #endif
129 }
130
131 /*
132 * @implemented
133 */
134 VOID
135 KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
136 IN KIRQL OldIrql)
137 {
138 #ifndef CONFIG_SMP
139 /* Simply lower IRQL back */
140 KeLowerIrql(OldIrql);
141 #else
142 UNIMPLEMENTED;
143 #endif
144 }
145
146 /*
147 * @implemented
148 */
149 VOID
150 KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
151 {
152 #ifndef CONFIG_SMP
153 /* Simply lower IRQL back */
154 KeLowerIrql(LockHandle->OldIrql);
155 #else
156 UNIMPLEMENTED;
157 #endif
158 }
159
160 /*
161 * @implemented
162 */
163 BOOLEAN
164 KeTryToAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
165 IN PKIRQL OldIrql)
166 {
167 #ifndef CONFIG_SMP
168 /* Simply raise to dispatch */
169 KeRaiseIrql(DISPATCH_LEVEL, OldIrql);
170
171 /* Always return true on UP Machines */
172 return TRUE;
173 #else
174 UNIMPLEMENTED;
175 #endif
176 }
177
178 /*
179 * @implemented
180 */
181 LOGICAL
182 KeTryToAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
183 OUT PKIRQL OldIrql)
184 {
185 #ifndef CONFIG_SMP
186 /* Simply raise to dispatch */
187 KeRaiseIrql(DISPATCH_LEVEL, OldIrql);
188
189 /* Always return true on UP Machines */
190 return TRUE;
191 #else
192 UNIMPLEMENTED;
193 #endif
194 }
195
196 /* EOF */