Geoff Chappell - Software Analyst
This function releases the spin lock that is associated with a hardware interrupt.
VOID KeReleaseInterruptSpinLock (KINTERRUPT *Interrupt, KIRQL OldIrql);
The Interrupt argument is the address of a structure that represents the interrupt.
The OldIrql argument is the Interrupt Request Level (IRQL) to execute at once the lock is released. This is typically the IRQL to restore from before the lock’s acquisition.
The function assumes it executes at the IRQL that is specified as the SynchronizeIrql for the interrupt.
The KeAcquireInterruptSpinLock function is exported by name from the kernel in version 5.1 and higher.
The KeAcquireInterruptSpinLock function is documented.
An interrupt spin lock is just a classic spin lock that has been associated with the handling of an interrupt. The KeReleaseInterruptSpinLock 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 release the lock at high IRQL. An equivalent exported function is KeReleaseSpinLockFromDpcLevel. 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. The second part is to restore the IRQL. An equivalent exported function for this first part is KeLowerIrql.
Historically, the function takes as granted that it executes at least at 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.