Question

I am aware that there is a little information regarding the pagemap file here. But nobody seems to indicate how to reference entries in the file. Is it offset by virtual address? Can I take a virtual address VA and simply lseek to offset VA? Or is it by page? If so, how do I retrieve the page number, as maps simply lists them in order. I am trying to translate between virtual and physical addresses, and lseek'ing with the virtual address as the offset always returns the same number, no matter where I seek to.

Thanks

@leeduhem: Yes I have. Here's the relevant part: 3. Open /proc/pid/pagemap and seek to the pages you would like to examine. 4. Read a u64 for each page from pagemap.

That doesn't help me. It wants me to seek to the page, but how do I know where the entry for the page is?

Was it helpful?

Solution

There is a tool that will help you to get information you need from the pagemap file.

http://fivelinesofcode.blogspot.com/2014/03/how-to-translate-virtual-to-physical.html

OTHER TIPS

You divide the virtual address by the pagesize (normally 0x1000 or 4096) and use that to index in /proc/self/pagemap. After the division, that's known as the PFN, or page frame number.

Larry

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top