INtime SDK Help
INtime SDK v7.1 > About INtime > INtime Kernel > Memory management > RemapRtPhysicalMemory64

Remaps an existing mapping to a new physical memory area of the same size, with new attributes. The call may also be used to change the attributes on an existing memory allocation, without changing its physical address.

PVOID RemapRtPhysicalMemory64(
    PVOID pCurrent,             // existing mapping
    QWORD qwAbsoluteAddress,    // absolute physical address of memory to be mapped
    DWORD dwFlags               // properties of the mapped memory


A pointer previously returned from a call to MapRtPhysicalMemory, MapRtPhysicalMemoryEx or MapRtPhysicalMemory64, or from AllocateRtMemory or AllocateRtMemoryEx (see Remarks).
The absolute, 64-bit, physical address of the area to be mapped.
Specifies the properties of the mapped memory. By default, the properties of the mapped view of the memory are read/write, cache enabled, write-back caching policy. This parameter allows modifying some of the default properties. Possible flags include:
PTE_WRITE_THRU Enables write-through caching policy for the mapped memory.
PTE_CACHE_DISABLE Disables caching for the mapped memory.
PTE_PAT Allows setting the PAT bit to index the desired PAT entry to select caching policy for the mapped memory.
REMAP_KEEP_PA Keep physical address, but change the page attributes. Applies to mapped memory and allocated memory.
REMAP_KEEP_ATTRIB Keep page attributes, but remap physical address. Does not apply to allocated memory.
Note: The dwFlags values of REMAP_KEEP_PA and REMAP_KEEP_ATTRIB were introduced in INtime 6.3.18220.1 and are not available before that version.


RemapRtPhysicalMemory can be used to remap an existing pointer to a new physical memory address starting at dwAbsoluteAddress or to change the cache attributes. The pointer pCurrent must have previously been returned from a call to MapRtPhysicalMemory,  MapRtPhysicalMemoryEx or MapRtPhysicalMemory64. The pointer (in fact an offset in the process' VSEG) is not changed if the remapping is successful. This is functionally equivalent to a call to FreeRtMemory followed by a call to one of the MapRtPhysical calls, but is more efficient because it does not have to reallocate a virtual memory range.

RemapRtPhysicalMemory can also be used to change the attributes of memory allocated with AllocateRMemory, or AllocateRtMemoryEx, using the REMAP_KEEP_PA flag.

If the value of dwAbsoluteAddress is not 4Kbyte-aligned, then the kernel will make adjustments so that the address is so aligned.

Use FreeRtMemory to delete the mapping created by this call and to free the virtual memory associated with it.

Return Values

The address of the area mapped.
Failure. To determine the status, call GetLastRtError.


E_OK 0x0000
No exceptional conditions occurred.
E_MEM 0x0002
Creating page table(s) for this request requires more available physical memory than currently exists.
E_VMEM 0x00F0
Satisfying this request requires more virtual memory than is available to the process.
Parameter pCurrent refers to allocated memory and the REMAP_KEEP_PA flag was not specified.
pCurrent is not a valid pointer
E_PARAM 0x8004
Both the REMAP_KEEP_PA and the REMAP_KEEP_ATTRIB flags were specified.


Versions Defined in Include Link to
INtime 6.2 intime/rt/include/rtbase.h rt.h rt.lib
See Also