ReactOS  0.4.14-dev-98-gb0d4763
spinlock.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for spinlock.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define LQ_WAIT   1
 
#define LQ_OWN   2
 

Functions

VOID FASTCALL KeAcquireQueuedSpinLockAtDpcLevel (IN PKSPIN_LOCK_QUEUE LockHandle)
 
VOID FASTCALL KeReleaseQueuedSpinLockFromDpcLevel (IN PKSPIN_LOCK_QUEUE LockHandle)
 
KIRQL NTAPI KeAcquireInterruptSpinLock (IN PKINTERRUPT Interrupt)
 
VOID NTAPI KeReleaseInterruptSpinLock (IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
 
VOID NTAPI _KeInitializeSpinLock (IN PKSPIN_LOCK SpinLock)
 
VOID NTAPI KeAcquireSpinLockAtDpcLevel (IN PKSPIN_LOCK SpinLock)
 
VOID NTAPI KeReleaseSpinLockFromDpcLevel (IN PKSPIN_LOCK SpinLock)
 
VOID FASTCALL KefAcquireSpinLockAtDpcLevel (IN PKSPIN_LOCK SpinLock)
 
VOID FASTCALL KefReleaseSpinLockFromDpcLevel (IN PKSPIN_LOCK SpinLock)
 
VOID FASTCALL KiAcquireSpinLock (IN PKSPIN_LOCK SpinLock)
 
VOID FASTCALL KiReleaseSpinLock (IN PKSPIN_LOCK SpinLock)
 
BOOLEAN FASTCALL KeTryToAcquireSpinLockAtDpcLevel (IN OUT PKSPIN_LOCK SpinLock)
 
VOID FASTCALL KeAcquireInStackQueuedSpinLockAtDpcLevel (IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle)
 
VOID FASTCALL KeReleaseInStackQueuedSpinLockFromDpcLevel (IN PKLOCK_QUEUE_HANDLE LockHandle)
 
KIRQL FASTCALL KeAcquireSpinLockForDpc (IN PKSPIN_LOCK SpinLock)
 
VOID FASTCALL KeReleaseSpinLockForDpc (IN PKSPIN_LOCK SpinLock, IN KIRQL OldIrql)
 
VOID FASTCALL KeAcquireInStackQueuedSpinLockForDpc (IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle)
 
VOID FASTCALL KeReleaseInStackQueuedSpinLockForDpc (IN PKLOCK_QUEUE_HANDLE LockHandle)
 
BOOLEAN FASTCALL KeTestSpinLock (IN PKSPIN_LOCK SpinLock)
 

Macro Definition Documentation

◆ LQ_OWN

#define LQ_OWN   2

Definition at line 16 of file spinlock.c.

◆ LQ_WAIT

#define LQ_WAIT   1

Definition at line 15 of file spinlock.c.

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file spinlock.c.

Function Documentation

◆ _KeInitializeSpinLock()

VOID NTAPI _KeInitializeSpinLock ( IN PKSPIN_LOCK  SpinLock)

Definition at line 180 of file spinlock.c.

181 {
182  /* Clear it */
183  *SpinLock = 0;
184 }
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798

◆ KeAcquireInStackQueuedSpinLockAtDpcLevel()

VOID FASTCALL KeAcquireInStackQueuedSpinLockAtDpcLevel ( IN PKSPIN_LOCK  SpinLock,
IN PKLOCK_QUEUE_HANDLE  LockHandle 
)

Definition at line 337 of file spinlock.c.

339 {
340 #ifdef CONFIG_SMP
341  /* Set it up properly */
344 #if 0
346 #else
347  /* Make sure we are at DPC or above! */
349  {
350  /* We aren't -- bugcheck */
351  KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
354  0,
355  0);
356  }
357 
358  /* Acquire the lock */
360 #endif
361 #endif
362 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
PKSPIN_LOCK volatile Lock
Definition: ketypes.h:611
struct _KSPIN_LOCK_QUEUE *volatile Next
Definition: ketypes.h:610
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE VOID KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:20
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
KSPIN_LOCK_QUEUE LockQueue
Definition: ketypes.h:615
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742
VOID FASTCALL KeAcquireQueuedSpinLockAtDpcLevel(IN PKSPIN_LOCK_QUEUE LockHandle)
Definition: spinlock.c:99
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:107

Referenced by KiAcquireApcLockAtDpcLevel(), and KiAcquireDeviceQueueLock().

◆ KeAcquireInStackQueuedSpinLockForDpc()

VOID FASTCALL KeAcquireInStackQueuedSpinLockForDpc ( IN PKSPIN_LOCK  SpinLock,
IN PKLOCK_QUEUE_HANDLE  LockHandle 
)

Definition at line 420 of file spinlock.c.

422 {
424  return;
425 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ KeAcquireInterruptSpinLock()

KIRQL NTAPI KeAcquireInterruptSpinLock ( IN PKINTERRUPT  Interrupt)

Definition at line 148 of file spinlock.c.

149 {
150  KIRQL OldIrql;
151 
152  /* Raise IRQL */
153  KeRaiseIrql(Interrupt->SynchronizeIrql, &OldIrql);
154 
155  /* Acquire spinlock on MP */
156  KeAcquireSpinLockAtDpcLevel(Interrupt->ActualLock);
157  return OldIrql;
158 }
VOID NTAPI KeAcquireSpinLockAtDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:192
UCHAR KIRQL
Definition: env_spec_w32.h:591
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
VOID NTAPI KeRaiseIrql(KIRQL NewIrql, PKIRQL OldIrql)
Definition: spinlock.c:27

Referenced by i8042DpcRoutineMouseTimeout(), i8042KbdDpcRoutine(), i8042MouDpcRoutine(), i8042PacketDpc(), i8042StartPacket(), KeConnectInterrupt(), KeDisconnectInterrupt(), KiInterruptDispatch2(), PortAcquireSpinLock(), and StartProcedure().

◆ KeAcquireQueuedSpinLockAtDpcLevel()

VOID FASTCALL KeAcquireQueuedSpinLockAtDpcLevel ( IN PKSPIN_LOCK_QUEUE  LockHandle)

Definition at line 99 of file spinlock.c.

100 {
101 #ifdef CONFIG_SMP
102  /* Make sure we are at DPC or above! */
104  {
105  /* We aren't -- bugcheck */
106  KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
107  (ULONG_PTR)LockHandle->Lock,
109  0,
110  0);
111  }
112 
113  /* Do the inlined function */
115 #endif
116 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
uint32_t ULONG_PTR
Definition: typedefs.h:63
FORCEINLINE VOID KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:20
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:107

Referenced by KeAcquireInStackQueuedSpinLockAtDpcLevel().

◆ KeAcquireSpinLockAtDpcLevel()

VOID NTAPI KeAcquireSpinLockAtDpcLevel ( IN PKSPIN_LOCK  SpinLock)

Definition at line 192 of file spinlock.c.

193 {
194  /* Make sure we are at DPC or above! */
196  {
197  /* We aren't -- bugcheck */
198  KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
201  0,
202  0);
203  }
204 
205  /* Do the inlined function */
207 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
uint32_t ULONG_PTR
Definition: typedefs.h:63
FORCEINLINE VOID KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:20
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:107

Referenced by _Function_class_(), AcpiOsAcquireLock(), CancelQueued(), CcPerformReadAhead(), CcPurgeCacheSection(), CcRosCreateVacb(), CcRosDeleteFileCache(), CcRosFreeUnusedVacb(), CcRosInitializeFileCache(), CcRosLookupVacb(), CcRosMarkDirtyVacb(), CcRosReleaseFileCache(), CcRosTraceCacheMap(), CcRosTrimCache(), CcRosUnmarkDirtyVacb(), ClasspReleaseQueue(), EthFilterDprIndicateReceiveComplete(), ExpTimerApcKernelRoutine(), ExTimerRundown(), CPortPinWaveCyclic::GeneratePositionEvents(), InterfacePciDevicePresent(), InterfacePciDevicePresentEx(), IServiceGroupDpc(), KeAcquireInterruptSpinLock(), KeIpiGenericCall(), KeStartProfile(), KeStopProfile(), KeSynchronizeExecution(), KiRetireDpcList(), KsCancelRoutine(), KsMoveIrpsOnCancelableQueue(), KsRemoveIrpFromCancelableQueue(), MiniDoRequest(), MiniportWorker(), MiniRequestComplete(), MiniReset(), MiniTimerDpcFunction(), NdisAcquireReadWriteLock(), NdisDprAcquireSpinLock(), NdisDprAllocatePacket(), NdisDprFreePacket(), NtCancelTimer(), NtSetTimer(), ProtocolReceive(), RxTimerDispatch(), ScsiPortDpcForIsr(), ScsiPortIoTimer(), ScsiPortStartIo(), SpiAllocateSrbStructures(), SpiMiniportTimerDpc(), SpiProcessCompletedRequest(), TcpipAcquireSpinLockAtDpcLevel(), USBPORT_CancelActiveTransferIrp(), USBPORT_CancelPendingTransferIrp(), USBPORT_ClosePipe(), USBPORT_DpcHandler(), USBPORT_EndpointWorker(), USBPORT_FlushCancelList(), USBPORT_FlushPendingTransfers(), USBPORT_GetEndpointState(), USBPORT_IsrDpc(), USBPORT_IsrDpcHandler(), USBPORT_ReopenPipe(), USBPORT_ResetPipe(), USBPORT_RestoreDevice(), USBPORT_WorkerThreadHandler(), USBSTOR_Cancel(), USBSTOR_TimerRoutine(), and VideoPortAcquireSpinLockAtDpcLevel().

◆ KeAcquireSpinLockForDpc()

KIRQL FASTCALL KeAcquireSpinLockForDpc ( IN PKSPIN_LOCK  SpinLock)

Definition at line 398 of file spinlock.c.

399 {
401  return 0;
402 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ KefAcquireSpinLockAtDpcLevel()

VOID FASTCALL KefAcquireSpinLockAtDpcLevel ( IN PKSPIN_LOCK  SpinLock)

Definition at line 237 of file spinlock.c.

238 {
239  /* Make sure we are at DPC or above! */
241  {
242  /* We aren't -- bugcheck */
243  KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
246  0,
247  0);
248  }
249 
250  /* Do the inlined function */
252 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
uint32_t ULONG_PTR
Definition: typedefs.h:63
FORCEINLINE VOID KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:20
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:107

◆ KefReleaseSpinLockFromDpcLevel()

VOID FASTCALL KefReleaseSpinLockFromDpcLevel ( IN PKSPIN_LOCK  SpinLock)

Definition at line 259 of file spinlock.c.

260 {
261  /* Make sure we are at DPC or above! */
263  {
264  /* We aren't -- bugcheck */
265  KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
268  0,
269  0);
270  }
271 
272  /* Do the inlined function */
274 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
FORCEINLINE VOID KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:35
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:107

◆ KeReleaseInStackQueuedSpinLockForDpc()

VOID FASTCALL KeReleaseInStackQueuedSpinLockForDpc ( IN PKLOCK_QUEUE_HANDLE  LockHandle)

Definition at line 432 of file spinlock.c.

433 {
435 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ KeReleaseInStackQueuedSpinLockFromDpcLevel()

VOID FASTCALL KeReleaseInStackQueuedSpinLockFromDpcLevel ( IN PKLOCK_QUEUE_HANDLE  LockHandle)

Definition at line 369 of file spinlock.c.

370 {
371 #ifdef CONFIG_SMP
372 #if 0
373  /* Call the internal function */
375 #else
376  /* Make sure we are at DPC or above! */
378  {
379  /* We aren't -- bugcheck */
380  KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
383  0,
384  0);
385  }
386 
387  /* Release the lock */
389 #endif
390 #endif
391 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
PKSPIN_LOCK volatile Lock
Definition: ketypes.h:611
FORCEINLINE VOID KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:35
struct _KSPIN_LOCK_QUEUE *volatile Next
Definition: ketypes.h:610
uint32_t ULONG_PTR
Definition: typedefs.h:63
VOID FASTCALL KeReleaseQueuedSpinLockFromDpcLevel(IN PKSPIN_LOCK_QUEUE LockHandle)
Definition: spinlock.c:120
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
KSPIN_LOCK_QUEUE LockQueue
Definition: ketypes.h:615
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:107

Referenced by KiReleaseApcLockFromDpcLevel(), KiReleaseDeviceQueueLock(), and KiReleaseProcessLockFromDpcLevel().

◆ KeReleaseInterruptSpinLock()

VOID NTAPI KeReleaseInterruptSpinLock ( IN PKINTERRUPT  Interrupt,
IN KIRQL  OldIrql 
)

Definition at line 165 of file spinlock.c.

167 {
168  /* Release lock on MP */
169  KeReleaseSpinLockFromDpcLevel(Interrupt->ActualLock);
170 
171  /* Lower IRQL */
173 }
VOID NTAPI KeReleaseSpinLockFromDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:215
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
VOID NTAPI KeLowerIrql(KIRQL NewIrql)
Definition: spinlock.c:39

Referenced by i8042DpcRoutineMouseTimeout(), i8042KbdDpcRoutine(), i8042MouDpcRoutine(), i8042PacketDpc(), i8042StartPacket(), KeConnectInterrupt(), KeDisconnectInterrupt(), KiInterruptDispatch2(), PortReleaseSpinLock(), and StartProcedure().

◆ KeReleaseQueuedSpinLockFromDpcLevel()

VOID FASTCALL KeReleaseQueuedSpinLockFromDpcLevel ( IN PKSPIN_LOCK_QUEUE  LockHandle)

Definition at line 120 of file spinlock.c.

121 {
122 #ifdef CONFIG_SMP
123  /* Make sure we are at DPC or above! */
125  {
126  /* We aren't -- bugcheck */
127  KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
128  (ULONG_PTR)LockHandle->Lock,
130  0,
131  0);
132  }
133 
134  /* Do the inlined function */
136 #endif
137 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
FORCEINLINE VOID KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:35
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:107

Referenced by KeReleaseInStackQueuedSpinLockFromDpcLevel().

◆ KeReleaseSpinLockForDpc()

VOID FASTCALL KeReleaseSpinLockForDpc ( IN PKSPIN_LOCK  SpinLock,
IN KIRQL  OldIrql 
)

Definition at line 409 of file spinlock.c.

411 {
413 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ KeReleaseSpinLockFromDpcLevel()

VOID NTAPI KeReleaseSpinLockFromDpcLevel ( IN PKSPIN_LOCK  SpinLock)

Definition at line 215 of file spinlock.c.

216 {
217  /* Make sure we are at DPC or above! */
219  {
220  /* We aren't -- bugcheck */
221  KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
224  0,
225  0);
226  }
227 
228  /* Do the inlined function */
230 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
FORCEINLINE VOID KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:35
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:107

Referenced by _Function_class_(), AcpiOsReleaseLock(), CcPerformReadAhead(), CcPurgeCacheSection(), CcRosCreateVacb(), CcRosDeleteFileCache(), CcRosFreeUnusedVacb(), CcRosInitializeFileCache(), CcRosLookupVacb(), CcRosMarkDirtyVacb(), CcRosReleaseFileCache(), CcRosTraceCacheMap(), CcRosTrimCache(), CcRosUnmarkDirtyVacb(), ClasspReleaseQueue(), EthFilterDprIndicateReceiveComplete(), ExpTimerApcKernelRoutine(), ExTimerRundown(), CPortPinWaveCyclic::GeneratePositionEvents(), InterfacePciDevicePresent(), InterfacePciDevicePresentEx(), IServiceGroupDpc(), KeIpiGenericCall(), KeReleaseInterruptSpinLock(), KeStartProfile(), KeStopProfile(), KeSynchronizeExecution(), KiRetireDpcList(), KsMoveIrpsOnCancelableQueue(), KsRemoveIrpFromCancelableQueue(), MiniDoRequest(), MiniportWorker(), MiniRequestComplete(), MiniReset(), MiniTimerDpcFunction(), NdisAcquireReadWriteLock(), NdisDprAllocatePacket(), NdisDprFreePacket(), NdisDprReleaseSpinLock(), NtCancelTimer(), NtSetTimer(), ProtocolReceive(), RxTimerDispatch(), ScsiPortDpcForIsr(), ScsiPortIoTimer(), ScsiPortStartIo(), SpiAllocateSrbStructures(), SpiGetNextRequestFromLun(), SpiMiniportTimerDpc(), SpiProcessCompletedRequest(), TcpipReleaseSpinLockFromDpcLevel(), USBPORT_CancelActiveTransferIrp(), USBPORT_CancelPendingTransferIrp(), USBPORT_ClosePipe(), USBPORT_DpcHandler(), USBPORT_EndpointWorker(), USBPORT_FlushCancelList(), USBPORT_FlushPendingTransfers(), USBPORT_GetEndpointState(), USBPORT_IsrDpc(), USBPORT_IsrDpcHandler(), USBPORT_ReopenPipe(), USBPORT_ResetPipe(), USBPORT_RestoreDevice(), USBPORT_WorkerThreadHandler(), USBSTOR_Cancel(), USBSTOR_TimerRoutine(), and VideoPortReleaseSpinLockFromDpcLevel().

◆ KeTestSpinLock()

BOOLEAN FASTCALL KeTestSpinLock ( IN PKSPIN_LOCK  SpinLock)

Definition at line 442 of file spinlock.c.

443 {
444  /* Test this spinlock */
445  if (*SpinLock)
446  {
447  /* Spinlock is busy, yield execution */
448  YieldProcessor();
449 
450  /* Return busy flag */
451  return FALSE;
452  }
453 
454  /* Spinlock appears to be free */
455  return TRUE;
456 }
#define TRUE
Definition: types.h:120
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
FORCEINLINE VOID YieldProcessor(VOID)
Definition: ke.h:32

Referenced by InbvAcquireLock(), KdpPrintToLogFile(), KdpPrompt(), KdpScreenPrint(), and KdpSerialDebugPrint().

◆ KeTryToAcquireSpinLockAtDpcLevel()

BOOLEAN FASTCALL KeTryToAcquireSpinLockAtDpcLevel ( IN OUT PKSPIN_LOCK  SpinLock)

Definition at line 303 of file spinlock.c.

304 {
305 #ifdef CONFIG_SMP
306  /* Check if it's already acquired */
307  if (!(*SpinLock))
308  {
309  /* Try to acquire it */
311  {
312  /* Someone else acquired it */
313  return FALSE;
314  }
315  }
316  else
317  {
318  /* It was already acquired */
319  return FALSE;
320  }
321 
322 #if DBG
323  /* On debug builds, we OR in the KTHREAD */
325 #endif
326 #endif
327 
328  /* All is well, return TRUE */
329  return TRUE;
330 }
#define TRUE
Definition: types.h:120
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
#define InterlockedBitTestAndSet
Definition: interlocked.h:30
#define ULONG_PTR
Definition: config.h:101
#define KeGetCurrentThread
Definition: hal.h:44
signed int * PLONG
Definition: retypes.h:5

Referenced by KdEnterDebugger(), KdPollBreakIn(), KdpPrintToLogFile(), KdpPrompt(), KdpScreenPrint(), and KdpSerialDebugPrint().

◆ KiAcquireSpinLock()

VOID FASTCALL KiAcquireSpinLock ( IN PKSPIN_LOCK  SpinLock)

Definition at line 281 of file spinlock.c.

282 {
283  /* Do the inlined function */
285 }
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
FORCEINLINE VOID KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:20

◆ KiReleaseSpinLock()

VOID FASTCALL KiReleaseSpinLock ( IN PKSPIN_LOCK  SpinLock)

Definition at line 292 of file spinlock.c.

293 {
294  /* Do the inlined function */
296 }
FORCEINLINE VOID KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:35
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798