QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Calculating a Process's Physical Memory location in QNX4 |
Ref. No. |
QNX.000009543 |
Category(ies) |
Development |
Issue |
Do you have any sample code that illustrates how to get the location of a process in physical memory?
|
Solution |
#include <sys/types.h> #include <sys/seginfo.h> #include <sys/inline.h> #include <i86.h>
int vtop(caddr_t v, paddr_t *p) { unsigned long l= (unsigned long)v; int sel; struct _seginfo d; if (qnx_segment_info(0, 0, _ds(), &d) != _ds() || (sel = qnx_segment_overlay(d.addr+(v&~(PAGESIZE-1)), PAGESIZE, _PMF_VOVERLAY)) == -1 || qnx_segment_info(0, 0,sel, &d) != sel) { return -1; } *p = d.addr+(v&(PAGESIZE-1)); return 0; } |
|