Hi,
I am developing a kernel driver as part of a research project to measure the amount of bytes a process writes in memory.
I am facing an issue quite peculiar. It arises whenever I convert a particular virtual address to a physical address.
Let me explain my test case:
I am using a test process which simply writes a string in a virtual allocated memory area, and it outputs its address.
Then, with windbg, I enter the context of that process (.process /p), and convert the virtual address of the allocated area in a physical one by means of vtop. The command I use is: !vtop dirbase (first 20 bits) virtual_address.
Now if I dump the two addresses so obtained, the resulting dumps match. That’s good as it should be.
What is driving me crazy is when I perform the same thing with the address of the PTE_BASE (0xC000000).
After getting the physical address by means of vtop
lkd> !vtop 15c56 c0000000
X86VtoP: Virt c0000000, pagedir 15c56000
X86VtoP: PDE 15c56c00 - 15c56063
X86VtoP: PTE 15c56000 - 1607e067
X86VtoP: Mapped phys 1607e000
Virtual address c0000000 translates to physical address 1607e000.
the dumps (of the virtual and physicial memory) do not match at all).
lkd> dc c0000000
c0000000 00000000 00000000 00000000 00000000 …
c0000010 00000000 00000000 00000000 00000000 …
c0000020 00000000 00000000 00000000 00000000 …
c0000030 00000000 00000000 00000000 00000000 …
c0000040 2225f067 00000000 00000000 00000000 g.%"…
c0000050 00000000 00000000 00000000 00000000 …
c0000060 00000000 00000000 00000000 00000000 …
c0000070 00000000 00000000 00000000 00000000 …
lkd> dc /p 1607e000
1607e000 00000000 00000000 00000000 00000000 …
1607e010 00000000 00000000 00000000 00000000 …
1607e020 00000000 00000000 00000000 00000000 …
1607e030 00000000 00000000 00000000 00000000 …
1607e040 15fff067 00000000 00000000 00000000 g…
1607e050 00000000 00000000 00000000 00000000 …
1607e060 00000000 00000000 00000000 00000000 …
1607e070 00000000 00000000 00000000 00000000 …
Any idea?