The MmBuildMdlForNonPagedPool routine receives an MDL that specifies a nonpaged virtual memory buffer, and updates it to describe the underlying physical pages.
NTKERNELAPI VOID MmBuildMdlForNonPagedPool( PMDL MemoryDescriptorList );
A pointer to an MDL that specifies a virtual memory buffer in nonpaged memory. The caller used the IoAllocateMdl routine to create the MDL for this buffer.
At entry, the specified MDL must describe a buffer in nonpaged system memory, such as memory that is allocated by the ExAllocatePoolWithTag routine with PoolType = NonPagedPool or by the MmAllocateContiguousMemorySpecifyCache routine. MmBuildMdlForNonPagedPool updates the MDL to describe the underlying physical pages.
MmBuildMdlForNonPagedPool may not be used with MDLs describing buffers allocated on a kernel stack. To build an MDL describing a kernel stack buffer, drivers must call MmProbeAndLockPages. This rule applies even if the driver guarantees that the kernel stack cannot be paged out.
Because the pages described by the MDL are already nonpageable and are already mapped to the system address space, drivers must not try to lock them by using the MmProbeAndLockPages routine, or to create additional system-address-space mappings by using the MmMapLockedPagesSpecifyCache routine. Similarly, drivers must not try to unlock the pages by using the MmUnlockPages routine, or to release the existing system-address-space mapping by using the MmUnmapLockedPages routine. If a driver performs any of these illegal operations on an MDL that is built by MmBuildMdlForNonPagedPool, the resulting behavior is undefined.
Passing an MDL built by MmBuildMdlForNonPagedPool to the MmGetSystemAddressForMdlSafe routine is allowed. The MmGetSystemAddressForMdlSafe call, in this case, simply returns the starting virtual address of the buffer that is described by the MDL.
A driver can use the MmMapLockedPagesSpecifyCache routine to map an MDL that is built by MmBuildMdlForNonPagedPool into user virtual address space. However, the driver must perform this operation in a way that avoids certain security issues. For more information, see MmMapLockedPagesSpecifyCache.
|Windows version||Available starting with Windows 2000.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|