ReactOS  0.4.13-dev-650-g34bf247
spinlock.c File Reference
#include <hal.h>
#include <debug.h>
Include dependency graph for spinlock.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

KIRQL FASTCALL KfRaiseIrql (KIRQL NewIrql)
 
VOID FASTCALL KfLowerIrql (KIRQL NewIrql)
 
VOID NTAPI KeLowerIrql (KIRQL NewIrql)
 
NTKERNELAPI KIRQL NTAPI KeRaiseIrql (KIRQL NewIrql, PKIRQL OldIrql)
 
VOID NTAPI KeAcquireSpinLock (PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
 
KIRQL FASTCALL KeAcquireSpinLockRaiseToSynch (PKSPIN_LOCK SpinLock)
 
VOID NTAPI KeReleaseSpinLock (PKSPIN_LOCK SpinLock, KIRQL NewIrql)
 
KIRQL FASTCALL KfAcquireSpinLock (PKSPIN_LOCK SpinLock)
 
VOID FASTCALL KfReleaseSpinLock (PKSPIN_LOCK SpinLock, KIRQL OldIrql)
 
KIRQL FASTCALL KeAcquireQueuedSpinLock (IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
 
KIRQL FASTCALL KeAcquireQueuedSpinLockRaiseToSynch (IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
 
VOID FASTCALL KeAcquireInStackQueuedSpinLock (IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle)
 
VOID FASTCALL KeAcquireInStackQueuedSpinLockRaiseToSynch (IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle)
 
VOID FASTCALL KeReleaseQueuedSpinLock (IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN KIRQL OldIrql)
 
VOID FASTCALL KeReleaseInStackQueuedSpinLock (IN PKLOCK_QUEUE_HANDLE LockHandle)
 
BOOLEAN FASTCALL KeTryToAcquireQueuedSpinLockRaiseToSynch (IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN PKIRQL OldIrql)
 
LOGICAL FASTCALL KeTryToAcquireQueuedSpinLock (IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, OUT PKIRQL OldIrql)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file spinlock.c.

Function Documentation

◆ KeAcquireInStackQueuedSpinLock()

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

Definition at line 138 of file spinlock.c.

140 {
141  /* Simply raise to dispatch */
143 }
KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
Definition: irql.c:243
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742

◆ KeAcquireInStackQueuedSpinLockRaiseToSynch()

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

Definition at line 150 of file spinlock.c.

152 {
153  /* Simply raise to synch */
155 }
KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
Definition: irql.c:243
#define SYNCH_LEVEL
Definition: env_spec_w32.h:704
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742

◆ KeAcquireQueuedSpinLock()

KIRQL FASTCALL KeAcquireQueuedSpinLock ( IN KSPIN_LOCK_QUEUE_NUMBER  LockNumber)

Definition at line 116 of file spinlock.c.

117 {
118  /* Simply raise to dispatch */
119  return KfRaiseIrql(DISPATCH_LEVEL);
120 }
KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
Definition: irql.c:243
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696

◆ KeAcquireQueuedSpinLockRaiseToSynch()

KIRQL FASTCALL KeAcquireQueuedSpinLockRaiseToSynch ( IN KSPIN_LOCK_QUEUE_NUMBER  LockNumber)

Definition at line 127 of file spinlock.c.

128 {
129  /* Simply raise to dispatch */
130  return KfRaiseIrql(DISPATCH_LEVEL);
131 }
KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
Definition: irql.c:243
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696

◆ KeAcquireSpinLock()

VOID NTAPI KeAcquireSpinLock ( PKSPIN_LOCK  SpinLock,
PKIRQL  OldIrql 
)

Definition at line 58 of file spinlock.c.

60 {
61  /* Call the fastcall function */
63 }
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
KIRQL FASTCALL KfAcquireSpinLock(PKSPIN_LOCK SpinLock)
Definition: spinlock.c:85

◆ KeAcquireSpinLockRaiseToSynch()

KIRQL FASTCALL KeAcquireSpinLockRaiseToSynch ( PKSPIN_LOCK  SpinLock)

Definition at line 70 of file spinlock.c.

71 {
72  /* Simply raise to dispatch */
74 }
KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
Definition: irql.c:243
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696

◆ KeLowerIrql()

VOID NTAPI KeLowerIrql ( KIRQL  NewIrql)

Definition at line 34 of file spinlock.c.

35 {
36  /* Call the fastcall function */
38 }
VOID FASTCALL KfLowerIrql(KIRQL NewIrql)
Definition: irql.c:210
_Requires_lock_held_ SpinLock _Releases_lock_ SpinLock _In_ _IRQL_restores_ KIRQL NewIrql
Definition: ke.h:114

◆ KeRaiseIrql()

NTKERNELAPI KIRQL NTAPI KeRaiseIrql ( KIRQL  NewIrql,
PKIRQL  OldIrql 
)

Definition at line 46 of file spinlock.c.

48 {
49  /* Call the fastcall function */
50  return *OldIrql = KfRaiseIrql(NewIrql);
51 }
KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
Definition: irql.c:243
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
_Requires_lock_held_ SpinLock _Releases_lock_ SpinLock _In_ _IRQL_restores_ KIRQL NewIrql
Definition: ke.h:114

◆ KeReleaseInStackQueuedSpinLock()

VOID FASTCALL KeReleaseInStackQueuedSpinLock ( IN PKLOCK_QUEUE_HANDLE  LockHandle)

Definition at line 174 of file spinlock.c.

175 {
176  /* Simply lower IRQL back */
178 }
VOID FASTCALL KfLowerIrql(KIRQL NewIrql)
Definition: irql.c:210
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742

◆ KeReleaseQueuedSpinLock()

VOID FASTCALL KeReleaseQueuedSpinLock ( IN KSPIN_LOCK_QUEUE_NUMBER  LockNumber,
IN KIRQL  OldIrql 
)

Definition at line 162 of file spinlock.c.

164 {
165  /* Simply lower IRQL back */
167 }
VOID FASTCALL KfLowerIrql(KIRQL NewIrql)
Definition: irql.c:210
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803

◆ KeReleaseSpinLock()

VOID NTAPI KeReleaseSpinLock ( PKSPIN_LOCK  SpinLock,
KIRQL  NewIrql 
)

Definition at line 81 of file spinlock.c.

83 {
84  /* Call the fastcall function */
86 }
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
VOID FASTCALL KfReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL OldIrql)
Definition: spinlock.c:96
_Requires_lock_held_ SpinLock _Releases_lock_ SpinLock _In_ _IRQL_restores_ KIRQL NewIrql
Definition: ke.h:114

◆ KeTryToAcquireQueuedSpinLock()

LOGICAL FASTCALL KeTryToAcquireQueuedSpinLock ( IN KSPIN_LOCK_QUEUE_NUMBER  LockNumber,
OUT PKIRQL  OldIrql 
)

Definition at line 200 of file spinlock.c.

202 {
203  /* Simply raise to dispatch */
205 
206  /* Always return true on UP Machines */
207  return TRUE;
208 }
#define TRUE
Definition: types.h:120
KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
Definition: irql.c:243
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696

◆ KeTryToAcquireQueuedSpinLockRaiseToSynch()

BOOLEAN FASTCALL KeTryToAcquireQueuedSpinLockRaiseToSynch ( IN KSPIN_LOCK_QUEUE_NUMBER  LockNumber,
IN PKIRQL  OldIrql 
)

Definition at line 185 of file spinlock.c.

187 {
188  /* Simply raise to dispatch */
190 
191  /* Always return true on UP Machines */
192  return TRUE;
193 }
#define TRUE
Definition: types.h:120
KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
Definition: irql.c:243
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696

◆ KfAcquireSpinLock()

KIRQL FASTCALL KfAcquireSpinLock ( PKSPIN_LOCK  SpinLock)

Definition at line 93 of file spinlock.c.

94 {
95  /* Simply raise to dispatch */
97 }
KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
Definition: irql.c:243
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696

◆ KfLowerIrql()

VOID FASTCALL KfLowerIrql ( KIRQL  NewIrql)

Definition at line 210 of file irql.c.

211 {
212  DPRINT("KfLowerIrql(NewIrql %d)\n", NewIrql);
213 
214  if (NewIrql > KeGetPcr()->Irql)
215  {
216  DbgPrint ("(%s:%d) NewIrql %x CurrentIrql %x\n",
217  __FILE__, __LINE__, NewIrql, KeGetPcr()->Irql);
218  KeBugCheck(IRQL_NOT_LESS_OR_EQUAL);
219  for(;;);
220  }
221 
223 }
#define DbgPrint
Definition: loader.c:25
_Out_ PKIRQL Irql
Definition: csq.h:179
#define KeGetPcr()
Definition: ke.h:25
VOID HalpLowerIrql(KIRQL NewIrql)
Definition: irql.c:161
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1507
_Requires_lock_held_ SpinLock _Releases_lock_ SpinLock _In_ _IRQL_restores_ KIRQL NewIrql
Definition: ke.h:114

Referenced by KeLowerIrql(), KeReleaseInStackQueuedSpinLock(), KeReleaseQueuedSpinLock(), and KfReleaseSpinLock().

◆ KfRaiseIrql()

KIRQL FASTCALL KfRaiseIrql ( KIRQL  NewIrql)

Definition at line 243 of file irql.c.

244 {
245  KIRQL OldIrql;
246 
247  DPRINT("KfRaiseIrql(NewIrql %d)\n", NewIrql);
248 
249  if (NewIrql < KeGetPcr()->Irql)
250  {
251  DbgPrint ("%s:%d CurrentIrql %x NewIrql %x\n",
252  __FILE__,__LINE__,KeGetPcr()->Irql,NewIrql);
253  KeBugCheck (IRQL_NOT_GREATER_OR_EQUAL);
254  for(;;);
255  }
256 
257  OldIrql = KeGetPcr()->Irql;
258  KeGetPcr()->Irql = NewIrql;
259  return OldIrql;
260 }
#define DbgPrint
Definition: loader.c:25
_Out_ PKIRQL Irql
Definition: csq.h:179
#define KeGetPcr()
Definition: ke.h:25
UCHAR KIRQL
Definition: env_spec_w32.h:591
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1507
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
_Requires_lock_held_ SpinLock _Releases_lock_ SpinLock _In_ _IRQL_restores_ KIRQL NewIrql
Definition: ke.h:114

Referenced by KeAcquireInStackQueuedSpinLock(), KeAcquireInStackQueuedSpinLockRaiseToSynch(), KeAcquireQueuedSpinLock(), KeAcquireQueuedSpinLockRaiseToSynch(), KeAcquireSpinLockRaiseToSynch(), KeRaiseIrql(), KeRaiseIrqlToDpcLevel(), KeRaiseIrqlToSynchLevel(), KeTryToAcquireQueuedSpinLock(), KeTryToAcquireQueuedSpinLockRaiseToSynch(), KfAcquireSpinLock(), and KxRaiseIrql().

◆ KfReleaseSpinLock()

VOID FASTCALL KfReleaseSpinLock ( PKSPIN_LOCK  SpinLock,
KIRQL  OldIrql 
)

Definition at line 104 of file spinlock.c.

106 {
107  /* Simply lower IRQL back */
109 }
VOID FASTCALL KfLowerIrql(KIRQL NewIrql)
Definition: irql.c:210
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803