MmAllocateMappingAddressEx - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdm.h

PVOID MmAllocateMappingAddressEx(
  [in] SIZE_T NumberOfBytes,
  [in] ULONG  PoolTag,
  [in] ULONG  Flags
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdm-mmallocatemappingaddressex)

MmAllocateMappingAddressEx function

Description

The MmAllocateMappingAddressEx function allocates a system PTE mapping of the requested length that can be used later to map arbitrary addresses.

Parameters

NumberOfBytes [in]

Supplies the maximum number of bytes the mapping can span.

PoolTag [in]

Specifies a four-character tag used to identify the buffer. Use a distinct PoolTag tag for each allocation code path. For a description of pool tags, see ExAllocatePoolWithTag.

Flags [in]

Specifies flags for this operation. Set this parameter to zero or to the bitwise-OR of one or more of the following flag bits:

Flag Meaning
MM_MAPPING_ADDRESS_DIVISIBLE Indicates that the mapping address must be divisible by the size of the mapping. This flag is useful for ensuring that the mapping address aligns with certain hardware requirements.

Return value

MmAllocateMappingAddressEx returns a pointer to the beginning of the reserved memory buffer if the operation is successful; otherwise, it returns NULL.

Remarks

MmAllocateMappingAddressEx provides an extended version of MmAllocateMappingAddress with additional flag support. This function reserves a range of system virtual address space that can be used for later mapping operations with MmMapLockedPagesWithReservedMapping.

No physical memory is allocated by this function; it only reserves virtual address space. The reserved memory can't be accessed until it is mapped using MmMapLockedPagesWithReservedMapping.

Callers must provide a non-zero PoolTag to identify the allocation.

The reserved address range should be freed using MmFreeMappingAddress when no longer needed.

Very large allocations (>= 4GB pages) will fail. The function might fail if insufficient system PTEs are available

See also

MmAllocateMappingAddress

MmFreeMappingAddress

MmMapLockedPagesWithReservedMapping

MmUnmapReservedMapping