Page 34 - DCAP408_WEB_PROGRAMMING
P. 34

Windows Programming




                    Notes          0x13453###.  As pointed previously, lower 12  bits are used to accumulate page protection
                                   information and other information required by an OS. These are out of the scope of our current
                                   discussion so I have shown them as ###. The upper 20 bits displays the Page Frame Number or
                                   PFN which  is  the  physical  address  of  a  4KB  aligned  page. The  actual physical  address
                                   corresponding to the PFN will be 0x13453000. Let us now perform the translation:
                                   0x2034AC54


                                      0x2034AC54 can be displayed as 0010000000 1101001010 110001010100
                                      The  upper  10  bits  which  are  0010000000  provides  the  index  into  page  directory.
                                       Transforming to hexadecimal, the upper 10 bits give a value of 0x080

                                      From CR3, we know the Page Directory is situated at physical address 0x13453000 and
                                       from discussion above we also know that Page Directory is situated at logical address

                                      0xC0300000
                                      So 0xC0300000 [0x080] will give the address of page table which is P_PT. From the table
                                       above, we  can observe  that this address is displayed by page table  at logical address
                                       0xC00001000 (or physical address 0x45045000). Now we utilize next 10 bits i.e. 1101001010
                                       (or 0x34A) to index into the page table.
                                      The address 0xC00001000 [0x34A] will provide us the physical address of a 4KB page
                                       which is 0x34005000 from the table above.
                                      The number displayed by lower 12 bits, which is 110001010100 (or 0xC54), is used to point
                                       to the actual byte  on the 4KB page  located at 0x34005000. The final physical address
                                       corresponding to 0x2034AC54 comes out to be 0x34005C54
                                   I will leave the address translation of other 3 addresses as an exercise to the reader. Once you do
                                   that translation, you will appreciate why the PDB entry is stored at index 0x300 in the table
                                   above and it causes processor to consider page directory as a page table during address translation.
                                   Also this translation will provide you more information on why this specific layout was selected
                                   by windows designers.





                                      Task  Make distinction between logical address and physical address.

                                   Self Assessment

                                   Fill in the blanks:
                                   14.  Windows provides lower 2GB (or 3GB relying upon boot.ini switch) logical address space
                                       of a process to user mode and upper 2GB (or 1GB relying upon boot.ini switch) to Windows
                                       ........................ .

                                   15.  The prerequisite for storing the page tables  in ........................ is that a rouge consumer
                                       mode application should not be able to influence the page tables.

                                   2.5 Summary


                                      Memory management in Windows operating systems has developed into a affluent and
                                       classy architecture, competent of scaling from the minute embedded platforms all the way





          28                                LOVELY PROFESSIONAL UNIVERSITY
   29   30   31   32   33   34   35   36   37   38   39