![]() |
![]() |
![]() |
![]() |
This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
After the system has booted, the standard kernel includes a block of physical memory for the kernels' memory allocator. Now, the memory addition feature lets you add more physical memory to the system after it's started.
Use the _MEM_PMEM_ADD type and mem_pmem_add_t message structure to send a message to procnto to use the specified RAM for general allocation purposes.
For example, the following sample shows a partial illustartion of the memory addition feature:
int main(int argc, char *argv[]) { void *ptr; int fd, rc; uintptr_t rsvd_paddr; unsigned passed = 0; struct { mem_pmem_add_t pmem; } msg; iov_t useramram; msg.pmem.i.type = _MEM_PMEM_ADD; ... // attempt to reclaim the reserved memory rc = MsgSendnc(MEMMGR_COID, &msg, sizeof msg, NULL, 0); ...
Use the following startup options to reserve specific RAM from general use, and then pass in these same parameters into your _MEM_PMEM_ADD():
-r paddr, size, <0|1>
To verify the physical address that was added by using the function mem_offset64(), you can request that physically contiguous memory be allocated by using either the MAP_PHYS, MAP_ANON, or MAP_PRIVATE flag; however, we recommend that you use the MAP_PHY flag.
![]() |
![]() |
![]() |