PVOID
ExInterlockedFreeToZone(
IN PZONE_HEADER Zone,
IN PVOID Block,
IN PKSPIN_LOCK Lock
);
ExInterlockedFreeToZone places the given zone entry in the free block list for the zone.
ExInterlockedFreeToZone returns a pointer to the previous block of storage that was at the head of the free list. NULL implies that the zone went from no available free blocks to at least one free block.
Support routines that do interlocked operations are assumed to be incapable of causing a page fault. That is, neither their code nor any of the data they touch can cause a page fault without bringing down the system. They use spin locks to achieve atomicity in SMP machines. The caller must provide resident storage for the Lock, which must be initialized with KeInitializeSpinLock before the initial call to an ExInterlockedXxx.
ExInterlockedFreeToZone updates the free block list while holding the given the spin lock so the list links are updated in a multiprocessor-safe way.
Any of the Ex..Interlocked routines can be called at DIRQL from a device driver’s ISR or SynchCritSection routines, provided that other driver routines do not make calls to the ExInterlockedXxx while running at < DIRQL with the same spin lock. Otherwise, callers of ExInterlockedFreeToZone must be running at IRQL <= DISPATCH_LEVEL.
ExInitializeZone, ExInterlockedAllocateFromZone, KeInitializeSpinLock