2

For some investigation, I need to find out the physical address of a pointer on FreeBSD 12. On Linux, I would do that with /proc/self/pagemap but on FreeBSD, I have not found a way to do it.

So, is there a way to get the physical address of any virtual address from user-space in FreeBSD?

Baptiste Wicht
  • 7,472
  • 7
  • 45
  • 110
  • Why do you need the physical address? What are you going to do with it? Any code other than the memory management code in the kernel is going to use virtual addresses. – Jonathan Leffler Sep 21 '20 at 06:24
  • We are debugging some NUMA locality issues and trying to validate that the addresses are allocated on the proper CPU. – Baptiste Wicht Sep 21 '20 at 06:29

1 Answers1

0

For FreeBSD, See macro vtop

find(1) and xargs(1) are your friends:

find /usr/include /usr/src/sys -type f -name '*.h' -print0 \
| xargs -0 egrep -i vtop | less

I think this is a good starting point ;)

alireza
  • 58
  • 5
  • Unfortunately, vtop is a kernel macro, so I won't be able to use it from userspace. I could use it from a kernel module, but that's something I want to avoid. – Baptiste Wicht Oct 07 '20 at 12:22