I don’t follow what you’re doing here. When you’re in PAE mode, assuming
that we’re using 4K pages the breakdown of the virtual address is:
[PDPTE#][PDE#][PTE#][Offset]
With the bit breakdown being 2-9-9-12.
So, for example:
1: kd> !pte 8f2f0000
VA 8f2f0000
PDE at C06023C8 PTE at C0479780
contains 000000002201E863 contains 000000003F635963
pfn 2201e —DA–KWEV pfn 3f635 -G-DA–KWEV
1: kd> .formats 8f2f0000
Evaluate expression:
…
Binary: 10001111 00101111 00000000 00000000
…
Which gives us:
[10][001111001][011110000][000000000000]
Or:
[0x2][0x79][0xF0][0x0]
Which gives us everything we need to translate:
1: kd> !dd @cr3
#3fed4500 34794801 00000000 36795801 00000000
#3fed4510 36716801 00000000 34757801 00000000
First, dump the PDPTE at entry 2:
1: kd> dt -p nt!_hardware_pte 3fed4510
+0x000 Valid : 0y1
+0x000 Write : 0y0
+0x000 Owner : 0y0
+0x000 WriteThrough : 0y0
+0x000 CacheDisable : 0y0
+0x000 Accessed : 0y0
+0x000 Dirty : 0y0
+0x000 LargePage : 0y0
+0x000 Global : 0y0
+0x000 CopyOnWrite : 0y0
+0x000 Prototype : 0y0
+0x000 reserved0 : 0y1
+0x000 PageFrameNumber : 0y00000000110110011100010110 (0x36716)
+0x000 reserved1 : 0y00000000000000000000000000 (0)
+0x000 LowPart : 0x36716801
+0x004 HighPart : 0
Now we can find the PDE by getting the page address of the PDE and then
adding the PDE entry offset:
1: kd> dt -p nt!_hardware_pte
((0x36716*@$pagesize)+(0x79*@@(sizeof(nt!_hardware_pte)))
+0x000 Valid : 0y1
+0x000 Write : 0y1
+0x000 Owner : 0y0
+0x000 WriteThrough : 0y0
+0x000 CacheDisable : 0y0
+0x000 Accessed : 0y1
+0x000 Dirty : 0y1
+0x000 LargePage : 0y0
+0x000 Global : 0y0
+0x000 CopyOnWrite : 0y0
+0x000 Prototype : 0y0
+0x000 reserved0 : 0y1
+0x000 PageFrameNumber : 0y00000000100010000000011110 (0x2201e)
+0x000 reserved1 : 0y00000000000000000000000000 (0)
+0x000 LowPart : 0x2201e863
+0x004 HighPart : 0
Now the same thing for the PTE:
1: kd> dt -p nt!_hardware_pte
((0x2201e*@$pagesize)+(0xF0*@@(sizeof(nt!_hardware_pte)))
+0x000 Valid : 0y1
+0x000 Write : 0y1
+0x000 Owner : 0y0
+0x000 WriteThrough : 0y0
+0x000 CacheDisable : 0y0
+0x000 Accessed : 0y1
+0x000 Dirty : 0y1
+0x000 LargePage : 0y0
+0x000 Global : 0y1
+0x000 CopyOnWrite : 0y0
+0x000 Prototype : 0y0
+0x000 reserved0 : 0y1
+0x000 PageFrameNumber : 0y00000000111111011000110101 (0x3f635)
+0x000 reserved1 : 0y00000000000000000000000000 (0)
+0x000 LowPart : 0x3f635963
+0x004 HighPart : 0
And that gives us our page, which matches the !pte output:
1: kd> !pte 8f2f0000
VA 8f2f0000
PDE at C06023C8 PTE at C0479780
contains 000000002201E863 contains 000000003F635963
pfn 2201e —DA–KWEV pfn 3f635 -G-DA–KWEV
So, like I said I didn’t quite follow what you’re doing but the translation
is fairly straightforward.
-scott
Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com