I am able to convert virtual address to physical address mapping in kernel space ( root user). I have reused the code of the tool provided here
I want to do the same conversion in user space . Is it possible in user space (non root user ) ?
The above tool use /proc/pid/maps and /proc/pid/pagemap files in kernel mode,
EDIT : After receiving comments, here is my updated questions.
I want to convert virtual address to physical address in non-root privilege user, and after finding the physical address, later I will use it to find mapping to L2 cache set. My task is to find out where is my data loaded into L2 cache.
Do I need to write a kernel module which will take user virtual address and will return physical address ? If so, any link in that direction will be great help.
Is phys_addr = virt_to_phys(virt_addr); correct option ? Also unable to understand how to use it/call it from my program ?