KeAcquireInterruptSpinLock

This function acquires the spin lock that is associated with a hardware interrupt.

Declaration

KIRQL KeAcquireInterruptSpinLock (KINTERRUPT *Interrupt);

Parameters

The Interrupt argument is the address of a structure that represents the interrupt.

Return Value

The function returns the Interrupt Request Level (IRQL) that is to be restored when the lock is released.

Constraints

The function raises the IRQL to the SynchronizeIrql that is specified for the interrupt. The IRQL on entry must be no higher.

Availability

The KeAcquireInterruptSpinLock function is exported by name from the kernel in version 5.1 and higher.

Documentation Status

The KeAcquireInterruptSpinLock function is documented.

Behaviour

An interrupt spin lock is just a classic spin lock that has been associated with the handling of an interrupt. The KeAcquireInterruptSpinLock function is a convenience. Its work is in two parts which can be done independently by calling other exported functions if the caller knows how the interrupt has been prepared.

The first part is to raise the IRQL to the SynchronizeIrql for the interrupt. This will have been provided when registering to handle the interrupt, e.g., as the SynchronizeIrql argument to the IoConnectInterrupt function. An equivalent exported function for this first part is KeRaiseIrql. The second part is to acquire the lock. An equivalent exported function is KeAcquireSpinLockAtDpcLevel. The lock is built into the KINTERRUPT by default but can have been supplied externally when registering to handle the interrupt, e.g., as the SpinLock argument to the IoConnectInterrupt routine.

Historically, the function takes as granted that the SynchronizeIrql is at least DISPATCH_LEVEL, as it will be if the interrupt handling is correctly configured. In version 6.2 and higher, new functionality for interrupt handling allows that the SynchronizeIrql in a KINTERRUPT can correctly be PASSIVE_LEVEL. If it is, then this function stops Windows with the bugcheck PASSIVE_INTERRUPT_ERROR.