Spin Locks

The spin lock is the kernel’s simplest synchronisation object, but the main functions for working with spin locks started as HAL exports. This is because acquiring a spin lock in ordinary execution starts with raising the Interrupt Request Level (IRQL) to DISPATCH_LEVEL and changing the IRQL is the HAL’s work in x86 builds. Functions that work with spin locks but take as granted that the IRQL is already DISPATCH_LEVEL or higher have always been the kernel’s to export. For 64-bit Windows, this division between the HAL and the kernel was put aside: presumably because the IRQL is managed inline by reading and writing the cr8 register, all work with spin locks is the kernel’s.

Function Versions (x86 Only) Remarks
KeAcquireSpinLock all export in 3.50 to 6.1 is a thunk to KfAcquireSpinLock;
export in 6.2 and higher is forward to kernel
KeAcquireSpinLockRaiseToSynch 4.0 and higher export in 6.2 and higher is forward to kernel
KeReleaseSpinLock all export in 3.50 to 6.1 is a thunk to KfReleaseSpinLock;
export in 6.2 and higher is forward to kernel
KfAcquireSpinLock 3.50 and higher export in 6.2 and higher is forward to kernel
KfReleaseSpinLock 3.50 and higher export in 6.2 and higher is forward to kernel

The separation of functionality for x86 builds was kept when version 5.0 introduced queued spin locks:

Function Versions (x86 Only) Remarks
KeAcquireInStackQueuedSpinLock 5.1 and higher export in 6.2 and higher is forward to kernel
KeAcquireInStackQueuedSpinLockRaiseToSynch 5.1 and higher export in 6.2 and higher is forward to kernel
KeAcquireQueuedSpinLock 5.0 and higher export in 6.2 and higher is forward to kernel
KeAcquireQueuedSpinLockRaiseToSynch 5.0 and higher export in 6.2 and higher is forward to kernel
KeReleaseInStackQueuedSpinLock 5.1 and higher export in 6.2 and higher is forward to kernel
KeReleaseQueuedSpinLock 5.0 and higher export in 6.2 and higher is forward to kernel
KeTryToAcquireQueuedSpinLock 5.0 and higher export in 6.2 and higher is forward to kernel
KeTryToAcquireQueuedSpinLockRaiseToSynch 5.0 and higher export in 6.2 and higher is forward to kernel