Lets say I have a global variable defined in my program. I want to know its physical address (not virtual address). Is there a way to find it in Linux in user space? I know that the physical address might change during execution, but I am OK with just knowing the current physical address.
Asked
Active
Viewed 483 times
-2
-
1That ^^ is the first Google hit, literally. – Aug 29 '13 at 18:00
-
Why do you ask? From the application point of view, the physical RAM address does not matter at all (since the application don't see it). – Basile Starynkevitch Aug 29 '13 at 19:29
1 Answers
0
virt_to_phys
is available but can only be used in kernel
space and not in user space, specifically when is allocated with kmalloc
and only when it is in page tables.
http://mirror.linux.org.au/linux-mandocs/2.6.12.4/virt_to_phys.html

sr01853
- 6,043
- 1
- 19
- 39
-
I believe there's a way to do it with the information in `/proc`... – R.. GitHub STOP HELPING ICE Aug 29 '13 at 18:09