ULONG
ADDRESS_AND_SIZE_TO_SPAN_PAGES(
IN PVOID Va,
IN ULONG Size
);
ADDRESS_AND_SIZE_TO_SPAN_PAGES takes a virtual address and size in bytes of a transfer request and returns the number of pages spanned by the virtual range.
ADDRESS_AND_SIZE_TO_SPAN_PAGES returns the number of pages for the virtual range starting at Va.
ADDRESS_AND_SIZE_TO_SPAN_PAGES is called by drivers that make DMA transfers to determine whether a given transfer request must be split up into a sequence of device DMA operations.
The system-defined constant PAGE_SIZE can be used to determine whether a given length in bytes for a transfer is less than the page size of the current platform.
Callers of ADDRESS_AND_SIZE_TO_SPAN_PAGES can be running at any IRQL, and usually run at IRQL DISPATCH_LEVEL.