How does Windows handle page faults on page tables?

Hi All,

Windows maintains page table entries(PTEs) in C0000000. So every TLB
miss will trigger access to the page table VA range starting from
C0000000. Also page directory entries(PDEs) are stored in memory
starting from C03000000(C0600000 in PAE as page table entry is 64bit
instead of 32bit to cater 36bit physical memory addressing). A TLB miss
might force the CPU to access this PDEs as well. There is yet another
level in the hierarchy, PDPT(page directory pointer table), in PAE mode.
And it could trigger TLB miss, too.

Windows doesn’t keep these PTEs and PTEs in NonPagedPool, which means
page fault can also occur for these virtual addresses. The question is,
‘How does Windows handle page faults on PTEs and PDEs’? Obviously the
PTEs and PDEs range for those page directory and page table should stay
present, which isn’t true. So how would OS handle it, then?

Thanks.

>‘How does Windows handle page faults on PTEs and PDEs’?

PT has a reference count which at least counts all valid PTEs in it. So, PT can
only be outswapped if all PTEs in it are not valid.

The page fault code first checks for PT to be present, and, if PT is not
present - it first brings the PT in. Then it deals with a PTE.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com