Use of MDL (1) ioallocatemdl/mminitializemdl

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.