Platform SDK: Memory |
The MapUserPhysicalPages function maps previously allocated physical memory pages at the specified address within an Address Windowing Extensions (AWE) region.
To perform "batch" mapping and unmapping of multiple regions, use the MapUserPhysicalPagesScatter function.
BOOL MapUserPhysicalPages( PVOID lpAddress, // starting address of region ULONG_PTR NumberOfPages, // size of physical memory PULONG_PTR UserPfnArray // array of page frame numbers );
Do not attempt to modify this buffer. It contains operating system data, corruption of which could be catastrophic. There is no information in it that is useful to your application.
Specifying NULL for this parameter results in the specified address range being unmapped. (The specified physical pages are not freed. You must call FreeUserPhysicalPages to free them.)
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE and no mapping (partial or otherwise) will have been done. To get extended error information, call GetLastError.
Any number of physical memory pages can be specified, 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 are 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.
To simply unmap the current address range, specify NULL as the physical memory page array parameter. Any currently mapped pages are unmapped, but are not freed. You must call FreeUserPhysicalPages to free the physical pages.
In a multiprocessor environment, this function maintains hardware translation buffer coherence. 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, MapUserPhysicalPagesScatter