title: Using /proc/[pid]/pagemap
body: <p>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.</p>
  
  <p>Thanks</p>
  
  <p>@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.</p>
  
  <p>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?</p>