MDL (memory descriptor list) is usually used to describe the location of the physical memory corresponding to VA. Generally, the content that can be accessed by the driver includes next and mdlflags.
Wdk defines several common macros to access some variables in MDL, including:
MmgetmdlvirtualaddressReturns the virtual memory address of the buffer.
// Virtual Memory Address
MmgetmdlbytecountReturns the size, in bytes, of the buffer.
// Virtual Memory Length
MmgetmdlbyteoffsetReturns the offset within a physical page of the beginning of the buffer.
// Offset of the first address in the physical memory relative to the start address of the page
MmgetmdlpfnarrayReturns a pointer to an array of physical page numbers. The size of this array can be computed from the buffer starting address and length by using address_and_size_to_span_pages.
// Page list of physical memory
We usually create an MDL through ioallocatemdl and release it through iofreemdl.
In addition, you can also use the memory created by exallocatepool to format it into an MDL using mminitializemdl. In this case, memory must be nonpageable. Of course, the release still needs to be implemented through exfreepool.