Home |
RTTarget-32 Programming Manual Function RTReserveVirtualAddress Function RTReleaseVirtualAddress Function RTAllocPhysPageAligned Function RTGetProcessPhysMemHeap System Management BIOS (SMBIOS) Advanced Programmable Interrupt Controller (APIC) |
Function RTGetProcessPhysMemHeapApplications which need to dynamically allocate memory guaranteed to have virtual addresses equal to physical addresses can use the Win32 heap API (HeapAlloc, HeapFree, etc) with a special heap handle returned by function: HANDLE RTGetProcessPhysMemHeap(void); This Physical Memory Heap is subject to more fragmentation than the standard heap accessible through GetProcessHeap(). RTGetProcessPhysMemHeap() will return NULL (no Physical Memory Heap available) if paging is enabled, but the fixed memory manager (RT_MM_FIXED) is being used. Example:#include <windows.h> #include <rttarget.h> void * PhysMalloc(UINT Bytes) { return HeapAlloc(RTGetProcessPhysMemHeap(), 0, Bytes); } void PhysFree(void * B) { HeapFree(RTGetProcessPhysMemHeap(), 0, B); } Memory blocks allocated from the Physical Memory Heap are guaranteed to be at least 16 byte aligned. The alignment can be increased with RTTarget-32 flags RT_HEAP_MIN_BLOCK_SIZE_32, RT_HEAP_MIN_BLOCK_SIZE_64, or RT_HEAP_MIN_BLOCK_SIZE_128. Function RTAllocPhysPageAligned
|