Platform SDK: Memory |
The MapUserPhysicalPagesScatter function maps previously allocated physical memory pages at the specified address within an Address Windowing Extensions (AWE) region.
Unlike MapUserPhysicalPages, MapUserPhysicalPagesScatter allows "batch" mapping and unmapping of multiple regions.
BOOL MapUserPhysicalPagesScatter( PVOID *VirtualAddresses, // starting address of region ULONG_PTR NumberOfPages, // size of physical memory PULONG_PTR PageArray // array of values );
If this parameter is NULL, then every address in the VirtualAddresses array will be unmapped.
Otherwise, the array is used to indicate how each corresponding page in VirtualAddresses should be treated. A zero indicates that the corresponding entry in VirtualAddresses should be unmapped; any nonzero value that it has should be mapped.
The value in NumberOfPages indicates the size of the array.
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE and the function does no mapping or unmapping (partial or otherwise). To get extended error information, call GetLastError.
You can specify any number of physical memory pages, provided the memory would not extend outside the virtual address space allocated by VirtualAlloc. Any existing address maps are automatically overwritten with the new translations, and the old translations are unmapped.
You cannot map physical memory pages outside the range specified in AllocateUserPhysicalPages.
Note The physical pages may be unmapped but they are not freed. You must call FreeUserPhysicalPages to free the physical pages.
Physical pages can reside at any physical address. You should make no assumptions about the contiguity of the physical pages.
In a multiprocessor environment, this function maintains coherence of the hardware translation buffer. Upon return from this function, all threads on all processors are guaranteed to see the correct mapping.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Unsupported.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
Memory Management Overview, Memory Management Functions, Address Windowing Extensions, AllocateUserPhysicalPages, FreeUserPhysicalPages, MapUserPhysicalPages