ReactOS  r75214
spinlock.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS HAL
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: hal/halarm/generic/spinlock.c
5  * PURPOSE: SpinLock Routines
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include <hal.h>
12 #define NDEBUG
13 #include <debug.h>
14 
15 #undef KeAcquireSpinLock
16 #undef KeReleaseSpinLock
17 #undef KeRaiseIrql
18 #undef KeLowerIrql
19 
20 /* FUNCTIONS *****************************************************************/
21 
22 /*
23  * @implemented
24  */
25 VOID
26 NTAPI
29 {
30  /* Call the fastcall function */
31  *OldIrql = KfRaiseIrql(NewIrql);
32 }
33 
34 /*
35  * @implemented
36  */
37 VOID
38 NTAPI
40 {
41  /* Call the fastcall function */
42  KfLowerIrql(NewIrql);
43 }
44 
45 /*
46  * @implemented
47  */
48 VOID
49 NTAPI
52 {
53  /* Call the fastcall function */
54  *OldIrql = KfAcquireSpinLock(SpinLock);
55 }
56 
57 /*
58  * @implemented
59  */
60 KIRQL
63 {
64  /* Simply raise to dispatch */
66 }
67 
68 /*
69  * @implemented
70  */
71 VOID
72 NTAPI
74  KIRQL NewIrql)
75 {
76  /* Call the fastcall function */
77  KfReleaseSpinLock(SpinLock, NewIrql);
78 }
79 
80 /*
81  * @implemented
82  */
83 KIRQL
86 {
87  /* Simply raise to dispatch */
89 }
90 
91 /*
92  * @implemented
93  */
94 VOID
97  KIRQL OldIrql)
98 {
99  /* Simply lower IRQL back */
100  KeLowerIrql(OldIrql);
101 }
102 
103 /*
104  * @implemented
105  */
106 KIRQL
107 FASTCALL
109 {
110  /* Simply raise to dispatch */
111  return KfRaiseIrql(DISPATCH_LEVEL);
112 }
113 
114 /*
115  * @implemented
116  */
117 KIRQL
118 FASTCALL
120 {
121  /* Simply raise to dispatch */
122  return KfRaiseIrql(DISPATCH_LEVEL);
123 }
124 
125 /*
126  * @implemented
127  */
128 VOID
129 FASTCALL
132 {
133  /* Simply raise to dispatch */
134  LockHandle->OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
135 }
136 
137 /*
138  * @implemented
139  */
140 VOID
141 FASTCALL
144 {
145  /* Simply raise to dispatch */
146  LockHandle->OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
147 }
148 
149 /*
150  * @implemented
151  */
152 VOID
153 FASTCALL
155  IN KIRQL OldIrql)
156 {
157  /* Simply lower IRQL back */
158  KfLowerIrql(OldIrql);
159 }
160 
161 /*
162  * @implemented
163  */
164 VOID
165 FASTCALL
167 {
168  /* Simply lower IRQL back */
169  KfLowerIrql(LockHandle->OldIrql);
170 }
171 
172 /*
173  * @implemented
174  */
175 BOOLEAN
176 FASTCALL
178  IN PKIRQL OldIrql)
179 {
180  /* Simply raise to synch */
181  KeRaiseIrql(SYNCH_LEVEL, OldIrql);
182 
183  /* Always return true on UP Machines */
184  return TRUE;
185 }
186 
187 /*
188  * @implemented
189  */
190 LOGICAL
191 FASTCALL
194 {
195  /* Simply raise to dispatch */
196  KeRaiseIrql(DISPATCH_LEVEL, OldIrql);
197 
198  /* Always return true on UP Machines */
199  return TRUE;
200 }
201 
202 /* EOF */
BOOLEAN FASTCALL KeTryToAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN PKIRQL OldIrql)
Definition: spinlock.c:177
VOID FASTCALL KeAcquireInStackQueuedSpinLockRaiseToSynch(IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: spinlock.c:142
#define IN
Definition: typedefs.h:39
#define TRUE
Definition: types.h:120
VOID NTAPI KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
Definition: spinlock.c:50
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
VOID FASTCALL KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: spinlock.c:130
#define FASTCALL
Definition: nt_native.h:50
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
UCHAR KIRQL
Definition: env_spec_w32.h:591
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
LOGICAL FASTCALL KeTryToAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, OUT PKIRQL OldIrql)
Definition: spinlock.c:192
KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
Definition: irql.c:243
VOID FASTCALL KfLowerIrql(KIRQL NewIrql)
Definition: irql.c:210
VOID FASTCALL KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: spinlock.c:166
unsigned char BOOLEAN
VOID FASTCALL KfReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL OldIrql)
Definition: spinlock.c:96
VOID FASTCALL KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN KIRQL OldIrql)
Definition: spinlock.c:154
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
#define SYNCH_LEVEL
Definition: env_spec_w32.h:704
KIRQL FASTCALL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
Definition: spinlock.c:108
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
enum _KSPIN_LOCK_QUEUE_NUMBER KSPIN_LOCK_QUEUE_NUMBER
VOID NTAPI KeRaiseIrql(KIRQL NewIrql, PKIRQL OldIrql)
Definition: spinlock.c:27
VOID NTAPI KeReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL NewIrql)
Definition: spinlock.c:73
KIRQL FASTCALL KeAcquireSpinLockRaiseToSynch(PKSPIN_LOCK SpinLock)
Definition: spinlock.c:62
#define OUT
Definition: typedefs.h:40
KIRQL FASTCALL KfAcquireSpinLock(PKSPIN_LOCK SpinLock)
Definition: spinlock.c:85
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742
VOID NTAPI KeLowerIrql(KIRQL NewIrql)
Definition: spinlock.c:39
KIRQL FASTCALL KeAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
Definition: spinlock.c:119
_Requires_lock_held_ SpinLock _Releases_lock_ SpinLock _In_ _IRQL_restores_ KIRQL NewIrql
Definition: ke.h:114