问题
I'm using pin instrumentation tool to get memory traces. By my implementation result, I've found the traces indicate virtual address, not physical address. Is there any way to get physical address trace in Pin tool? Help!
回答1:
The pin tool runs in user space and therefore it works with virtual addresses only. There is no way to get the physical addresses directly from the pin tool's API.
An alternative approach to translate the virtual addresses to physical addresses would be to use the OS's page mapping API inside your pin tool. In Linux this might be possible by using /proc/<pid>/pagemap
. There are many examples on internet that demonstrate how to translate virtual addresses to physical addresses and you can find some by searching in google for "linux virtual to physical memory map".
来源:https://stackoverflow.com/questions/26114260/getting-physical-address-in-pin-tool