PVOID
MmAllocateContiguousMemory(
IN ULONG NumberOfBytes,
IN PHYSICAL_ADDRESS HighestAcceptableAddress
);
MmAllocateContiguousMemory allocates a range of physically contiguous, cache-aligned memory from nonpaged pool.
MmAllocateContiguousMemory returns the base virtual address for the allocated memory. If the request cannot be satisfied, NULL is returned.
MmAllocateContiguousMemory can be called to allocate a contiguous block of physical memory for a long-term internal buffer, usually from the DriverEntry routine.
A device driver that must use contiguous memory should allocate only what it needs during driver initialization because nonpaged pool is likely to become fragmented as the system runs. Such a driver must deallocate the memory if it is unloaded. Contiguous allocations are aligned on an integral multiple of the processor’s data-cache-line size to prevent cache and coherency problems.
Callers of MmAllocateContiguousMemory must be running at IRQL = PASSIVE_LEVEL.
HalAllocateCommonBuffer, KeGetDcacheFillSize, MmAllocateNonCachedMemory, MmFreeContiguousMemory