Space occupied by PDE and PTE in Windows

Source: Internet
Author: User

Why is the address of the page Directory C0300000? Why does one page Directory and 1024 page tables only use 1024*4 K address space for ing the entire 4G address space, it requires 1024 page tables and 1 page Directory, each of which is 4 kb, that is, 1024*4 kb + 1*4 kb = 4 MB + 4 kb. In reality, Win2k maps the page Directory and page table of each process to the 4 MB address space from 0xC0000000 to 0xC03FFFFF (the page Directory is 4 K starting with 0xC0300000 ). Note that the address space is 4 MB instead of 4 MB + 4 kb. 1024 page tables and 1 page Directory must be (1024 + 1) * 4 kb address space. Now Win2k only uses 1024*4 kb address space. Why? The reason is that the page table is mapped to the address space of the process. If the page table and page Directory are not mapped to the address space of the process, and the 4 GB address space of a process is mapped to the physical memory, therefore, we need 1024 physical pages to store the page table, and another physical page to store the page Directory, that is, we need (1024 + 1) * 4 kb of physical memory. However, the page table is mapped to the address space of the process. As a result, the content of a page table is exactly the same as that of the page Directory, in this way, only 1024*4 kb address space is required to map 1024 page tables and 1 page Directory to the address space. One of the page tables completely overlaps with the page Directory. A page table contains 1024 items, each of which corresponds to a 4 kb address space, and a page table corresponds to a 4 MB address space. The 1024 addresses correspond to the entire 4 GB address space. The 1024 page tables are also mapped to the 4 MB address space from 0xC0000000 to 0xC03FFFFF. This 4 MB address space is also mapped to a page table. Let's look at the page table corresponding to the 4 MB address space from 0xC0000000 to 0xC03FFFFF. There are 1024 items in the page table. Each item corresponds to the address space of a page, indicating whether it is in the physical memory. If so, what is the physical address. This page table corresponds to the 4 MB address space of the page table, so each of its items corresponds to a page where each page table is located. That is to say, each item in this page table indicates whether a page table has physical memory ing, and if so, what is the physical address. This is exactly what the page Directory does. Ing 1024 page tables to the address space completely overlaps the content of one of the 1024 page tables with the page Directory, which is both a page Directory and a page table. Therefore, only 1024*4 K address space is used for one page Directory and 1024 page tables. The location where the page table is mapped to the address space is determined by the operating system designer. He will consider various issues and make the final decision. However, once the address space of the page table is determined, the address of the page Directory is determined, unless he wants to use one more page of address space to save exactly the same content as the current page table. In Win2k, the page table is mapped to the 4 MB address space from 0xC0000000 to 0xC03FFFFF. Let's calculate the address of the page table responsible for the 4 M address space, the page table is the page table that overlaps with the page Directory. The first address 0xC0000000 in the 4 MB address space is clearly the responsibility of the first item in the page table. We use this address for calculation. PTE_Address = (VirtualAddress> 12) * 4 + 0xC0000000, (0xC0000000> 12) * 4 + 0xC0000000 = 0xC0000*4 + 0xC0000000 = 0x300000 + 0xC0000000 = 0xC0300000 is the virtual address of the page Directory. The 4KB address space from 0xC0300000 to 0xC0300FFF. As a normal page, a PTE specifies the physical address of the physical page, if a page table is located, an apsaradb for RDS instance is directed to the physical address of the physical page. If a page table is located, an apsaradb for RDS instance is directed to the physical address of the physical page. The 4KB from 0xC0300000 to 0xC0300FFF corresponds to which PTE is used as a normal page. PTE_Address = (VirtualAddress> 12) * 4 + 0xC0000000, and 0xC0300C00 is calculated. That is to say, the four bytes at 0xC0300C00 are used as the PTE, indicating the physical address of the physical page where the 4 kb from 0xC0300000 to 0xC0300FFF is located. Where does the 4KB from 0xC0300000 to 0xC0300FFF correspond to the page where a page table is located? PDE_Address = (VirtualAddress> 22) * 4 + 0xC0300000, and 0xC0300C00 is calculated. That is to say, the four bytes at 0xC0300C00 are used as the PDE, indicating the physical address of the physical page where the 4 kb from 0xC0300000 to 0xC0300FFF is located. If the 4KB from 0xC0300000 to 0xC0300FFF is used as the page directory, the physical address of the physical page where the IP address is located is indicated by the F3. Therefore, if the value of the four bytes at 0xC0300C00 is 0, it is equal to the value in b3.3.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.