KeFlushIoBuffers function

The KeFlushIoBuffers routine flushes the memory region described by an MDL from caches of all processors.


VOID KeFlushIoBuffers(
  _In_ PMDL    Mdl,
  _In_ BOOLEAN ReadOperation,
  _In_ BOOLEAN DmaOperation



A pointer to an MDL that describes the range for the I/O buffer.


Specifies TRUE if the flush is being performed for a read operation, and FALSE for a write operation. For more information, see the following Remarks section.


Specifies TRUE for a DMA transfer, FALSE for PIO.

Return Value



Drivers call KeFlushIoBuffers to maintain data integrity during DMA or PIO device transfer operations. Calling this routine affects all processors in the machine.

If ReadOperation is TRUE, the driver is reading information from the device to system memory, so valid data still might be in the processor instruction and data caches. KeFlushIoBuffers flushes data from all processors' caches to system memory, including the processor on which the caller is running.

If ReadOperation is FALSE, the driver is writing data from system memory to a device, so valid data might be in the processor's data cache but not yet transferred to the device. KeFlushIoBuffers flushes all processors' data caches, including that of the processor on which the caller is running.

As a general rule, drivers should call KeFlushIoBuffers just before beginning a DMA transfer operation or immediately following any PIO read operation.

KeFlushIoBuffers flushes only the memory region that is described by the MDL that the Mdl parameter points to. To flush all the memory regions that are described by an MDL chain requires a separate KeFlushIoBuffers call for each MDL in the chain.

For more information, see the following topics:

Flushing Cached Data during DMA Operations Flushing Cached Data during PIO Operations


Windows version Available starting with Windows 2000.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
DDI compliance rules MdlAfterReqCompletedIntIoctlA, MdlAfterReqCompletedIoctlA, MdlAfterReqCompletedReadA, MdlAfterReqCompletedWriteA

See Also


Send comments about this topic to Microsoft