Page 33 - DCAP408_WEB_PROGRAMMING
P. 33
Unit 2: Windows Memory Management
should not be able to influence the page tables. Hence page tables should be in the kernel logical Notes
address space. Windows typically provides lower 2GB space to processes and reserves upper
2GB to kernel. But with a particular boot.ini switch /3GB, it permits user mode process to access
lower 3GB memory. 0xC0000000 is the next address after 3GB and so I guess that is why it is
selected for storing page directory and page tables. There are some other significant aspects to
page tables and page directory layout in memory. To appreciate that, let us gaze at how page
tables and page directory is laid out. To make it simple to appreciate, I have drawn page tables
for a fake process with pertinent entries highlighted.
!
Caution Remember that every index entry is 4 bytes in size.
P_PT displays the physical address of a Page Table.
PDB displays the physical address of page directory base of the subsequent process i.e. it shows
the physical address subsequent to logical address 0xC0300000 for that process. This value is also
accumulated in CR3.
Notes Windows can only make use of logical address to access any memory location
counting page directory, thus to access page directory and page tables, it is essential to put
some self referencing entry in page directory.
The physical address entries exposed above will be dissimilar for each process but each process
will have its PDB entry stored at index 0x300 of Page directory.
We will execute logical to physical address translation on 4 dissimilar addresses to observe the
significance of PDB entry, Page tables layout and how precisely the address translation works.
The addresses which we will transform are 0x2034AC54, 0xC0000000, 0xC0300000, 0xC0300000
[0x300] i.e. 0xC030C00. First address is a usual user mode logical address for a process, the
second address is the first logical address of first page table in logical address space, third
address is logical address of page directory base and fourth address is logical address of a special
entry as you will observe throughout translation. Assume CR3 refers to a physical address
LOVELY PROFESSIONAL UNIVERSITY 27