Export (0) Print
Expand All
Expand Minimize

MmAllocateNonCachedMemory routine

The MmAllocateNonCachedMemory routine allocates a virtual address range of noncached and cache-aligned memory.

Syntax


PVOID MmAllocateNonCachedMemory(
  _In_  SIZE_T NumberOfBytes
);

Parameters

NumberOfBytes [in]

Specifies the size in bytes of the range to be allocated.

Return value

If the requested memory cannot be allocated, the return value is NULL. Otherwise, it is the base virtual address of the allocated range.

Remarks

MmAllocateNonCachedMemory can be called from a DriverEntry routine to allocate a noncached block of virtual memory for various device-specific buffers. The function always returns a full multiple of the virtual memory page size, of nonpaged system-address-space memory, regardless of the requested allocation size.

Noncached allocations are aligned on an integral multiple of the processor's data-cache-line size to prevent cache and coherency problems.

The physical memory pages that MmAllocateNonCachedMemory returns are typically not contiguous pages.

Note  Memory that MmAllocateNonCachedMemory allocates is uninitialized. A kernel-mode driver must first zero this memory if it is going to make it visible to user-mode software (to avoid leaking potentially privileged contents).

Requirements

Target platform

Universal

Version

Available starting with Windows 2000.

Header

Ntddk.h (include Ntddk.h)

Library

Ntoskrnl.lib

IRQL

<=APC_LEVEL

DDI compliance rules

IrqlMmApcLte, HwStorPortProhibitedDDIs, SpNoWait, StorPortStartIo

See also

AllocateCommonBuffer
KeGetDcacheFillSize
MmAllocateContiguousMemory
MmAllocateContiguousMemorySpecifyCache
MmFreeNonCachedMemory

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft