Windows 2000 Page Based Memory Management

xiaoxiao2021-03-18  206

Windows 2000 Page Based Memory Management

Author: jiurl home: http://jiurl.yeah.net date: 2005-06-02

1 Basic ConceptWindows 2000 uses a page-based virtual memory management. In windows 2000 system, for 32-bit CPU, every process has its own 4GB address space. All addresses used in process are all virtual address.Virtual address is a address in process's address space. All addresses used in program are all virtual address. Physical address is the address which is placed on the address bus to address the physical memory. The addresses used by accessing physical memory are all physical addresses. Virtual address is not physical address. Executing a accessing (read, write, execute) memory instruction, according to paging mechanism, CPU will automatically translate the virtual address to physical address, and complete the accessing to physical memory.For example: 00401028 nop 00401029 mov eax, [GlobalVar1 (00427e34 )] The address of the instruction "NOP" IS 00401028, IS A Virtual Address.The Address of the Instruction "MOV Eax, [GlobalVar1 (00427E34)]" IS 00401029, IS A Virtual Address.in Instance ruction "mov eax, [GlobalVar1 (00427e34)]", the address of "GlobalVar1" is 00427e34, is a virtual address.When these instructions are executed by CPU, CPU will automatically translate the virtual address to physical address, access the physical memory , get instruction or data, to execute the instruction.In windows 2000 system, for 32-bit CPU, no matter how much physical memory have, every process has its own 4GB address space, 0x00000000-0xFFFFFFFF. Basing paging mechanism, in 4GB address Space, Some Parts Are Mapped to Physical Memory, Some Parts Are Mapped To Files on The Disk, Some Parts Are Mapped To Nothing.IN Process'

s 4GB address space, 0x00000000-0x7FFFFFFF, lower 2GB address space is used by the process, is called "user address space", 0x80000000-0xFFFFFFFF, higher 2GB address space is used by system, is called "system address space". Every process is only able to access its own user address space, and is not able to access the other process's user address space. The content of every process's user address space is not same, but the vast majority of the content of every process'

. S system address space is same User mode code can not access the system address space, kernel mode code can access the system address space.2 Valid Page - Hardware PartWe only discuss the x86 architecture case.2.1 X86 Paging MechanismFor x86 CPU, bit 31 of register CR0 is Paging flag bit, when set, CPU will treat all addresses as virtual address, and automatically complete the translation from virtual address to physical address. Operating system will set the Paging flag bit during system initialization. In initialized windows 2000, we can see the Paging flag bit has been 1.When paging is used, the processor divides the 4GB address space and physical memory into fixed-size pages. A page in address space is possibly mapped into a physical page in physical memory, or possibly mapped into files on disk, or mapped into nothing. For 32-bit CPU, the page (page in address space, physical page) size is 4KB.2.2 Page Directory, Page TableThe information which is used by CPU to translate the v irtual address to physical address, is stored in structures called page table, page directory.The size of a physical page is 4KB, so the lower 12 bits of physical address of a physical page are all 0, so to address a physical page only needs The Higher 20 Bits of Physical Address of Page N in Physical Memory, IS N, SO Windows 2000 Call The Higher 20 Bits of Physical Address of a Physical Page "Physical Frame Number"

. For example, the physical address of page 0 in physical memory is 0x00000000, the physical address of page 1 in physical memory is 0x00001000.Page table, the size of a page table is 4KB, is hold in a physical page. Page table consists Of 1024 4-byte page Table Entries. The size of a page Table Entry IS 4 bytes, 32 Bits, SO A page Table Have 1024 Page Table Entries. For mapped to a Physical Page Case, The Higher 20 Bits of a page Table Entry holds a physical frame number of a physical page, the lower 12 bits holds some flags.Page directory, the size of a page directory is 4KB, is hold in a physical page. Page directory consists of 1024 4-byte page directory entries. The size of a page directory entry is 4 bytes, 32 bits, so a page directory have 1024 page directory entries. For mapped to a physical page case, the higher 20 bits of a page directory entry holds a physical frame number of a physical page, The Lower 12 Bits Holds Some Flags.The Physical Address of Page Directory Is Hold i n CPU's register CR3.2.3 CPU Translate Virtual Address to Physical AddressA virtual address is 4 bytes (32 bits) long, containing the information to find the physical address, is divided into 3 parts: bit31-bit22 this 10 bits is the index in page directory, bit21-bit12 this 10 bits is the index in page table, bit11-bit0 this 12 bits is the offset in page. When CPU translate a virtual address to physical address, first according to the value of CR3, find the physical page where Page Directory Is in. Then Using the 10 Bits'

s value of bit31-bit22 of virtual address as index, find the corresponding page directory entry in page directory, the page directory entry holds the physical address of the physical page where the virtual address corresponding page talbe is in. According to the physical address of the page table, find the page table. Then using the 10 bits's value of bit21-bit12 of virtual address as index, find the corresponding page table entry in page table, the page table entry holds the physical address of the virtual address corresponding physical page . Finally using the 12 bits's value of bit11-bit0 of virtual address as offset, add the offset to the physical address of the virtual address corresponding physical page, and get the virtual address corresponding physical address.A page directory has 1024 entries, the bit31 -bit22 of Virtual Address IS 10 BITS, CAN JUST INDEX THE 1024 Entries (2 ^ 10 = 1024). a page Table HAS 1024 Entries, The Bit21-Bit12 of Virtual Address IS 10 Bits, Can Just Index The 1024 Entries (2 ^ 10 = 1024). Bit11-Bit0 This 12 Bits of Virtual Address (2 ^ 12 = 4096), IS Used As Offset, Can Just Index 4KB, EVERY BYTE INDESICAL Page.Virtual Address IS 32 BITS long, can address 0x00000000-0xFFFFFFFF, 4GB size. that means that a 32-bit virtual address can address every byte in the entire 4GB address space. A page table entry maps 4KB address space to physical memory, a page table has 1024 entries, so a page talbe maps 1024 * 4KB = 4MB address space. A page directory entry corresponds a page table. A page directory has 1024 entries, corresponds 1024 page tables. A page talbe maps 4MB address space, 1024 page tables map 1024 * 4MB =

4GB address space. A process has a page directory. So using page as the unit, page directory and page tables can ensure the mapping of every page in 4GB address space to physical memory.2.4 Valid Page Directory Entry and Valid Page Table EntryThe structure of page table entry and page directory entry is defined by CPU and operating system. First CPU defines some bits, CPU will interpret these bits according to this definition. Operating system can not use these bits which have been defined by CPU for other purpose. The bits which have not been defined by CPU are defined by operating system, operating system will interpret these bits according to this definition.CPU judges whether a page is mapped to physical memory by the lowest bit, bit0, of page directory entry and page table entry. THE LOWEST BIT IS 1, IS CALED VALID, Means The Page Table Entry Are Defined by CPU, A Little Bits Are Defined by System. ONLY BIT0, VALID FLAG bit, in an invalid page table entry is defined by CPU, the other bits are all defined by system. We introduce the structure definition of valid page table entry (page directory entry) here, and the structure definition of invalid page table entry (page . directory entry) later.Page directory entry and page table entry, 4 bytes long, 32 bits, have the same structure definition Valid PTE (Page Table entry) structure definition: bits0 Validbits1 Writebits2 Ownerbits3 WriteThroughbits4 CacheDisablebits5 Accessedbits6 Dirtybits7 LargePagebits8 Globalbits9 CopyOnWritebits10-10 Prototypebits11 -11 reservedBits12-31 Pageframenumberbits12-31 PageFramenumber:

Defined by CPU.PageFrameNumber, 20 bits long, can address every physical page in 4GB physical memory For a page directory entry, the founded physical page holds a page table.bits0-0 Valid:. Defined by CPU.Indicates whether the corresponding page is . mapped to physical memory When 0, is called "invalid", the corresponding page is not mapped to physical memory When 1, is called "valid", the corresponding page is mapped to physical memory.bits1-1 Write:. Defined by CPU . .Specifies the read-write privileges When 0, the page is read only When 1, the page is read / write.bits2-2 Owner:.. Defined by CPU.Accessing privilege When 0, only kernel mode code (x86's ring0 privilege ) CAN Access. When 1, user mode code (x86 '

s ring3 privilege) and kernel mode code both can access.bits3-3 WriteThrough: Defined by CPU.Controls the caching policy of relative page.bits4-4 CacheDisable: Defined by CPU.Specifies whether disable the caching of the page.bits5-5 Accessed: defined by cpu.indicates WHENER TO). WHEN 0, The Page Has NOT BEEN Accessed .hen 1.bits6-6 Dirty: defined by cpu.indicates Written to. When 0, The Page 1, The page has been b 1.bits7-7 largepage: defined by cpu.determines the page size .when 0, The page size is 4KB. WHEN 1, The page size is 4MB.BITS8-8 Global: defined by cpu.indicates WHETHER THE PAGE. WHEN 1, The page is a global page. Bits9-9 CopyonWrite: defined by system.used for copy-on-write mechanism.bits10-10 prototype: defined by system.used for prototype pte.bits11-11 reserved: defined by System.reserv ed.3 Valid Page - Software Part3.1 The Position of Process's Page Directory and Page Tables in Address SpaceDuring translation from virtual address to physical address, CPU does not need the virtual address of page directory and page tables But a process'.

s page directory and page tables are created and maintained by system, system need access page directory and page tables, all addresses used by system are virtual address, so system must map page directory and page tables into address space. The 1024 page tables which are used to map 4GB address space are orderly mapped to 0xC0000000-0xC0400000 this 4MB address space. The page table which used to map the first 4MB address space, locates in the first 4KB address space beginning from 0xC0000000. The page table which used to map the second 4MB address space, locates in the second 4KB address space beginning from 0xC0000000, and so on. The page directory is mapped to the 4KB address space beginning from 0xC0300000. The page directory and page tables are all in system address space, so the user Mode Code Can not access.3.2 The Large Page Part in Address SpaceOperating System's Keernel Is Offormance, Windows 2000 Places The System Kernel (HAL.DLL AND NTOSKRN l.exe) in large pages. Using large page can reduce TLB misses and save TLB cache, to improve system performance. The size of large page is 4MB.Observing page directory, we can see that the LargePage flag bit of 0xC0300800-0xC03009FC the 128 page directory entries is set, that means the 128 page directory entries point to 128 large page The 128 page directory entries corresponding address space is 0x80000000 -. 0xA0000000, 0x20000000 B = 512 MB.LargePage page directory entry, doesn '

t point to a page table physical page, directly points to a 4MB physical page. The size of page is 4MB, so bit21-bit12 this 10 bits is 0. During translation from virtual address to physical address, CPU use the bit31-bit22 this 10 bits of virtual address as index, find the corresponding page directory entry in page directory, find the page directory entry's LargePage flag bit is set, so get the physical address of the 4MB physical page. Then using the bit21-bit0 this 22 bits of virtual address as offset, add the offset to the physical address of the 4MB physical page, and get the virtual address corresponding phyiscal address.Observing the 128 LargePage page directory entries, we can find the address space 80000000-9FFFFFFF maps to physical memory 00000000- 1FFFFFFF. That means the lower 512 MB of physical memory is mapped to address space 80000000-9FFFFFFF. We can also find the 128 LargePage page directory entries are always valid. If physical memory is less than 512MB, then some part of the LargePage address space can not map to actual physical memory, but the corresponding LargePage page directory entries are still valid, if read from these address space, the read out content are all 0xFF.3.3 Page Directory, Page Table ExamplesA notepad process'

s page directory: c0300000: 05f5b067 058ae067 067b5067 00eae067c0300010: 03bfa067 00000000 00000000 00000000c0300020: 00000000 00000000 00000000 00000000c0300030: 00000000 00000000 00000000 00000000c0300040: 00000000 00000000 00000000 00000000c0300050: 00000000 00000000 00000000 00000000c0300060: 00000000 00000000 00000000 00000000c0300070: 00000000 00000000 00000000 00000000c0300080: 00000000 00000000 00000000 00000000c0300090 : 00000000 00000000 00000000 00000000c03000a0: 00000000 00000000 00000000 00000000c03000b0: 00000000 00000000 00000000 00000000c03000c0: 00000000 00000000 00000000 00000000c03000d0: 00000000 00000000 00000000 00000000c03000e0: 00000000 00000000 00000000 00000000c03000f0: 00000000 00000000 00000000 00000000c0300100: 043b1067 00000000 00000000 00000000c0300110: 00000000 00000000 00000000 00000000c0300120: 00000000 00000000 00000000 00000000c0300130 000000002, China 0000000c0300160: 00000000 00000000 00000000 00000000c0300170: 00000000 00000000 00000000 00000000c0300180: 00000000 00000000 00000000 00000000c0300190: 00000000 00000000 00000000 00000000c03001a0: 00000000 00000000 00000000 00000000c03001b0: 00000000 00000000 00000000 00000000c03001c0: 00000000 00000000 00000000 00000000c03001d0: 00000000 00000000 00000000 00000000c03001e0: 00000000 00000000 00000000 00000000c03001f0: 00000000 00000000 00000000 00000000c0300200: 00000000 00000000 00000000 00000000c0300210: 00000000 00000000 00000000 00000000c0300220: 00000000 00000000 00000000 00000000c0300230: 00000000 00000000 00000000 00000000c0300240: 00000000 00000000 00000000 00000000c0300250: 00000000 00000000 00000000 00000000c0300260:

00000000 00000000 00000000 00000000c0300270: 00000000 00000000 00000000 00000000c0300280: 00000000 00000000 00000000 00000000c0300290: 00000000 00000000 00000000 00000000c03002a0: 00000000 00000000 00000000 00000000c03002b0: 00000000 00000000 00000000 00000000c03002c0: 00000000 00000000 00000000 00000000c03002d0: 00000000 00000000 00000000 00000000c03002e0: 00000000 00000000 00000000 00000000c03002f0: 00000000 00000000 00000000 00000000c0300300: 00000000 00000000 00000000 00000000c0300310: 00000000 00000000 00000000 00000000c0300320: 00000000 00000000 00000000 00000000c0300330: 00000000 00000000 00000000 00000000c0300340: 00000000 00000000 00000000 00000000c0300350: 00000000 00000000 00000000 00000000c0300360: 00000000 00000000 00000000 00000000c0300370: 00000000 00000000 00000000 00000000c0300380: 00000000 00000000 00000000 00000000c0300390: 00000000 00000000 00000000 00000000c03003a0: 000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000 00000000 00000000c03003d0: 00000000 00000000 00000000 00000000c03003e0: 00000000 00000000 00000000 00000000c03003f0: 00000000 00000000 00000000 00000000c0300400: 00000000 00000000 00000000 00000000c0300410: 00000000 00000000 00000000 00000000c0300420: 00000000 00000000 00000000 00000000c0300430: 00000000 00000000 00000000 00000000c0300440: 00000000 00000000 00000000 00000000c0300450: 00000000 00000000 00000000 00000000c0300460: 00000000 00000000 00000000 00000000c0300470: 00000000 00000000 00000000 00000000c0300480: 00000000 00000000 00000000 00000000c0300490: 00000000 00000000 00000000 00000000c03004a0: 00000000 00000000 00000000 00000000c03004b0: 00000000 00000000 00000000 00000000c03004c0:

00000000 00000000 00000000 00000000c03004d0: 00000000 00000000 00000000 00000000c03004e0: 00000000 00000000 00000000 00000000c03004f0: 00000000 00000000 00000000 00000000c0300500: 00000000 00000000 00000000 00000000c0300510: 00000000 00000000 00000000 00000000c0300520: 00000000 00000000 00000000 00000000c0300530: 00000000 00000000 00000000 00000000c0300540: 00000000 00000000 00000000 00000000c0300550: 00000000 00000000 00000000 00000000c0300560: 00000000 00000000 00000000 00000000c0300570: 00000000 00000000 00000000 00000000c0300580: 00000000 00000000 00000000 00000000c0300590: 00000000 00000000 00000000 00000000c03005a0: 00000000 00000000 00000000 00000000c03005b0: 00000000 00000000 00000000 00000000c03005c0: 00000000 00000000 00000000 00000000c03005d0: 00000000 00000000 00000000 00000000c03005e0: 00000000 00000000 00000000 00000000c03005f0: 00000000 00000000 00000000 00000000c0300600: 0000000010 聽 00000000000610: 0000000000000000000000002 0000000 00000000 00000000c0300630: 00000000 00000000 00000000 00000000c0300640: 00000000 00000000 00000000 00000000c0300650: 00000000 00000000 00000000 00000000c0300660: 00000000 00000000 00000000 00000000c0300670: 00000000 00000000 00000000 00000000c0300680: 00000000 00000000 00000000 00000000c0300690: 00000000 00000000 00000000 00000000c03006a0: 00000000 00000000 00000000 00000000c03006b0: 00000000 00000000 00000000 00000000c03006c0: 00000000 00000000 00000000 00000000c03006d0: 00000000 00000000 00000000 0423a067c03006e0: 00000000 00000000 00000000 00000000c03006f0: 00000000 00000000 00000000 00000000c0300700: 00000000 00000000 00000000 00000000c0300710: 00000000 00000000 00000000 00000000c0300720:

00000000 00000000 00000000 00000000c0300730: 00000000 00000000 00000000 00000000c0300740: 00000000 00000000 00000000 00000000c0300750: 00000000 00000000 00000000 0154b067c0300760: 00000000 00000000 01fa4067 00000000c0300770: 00000000 03946067 06825067 00d00067c0300780: 01cc7067 00000000 00000000 00000000c0300790: 00000000 00000000 00000000 00000000c03007a0: 00000000 00000000 00000000 00000000c03007b0: 00000000 00000000 00000000 00000000c03007c0: 00000000 00000000 00000000 00000000c03007d0: 00000000 00000000 00000000 00000000c03007e0: 00000000 00000000 00000000 00000000c03007f0: 00000000 02869067 00000000 07b98067c0300800: 000001e3 004001e3 008001e3 00c001e3c0300810: 010001e3 014001e3 018001e3 01c001e3c0300820: 020001e3 024001e3 028001e3 02c001e3c0300830: 030001e3 034001e3 038001e3 03c001e3c0300840: 040001e3 044001e3 048001e3 04c001e3c0300850: 050001e3 054001e3 058001e3 05c001e3c0300860: 060001E3 064001E3 068001E3 06C001E3C0300870: 070001E3 074001E3 078001E3 07C001E3C0300880: 080001E3 0 84001e3 088001e3 08c001e3c0300890: 090001e3 094001e3 098001e3 09c001e3c03008a0: 0a0001e3 0a4001e3 0a8001e3 0ac001e3c03008b0: 0b0001e3 0b4001e3 0b8001e3 0bc001e3c03008c0: 0c0001e3 0c4001e3 0c8001e3 0cc001e3c03008d0: 0d0001e3 0d4001e3 0d8001e3 0dc001e3c03008e0: 0e0001e3 0e4001e3 0e8001e3 0ec001e3c03008f0: 0f0001e3 0f4001e3 0f8001e3 0fc001e3c0300900: 100001e3 104001e3 108001e3 10c001e3c0300910: 110001e3 114001e3 118001e3 11c001e3c0300920: 120001e3 124001e3 128001e3 12c001e3c0300930: 130001e3 134001e3 138001e3 13c001e3c0300940: 140001e3 144001e3 148001e3 14c001e3c0300950: 150001e3 154001e3 158001e3 15c001e3c0300960: 160001e3 164001e3 168001e3 16c001e3c0300970: 170001e3 174001e3 178001e3 17c001e3c0300980:

180001e3 184001e3 188001e3 18c001e3c0300990: 190001e3 194001e3 198001e3 19c001e3c03009a0: 1a0001e3 1a4001e3 1a8001e3 1ac001e3c03009b0: 1b0001e3 1b4001e3 1b8001e3 1bc001e3c03009c0: 1c0001e3 1c4001e3 1c8001e3 1cc001e3c03009d0: 1d0001e3 1d4001e3 1d8001e3 1dc001e3c03009e0: 1e0001e3 1e4001e3 1e8001e3 1ec001e3c03009f0: 1f0001e3 1f4001e3 1f8001e3 1fc001e3c0300a00: 06470163 00000000 00000000 00000000c0300a10: 00000000 00000000 00000000 00000000c0300a20: 00000000 00000000 00000000 00000000c0300a30: 00000000 00000000 00000000 00000000c0300a40: 016f1163 016f2163 016f3163 016f4163c0300a50: 016f5163 016f6163 016d7163 016d8163c0300a60: 016d9163 016da163 016db163 016dc163c0300a70: 016dd163 016de163 016df163 01740163c0300a80: 01701163 01702163 01703163 01704163c0300a90: 01705163 01706163 01707163 01708163c0300aa0: 01709163 0170a163 0170b163 0170c163c0300ab0: 0170d163 0170e163 0170f163 01710163c0300ac0: 01711163 01712163 01713163 01714163C0300AD0: 01715163 01716163 016F7163 016F8163C0300AE0: 016F9163 0 16fa163 016fb163 016fc163c0300af0: 016fd163 016fe163 016ff163 01760163c0300b00: 01721163 01722163 01723163 01724163c0300b10: 01725163 01726163 01727163 01728163c0300b20: 01729163 0172a163 0172b163 0172c163c0300b30: 0172d163 0172e163 0172f163 01730163c0300b40: 01731163 01732163 01733163 01734163c0300b50: 01735163 01736163 01717163 01718163c0300b60: 01719163 0171a163 0171b163 0171c163c0300b70: 0171d163 0171e163 0171f163 01780163c0300b80: 01741163 01742163 01743163 01744163c0300b90: 01745163 01746163 01747163 01748163c0300ba0: 01749163 0174a163 0174b163 0174c163c0300bb0: 0174d163 0174e163 0174f163 01750163c0300bc0: 01751163 01752163 01753163 01754163c0300bd0: 01755163 01756163 01737163 01738163c0300be0:

01739163 0173a163 0173b163 0173c163c0300bf0: 0173d163 0173e163 0173f163 017a0163c0300c00: 05cf0063 04a11063 00000000 01670163c0300c10: 01671163 01672163 01673163 01674163c0300c20: 01675163 01676163 01657163 01658163c0300c30: 01659163 0165a163 0165b163 0165c163c0300c40: 0165d163 0165e163 0165f163 016c0163c0300c50: 01681163 01682163 01683163 01684163c0300c60: 01685163 01686163 01687163 01688163c0300c70: 01689163 0168a163 0168b163 0168c163c0300c80: 0168d163 0168e163 0168f163 01690163c0300c90: 01691163 01692163 01693163 01694163c0300ca0: 01695163 01696163 01677163 01678163c0300cb0: 01679163 0167a163 0167b163 0167c163c0300cc0: 0167d163 0167e163 0167f163 016e0163c0300cd0: 016a1163 016a2163 016a3163 016a4163c0300ce0: 016a5163 016a6163 016a7163 016a8163c0300cf0: 016a9163 016aa163 016ab163 016ac163c0300d00: 016ad163 016ae163 016af163 016b0163c0300d10: 016b1163 016b2163 016b3163 016b4163c0300d20: 016B5163 016B6163 01697163 01698163C0300D30: 0169163 0169A163 0169B163 0169C163C0300D40: 0169D163 0 169e163 0169f163 01700163c0300d50: 016c1163 016c2163 016c3163 016c4163c0300d60: 016c5163 016c6163 016c7163 016c8163c0300d70: 016c9163 016ca163 016cb163 016cc163c0300d80: 016cd163 016ce163 016cf163 016d0163c0300d90: 016d1163 016d2163 016d3163 016d4163c0300da0: 016d5163 016d6163 016b7163 016b8163c0300db0: 016b9163 016ba163 016bb163 016bc163c0300dc0: 016bd163 016be163 016bf163 01720163c0300dd0: 016e1163 016e2163 016e3163 016e4163c0300de0: 016e5163 016e6163 016e7163 016e8163c0300df0: 016e9163 016ea163 016eb163 016ec163c0300e00: 016ed163 016ee163 016ef163 016f0163c0300e10: 01765163 026f6163 05189163 055ab163c0300e20: 00000000 0740f163 05a71163 05f43163c0300e30: 0090a163 0297e163 04867163 00000000c0300e40:

00000000 00000000 00000000 00000000c0300e50: 00000000 00000000 00000000 00000000c0300e60: 00000000 00000000 00000000 00000000c0300e70: 00000000 00000000 01768163 01769163c0300e80: 0176a163 0176b163 0176c163 0176d163c0300e90: 0176e163 0176f163 01770163 01771163c0300ea0: 01772163 01773163 01774163 01775163c0300eb0: 01776163 01757163 01758163 01759163c0300ec0: 0175a163 0175b163 0175c163 0175d163c0300ed0: 0175e163 0175f163 017c0163 01781163c0300ee0: 01782163 01783163 01784163 01785163c0300ef0: 01786163 01787163 01788163 01789163c0300f00: 0178a163 01000163 01001163 01002163c0300f10: 01003163 01004163 01005163 01006163c0300f20: 01007163 01008163 01009163 0100a163c0300f30: 0100b163 0100c163 0100d163 0100e163c0300f40: 0100f163 01010163 01011163 01012163c0300f50: 01013163 01014163 01015163 01016163c0300f60: 01017163 01018163 01019163 0101a163c0300f70: 0101b163 0101c163 0101d163 0101e163c0300f80: 0101F163 01020163 01021163 01022163C0300F90: 01023163 01024163 01025163 01026163C0300FA0: 01027163 0 1028163 01029163 0102a163c0300fb0: 0102b163 0102c163 0102d163 0102e163c0300fc0: 0102f163 01030163 01031163 01032163c0300fd0: 01033163 01034163 01035163 01036163c0300fe0: 01037163 01038163 01039163 0103a163c0300ff0: 0103b163 0103c163 0103d163 000311634GB address space, lower 2GB is user address space, front 512 PDEs are used for the translation of the 2GB address space. Higher 2GB is system address space, hind 512 PDEs are used for the translation of the 2GB address space. PDE is 0x00000000, means that no corresponding page table, corresponding 4MB address space mapped nothing. In the 512 PDEs of this example, we See Large Numbers of Pdes Are 0x00000000, That Means Large Numbers of User Address Space Mapped Nothing.system Process'

s page directory: c0300000: 01860067 00000000 00000000 00000000c0300010: 00000000 00000000 00000000 00000000c0300020: 00000000 00000000 00000000 00000000c0300030: 00000000 00000000 00000000 00000000c0300040: 00000000 00000000 00000000 00000000c0300050: 00000000 00000000 00000000 00000000c0300060: 00000000 00000000 00000000 00000000c0300070: 00000000 00000000 00000000 00000000c0300080: 00000000 00000000 00000000 00000000c0300090 : 00000000 00000000 00000000 00000000c03000a0: 00000000 00000000 00000000 00000000c03000b0: 00000000 00000000 00000000 00000000c03000c0: 00000000 00000000 00000000 00000000c03000d0: 00000000 00000000 00000000 00000000c03000e0: 00000000 00000000 00000000 00000000c03000f0: 00000000 00000000 00000000 00000000c0300100: 00000000 00000000 00000000 00000000c0300110: 00000000 00000000 00000000 00000000c0300120: 00000000 00000000 00000000 00000000c0300130 000000002, China 0000000c0300160: 00000000 00000000 00000000 00000000c0300170: 00000000 00000000 00000000 00000000c0300180: 00000000 00000000 00000000 00000000c0300190: 00000000 00000000 00000000 00000000c03001a0: 00000000 00000000 00000000 00000000c03001b0: 00000000 00000000 00000000 00000000c03001c0: 00000000 00000000 00000000 00000000c03001d0: 00000000 00000000 00000000 00000000c03001e0: 00000000 00000000 00000000 00000000c03001f0: 00000000 00000000 00000000 00000000c0300200: 00000000 00000000 00000000 00000000c0300210: 00000000 00000000 00000000 00000000c0300220: 00000000 00000000 00000000 00000000c0300230: 00000000 00000000 00000000 00000000c0300240: 00000000 00000000 00000000 00000000c0300250: 00000000 00000000 00000000 00000000c0300260:

00000000 00000000 00000000 00000000c0300270: 00000000 00000000 00000000 00000000c0300280: 00000000 00000000 00000000 00000000c0300290: 00000000 00000000 00000000 00000000c03002a0: 00000000 00000000 00000000 00000000c03002b0: 00000000 00000000 00000000 00000000c03002c0: 00000000 00000000 00000000 00000000c03002d0: 00000000 00000000 00000000 00000000c03002e0: 00000000 00000000 00000000 00000000c03002f0: 00000000 00000000 00000000 00000000c0300300: 00000000 00000000 00000000 00000000c0300310: 00000000 00000000 00000000 00000000c0300320: 00000000 00000000 00000000 00000000c0300330: 00000000 00000000 00000000 00000000c0300340: 00000000 00000000 00000000 00000000c0300350: 00000000 00000000 00000000 00000000c0300360: 00000000 00000000 00000000 00000000c0300370: 00000000 00000000 00000000 00000000c0300380: 00000000 00000000 00000000 00000000c0300390: 00000000 00000000 00000000 00000000c03003a0: 000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000 00000000 00000000c03003d0: 00000000 00000000 00000000 00000000c03003e0: 00000000 00000000 00000000 00000000c03003f0: 00000000 00000000 00000000 00000000c0300400: 00000000 00000000 00000000 00000000c0300410: 00000000 00000000 00000000 00000000c0300420: 00000000 00000000 00000000 00000000c0300430: 00000000 00000000 00000000 00000000c0300440: 00000000 00000000 00000000 00000000c0300450: 00000000 00000000 00000000 00000000c0300460: 00000000 00000000 00000000 00000000c0300470: 00000000 00000000 00000000 00000000c0300480: 00000000 00000000 00000000 00000000c0300490: 00000000 00000000 00000000 00000000c03004a0: 00000000 00000000 00000000 00000000c03004b0: 00000000 00000000 00000000 00000000c03004c0:

00000000 00000000 00000000 00000000c03004d0: 00000000 00000000 00000000 00000000c03004e0: 00000000 00000000 00000000 00000000c03004f0: 00000000 00000000 00000000 00000000c0300500: 00000000 00000000 00000000 00000000c0300510: 00000000 00000000 00000000 00000000c0300520: 00000000 00000000 00000000 00000000c0300530: 00000000 00000000 00000000 00000000c0300540: 00000000 00000000 00000000 00000000c0300550: 00000000 00000000 00000000 00000000c0300560: 00000000 00000000 00000000 00000000c0300570: 00000000 00000000 00000000 00000000c0300580: 00000000 00000000 00000000 00000000c0300590: 00000000 00000000 00000000 00000000c03005a0: 00000000 00000000 00000000 00000000c03005b0: 00000000 00000000 00000000 00000000c03005c0: 00000000 00000000 00000000 00000000c03005d0: 00000000 00000000 00000000 00000000c03005e0: 00000000 00000000 00000000 00000000c03005f0: 00000000 00000000 00000000 00000000c0300600: 0000000010 聽 00000000000610: 0000000000000000000000002 0000000 00000000 00000000c0300630: 00000000 00000000 00000000 00000000c0300640: 00000000 00000000 00000000 00000000c0300650: 00000000 00000000 00000000 00000000c0300660: 00000000 00000000 00000000 00000000c0300670: 00000000 00000000 00000000 00000000c0300680: 00000000 00000000 00000000 00000000c0300690: 00000000 00000000 00000000 00000000c03006a0: 00000000 00000000 00000000 00000000c03006b0: 00000000 00000000 00000000 00000000c03006c0: 00000000 00000000 00000000 00000000c03006d0: 00000000 00000000 00000000 00000000c03006e0: 00000000 00000000 00000000 00000000c03006f0: 00000000 00000000 00000000 00000000c0300700: 00000000 00000000 00000000 00000000c0300710: 00000000 00000000 00000000 00000000c0300720:

00000000 00000000 00000000 00000000c0300730: 00000000 00000000 00000000 00000000c0300740: 00000000 00000000 00000000 00000000c0300750: 00000000 00000000 00000000 00000000c0300760: 00000000 00000000 00000000 00000000c0300770: 00000000 00000000 00000000 02119067c0300780: 00000000 00000000 00000000 00000000c0300790: 00000000 00000000 00000000 00000000c03007a0: 00000000 00000000 00000000 00000000c03007b0: 00000000 00000000 00000000 00000000c03007c0: 00000000 00000000 00000000 00000000c03007d0: 00000000 00000000 00000000 00000000c03007e0: 00000000 00000000 00000000 00000000c03007f0: 00000000 00000000 00000000 02138067c0300800: 000001e3 004001e3 008001e3 00c001e3c0300810: 010001e3 014001e3 018001e3 01c001e3c0300820: 020001e3 024001e3 028001e3 02c001e3c0300830: 030001e3 034001e3 038001e3 03c001e3c0300840: 040001e3 044001e3 048001e3 04c001e3c0300850: 050001e3 054001e3 058001e3 05c001e3c0300860: 060001E3 064001E3 068001E3 06C001E3C0300870: 070001E3 074001E3 078001E3 07C001E3C0300880: 080001E3 0 84001e3 088001e3 08c001e3c0300890: 090001e3 094001e3 098001e3 09c001e3c03008a0: 0a0001e3 0a4001e3 0a8001e3 0ac001e3c03008b0: 0b0001e3 0b4001e3 0b8001e3 0bc001e3c03008c0: 0c0001e3 0c4001e3 0c8001e3 0cc001e3c03008d0: 0d0001e3 0d4001e3 0d8001e3 0dc001e3c03008e0: 0e0001e3 0e4001e3 0e8001e3 0ec001e3c03008f0: 0f0001e3 0f4001e3 0f8001e3 0fc001e3c0300900: 100001e3 104001e3 108001e3 10c001e3c0300910: 110001e3 114001e3 118001e3 11c001e3c0300920: 120001e3 124001e3 128001e3 12c001e3c0300930: 130001e3 134001e3 138001e3 13c001e3c0300940: 140001e3 144001e3 148001e3 14c001e3c0300950: 150001e3 154001e3 158001e3 15c001e3c0300960: 160001e3 164001e3 168001e3 16c001e3c0300970: 170001e3 174001e3 178001e3 17c001e3c0300980:

180001e3 184001e3 188001e3 18c001e3c0300990: 190001e3 194001e3 198001e3 19c001e3c03009a0: 1a0001e3 1a4001e3 1a8001e3 1ac001e3c03009b0: 1b0001e3 1b4001e3 1b8001e3 1bc001e3c03009c0: 1c0001e3 1c4001e3 1c8001e3 1cc001e3c03009d0: 1d0001e3 1d4001e3 1d8001e3 1dc001e3c03009e0: 1e0001e3 1e4001e3 1e8001e3 1ec001e3c03009f0: 1f0001e3 1f4001e3 1f8001e3 1fc001e3c0300a00: 06470163 06f15163 00000000 00000000c0300a10: 00000000 00000000 00000000 00000000c0300a20: 00000000 00000000 00000000 00000000c0300a30: 00000000 00000000 00000000 00000000c0300a40: 016f1163 016f2163 016f3163 016f4163c0300a50: 016f5163 016f6163 016d7163 016d8163c0300a60: 016d9163 016da163 016db163 016dc163c0300a70: 016dd163 016de163 016df163 01740163c0300a80: 01701163 01702163 01703163 01704163c0300a90: 01705163 01706163 01707163 01708163c0300aa0: 01709163 0170a163 0170b163 0170c163c0300ab0: 0170d163 0170e163 0170f163 01710163c0300ac0: 01711163 01712163 01713163 01714163C0300AD0: 01715163 01716163 016F7163 016F8163C0300AE0: 016F9163 0 16fa163 016fb163 016fc163c0300af0: 016fd163 016fe163 016ff163 01760163c0300b00: 01721163 01722163 01723163 01724163c0300b10: 01725163 01726163 01727163 01728163c0300b20: 01729163 0172a163 0172b163 0172c163c0300b30: 0172d163 0172e163 0172f163 01730163c0300b40: 01731163 01732163 01733163 01734163c0300b50: 01735163 01736163 01717163 01718163c0300b60: 01719163 0171a163 0171b163 0171c163c0300b70: 0171d163 0171e163 0171f163 01780163c0300b80: 01741163 01742163 01743163 01744163c0300b90: 01745163 01746163 01747163 01748163c0300ba0: 01749163 0174a163 0174b163 0174c163c0300bb0: 0174d163 0174e163 0174f163 01750163c0300bc0: 01751163 01752163 01753163 01754163c0300bd0: 01755163 01756163 01737163 01738163c0300be0:

01739163 0173a163 0173b163 0173c163c0300bf0: 0173d163 0173e163 0173f163 017a0163c0300c00: 00030067 01520063 00000000 01670163c0300c10: 01671163 01672163 01673163 01674163c0300c20: 01675163 01676163 01657163 01658163c0300c30: 01659163 0165a163 0165b163 0165c163c0300c40: 0165d163 0165e163 0165f163 016c0163c0300c50: 01681163 01682163 01683163 01684163c0300c60: 01685163 01686163 01687163 01688163c0300c70: 01689163 0168a163 0168b163 0168c163c0300c80: 0168d163 0168e163 0168f163 01690163c0300c90: 01691163 01692163 01693163 01694163c0300ca0: 01695163 01696163 01677163 01678163c0300cb0: 01679163 0167a163 0167b163 0167c163c0300cc0: 0167d163 0167e163 0167f163 016e0163c0300cd0: 016a1163 016a2163 016a3163 016a4163c0300ce0: 016a5163 016a6163 016a7163 016a8163c0300cf0: 016a9163 016aa163 016ab163 016ac163c0300d00: 016ad163 016ae163 016af163 016b0163c0300d10: 016b1163 016b2163 016b3163 016b4163c0300d20: 016B5163 016B6163 01697163 01698163C0300D30: 0169163 0169A163 0169B163 0169C163C0300D40: 0169D163 0 169e163 0169f163 01700163c0300d50: 016c1163 016c2163 016c3163 016c4163c0300d60: 016c5163 016c6163 016c7163 016c8163c0300d70: 016c9163 016ca163 016cb163 016cc163c0300d80: 016cd163 016ce163 016cf163 016d0163c0300d90: 016d1163 016d2163 016d3163 016d4163c0300da0: 016d5163 016d6163 016b7163 016b8163c0300db0: 016b9163 016ba163 016bb163 016bc163c0300dc0: 016bd163 016be163 016bf163 01720163c0300dd0: 016e1163 016e2163 016e3163 016e4163c0300de0: 016e5163 016e6163 016e7163 016e8163c0300df0: 016e9163 016ea163 016eb163 016ec163c0300e00: 016ed163 016ee163 016ef163 016f0163c0300e10: 01765163 026f6163 05189163 055ab163c0300e20: 059ad163 0740f163 05a71163 05f43163c0300e30: 0090a163 0297e163 04867163 034ae163c0300e40:

00000300 00000300 00000300 00000300c0300e50: 00000300 00000300 00000300 00000300c0300e60: 00000300 00000300 00000300 00000300c0300e70: 00000300 00000300 01768163 01769163c0300e80: 0176a163 0176b163 0176c163 0176d163c0300e90: 0176e163 0176f163 01770163 01771163c0300ea0: 01772163 01773163 01774163 01775163c0300eb0: 01776163 01757163 01758163 01759163c0300ec0: 0175a163 0175b163 0175c163 0175d163c0300ed0: 0175e163 0175f163 017c0163 01781163c0300ee0: 01782163 01783163 01784163 01785163c0300ef0: 01786163 01787163 01788163 01789163c0300f00: 0178a163 01000163 01001163 01002163c0300f10: 01003163 01004163 01005163 01006163c0300f20: 01007163 01008163 01009163 0100a163c0300f30: 0100b163 0100c163 0100d163 0100e163c0300f40: 0100f163 01010163 01011163 01012163c0300f50: 01013163 01014163 01015163 01016163c0300f60: 01017163 01018163 01019163 0101a163c0300f70: 0101b163 0101c163 0101d163 0101e163c0300f80: 0101F163 01020163 01021163 01022163C0300F90: 01023163 01024163 01025163 01026163C0300FA0: 01027163 0 1028163 01029163 0102a163c0300fb0: 0102b163 0102c163 0102d163 0102e163c0300fc0: 0102f163 01030163 01031163 01032163c0300fd0: 01033163 01034163 01035163 01036163c0300fe0: 01037163 01038163 01039163 0103a163c0300ff0:

0103b163 0103c163 0103d163 00031163Compare the page directory of system process and the page directory of previous example. We can find the user address space corresponding PDEs (front 512 PDEs) of two processes are all not same, that means every process has its own independent user address space, each one maps to different physical memory. We can find the overwhelming majority of system address space corresponding PDEs (hind 512 PDEs) are same. Same PDE points to a same physical page, so the PDE corresponding page table is same, so the Corresponding address. That Means the overwhelming majority content of the two defesses in System Address Space Are Same.a Notepad Process'

sa page table: c0001000: 00000000 00000000 00000000 00000000c0001010: 00000000 00000000 00000000 00000000c0001020: 00000000 00000000 00000000 00000000c0001030: 00000000 00000000 0464f025 046dd025c0001040: 00000000 00000000 00000000 00000000c0001050: 00000000 00000000 00000000 00000000c0001060: 00000000 00000000 00000000 00000000c0001070: 00000000 00000000 00000000 00000000c0001080: 00000000 00000000 00000000 00000000c0001090 : 00000000 00000000 00000000 00000000c00010a0: 00000000 00000000 00000000 00000000c00010b0: 00000000 00000000 00000000 00000000c00010c0: 00000000 00000000 00000000 00000000c00010d0: 00000000 00000000 00000000 00000000c00010e0: 00000000 00000000 00000000 00000000c00010f0: 00000000 00000000 00000000 00000000c0001100: 00000000 00000000 00000000 00000000c0001110: 00000000 00000000 00000000 00000000c0001120: 00000000 00000000 00000000 00000000c0001130 00000000-00-00 0000-00 0000-00 0000 00000c0001160: 00000000 00000000 00000000 00000000c0001170: 00000000 00000000 00000000 00000000c0001180: 00000000 00000000 00000000 00000000c0001190: 00000000 00000000 00000000 00000000c00011a0: 00000000 00000000 00000000 00000000c00011b0: 00000000 00000000 00000000 00000000c00011c0: 00000000 00000000 00000000 00000000c00011d0: 00000000 00000000 00000000 00000000c00011e0: 00000000 00000000 00000000 00000000c00011f0: 00000000 00000000 00000000 00000000c0001200: 00000000 00000000 00000000 00000000c0001210: 00000000 00000000 00000000 00000000c0001220: 00000000 00000000 00000000 00000000c0001230: 00000000 00000000 00000000 00000000c0001240: 00000000 00000000 00000000 00000000c0001250: 00000000 00000000 00000000 00000000c0001260:

00000000 00000000 00000000 00000000c0001270: 00000000 00000000 00000000 00000000c0001280: 00000000 00000000 00000000 00000000c0001290: 00000000 00000000 00000000 00000000c00012a0: 00000000 00000000 00000000 00000000c00012b0: 00000000 00000000 00000000 00000000c00012c0: 00000000 00000000 00000000 00000000c00012d0: 00000000 00000000 00000000 00000000c00012e0: 00000000 00000000 00000000 00000000c00012f0: 00000000 00000000 00000000 00000000c0001300: 00000000 00000000 00000000 00000000c0001310: 00000000 00000000 00000000 00000000c0001320: 00000000 00000000 00000000 00000000c0001330: 00000000 00000000 00000000 00000000c0001340: 00000000 00000000 00000000 00000000c0001350: 00000000 00000000 00000000 00000000c0001360: 00000000 00000000 00000000 00000000c0001370: 00000000 00000000 00000000 00000000c0001380: 00000000 00000000 00000000 00000000c0001390: 00000000 00000000 00000000 00000000c00013a0: 0000000010000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000 0 0000000 00000000 00000000c00013d0: 00000000 00000000 00000000 00000000c00013e0: 00000000 00000000 00000000 00000000c00013f0: 00000000 00000000 00000000 00000000c0001400: 00000000 00000000 00000000 00000000c0001410: 00000000 00000000 00000000 00000000c0001420: 00000000 00000000 00000000 00000000c0001430: 00000000 00000000 00000000 00000000c0001440: 00000000 00000000 00000000 00000000c0001450: 00000000 00000000 00000000 00000000c0001460: 00000000 00000000 00000000 00000000c0001470: 00000000 00000000 00000000 00000000c0001480: 00000000 00000000 00000000 00000000c0001490: 00000000 00000000 00000000 00000000c00014a0: 00000000 00000000 00000000 00000000c00014b0: 00000000 00000000 00000000 00000000c00014c0:

00000000 00000000 00000000 00000000c00014d0: 00000000 00000000 00000000 00000000c00014e0: 00000000 00000000 00000000 00000000c00014f0: 00000000 00000000 00000000 00000000c0001500: 00000000 00000000 00000000 00000000c0001510: 00000000 00000000 00000000 00000000c0001520: 00000000 00000000 00000000 00000000c0001530: 00000000 00000000 00000000 00000000c0001540: 00000000 00000000 00000000 00000000c0001550: 00000000 00000000 00000000 00000000c0001560: 00000000 00000000 00000000 00000000c0001570: 00000000 00000000 00000000 00000000c0001580: 00000000 00000000 00000000 00000000c0001590: 00000000 00000000 00000000 00000000c00015a0: 00000000 00000000 00000000 00000000c00015b0: 00000000 00000000 00000000 00000000c00015c0: 00000000 00000000 00000000 00000000c00015d0: 00000000 00000000 00000000 00000000c00015e0: 00000000 00000000 00000000 00000000c00015f0: 00000000 00000000 00000000 00000000c0001600: 0000000010 000,000 000 000,000 000,0000000000000000000 00000000 0000-00 0000-00 0000-00 0000-00 0000-00-00 000000-00 0000-00 0000-00-00 0000 0000000 00000000 00000000c0001630: 00000000 00000000 00000000 00000000c0001640: 00000000 00000000 00000000 00000000c0001650: 00000000 00000000 00000000 00000000c0001660: 00000000 00000000 00000000 00000000c0001670: 00000000 00000000 00000000 00000000c0001680: 00000000 00000000 00000000 00000000c0001690: 00000000 00000000 00000000 00000000c00016a0: 00000000 00000000 00000000 00000000c00016b0: 00000000 00000000 00000000 00000000c00016c0: 00000000 00000000 00000000 00000000c00016d0: 00000000 00000000 00000000 00000000c00016e0: 00000000 00000000 00000000 00000000c00016f0: 00000000 00000000 00000000 00000000c0001700: 00000000 00000000 00000000 00000000c0001710: 00000000 00000000 00000000 00000000c0001720:

00000000 00000000 00000000 00000000c0001730: 00000000 00000000 00000000 00000000c0001740: 00000000 00000000 00000000 00000000c0001750: 00000000 00000000 00000000 00000000c0001760: 00000000 00000000 00000000 00000000c0001770: 00000000 00000000 00000000 00000000c0001780: 00000000 00000000 00000000 00000000c0001790: 00000000 00000000 00000000 00000000c00017a0: 00000000 00000000 00000000 00000000c00017b0: 00000000 00000000 00000000 00000000c00017c0: 00000000 00000000 00000000 00000000c00017d0: 00000000 00000000 00000000 00000000c00017e0: 00000000 00000000 00000000 00000000c00017f0: 00000000 00000000 00000000 00000000c0001800: 00000000 00000000 00000000 00000000c0001810: 00000000 00000000 00000000 00000000c0001820: 00000000 00000000 00000000 00000000c0001830: 00000000 00000000 00000000 00000000c0001840: 00000000 00000000 00000000 00000000c0001850: 00000000 00000000 00000000 00000000c0001860: 0000000010 聽 00000000000000000000000 0000000000 0000-00 0000-00 0000-00 0000-00 0000-00-00 000000 0000000 00000000 00000000c0001890: 00000000 00000000 00000000 00000000c00018a0: 00000000 00000000 00000000 00000000c00018b0: 00000000 00000000 00000000 00000000c00018c0: 00000000 00000000 00000000 00000000c00018d0: 00000000 00000000 00000000 00000000c00018e0: 00000000 00000000 00000000 00000000c00018f0: 00000000 00000000 00000000 00000000c0001900: 00000000 00000000 00000000 00000000c0001910: 00000000 00000000 00000000 00000000c0001920: 00000000 00000000 00000000 00000000c0001930: 00000000 00000000 00000000 00000000c0001940: 00000000 00000000 00000000 00000000c0001950: 00000000 00000000 00000000 00000000c0001960: 00000000 00000000 00000000 00000000c0001970: 00000000 00000000 00000000 00000000c0001980:

00000000 00000000 00000000 00000000c0001990: 00000000 00000000 00000000 00000000c00019a0: 00000000 00000000 00000000 00000000c00019b0: 00000000 00000000 00000000 00000000c00019c0: 00000000 00000000 00000000 00000000c00019d0: 00000000 00000000 00000000 00000000c00019e0: 00000000 00000000 00000000 00000000c00019f0: 00000000 00000000 00000000 00000000c0001a00: 00000000 00000000 00000000 00000000c0001a10: 00000000 00000000 00000000 00000000c0001a20: 00000000 00000000 00000000 00000000c0001a30: 00000000 00000000 00000000 00000000c0001a40: 00000000 00000000 00000000 00000000c0001a50: 00000000 00000000 00000000 00000000c0001a60: 00000000 00000000 00000000 00000000c0001a70: 00000000 00000000 00000000 00000000c0001a80: 01fd8067 00000000 00000000 00000000c0001a90: 00000000 00000000 00000000 00000000c0001aa0: 00000000 00000000 00000000 00000000c0001ab0: 00000000 00000000 00000000 00000000c0001ac0: 02ed9047 0000000 000 million 00000000000000000000000000 00000000 0000-00 0000-00 0000-00-00 0000-00 0000-00-00 0000-00 0000-00-00 0000-00 0000-00-00 0000-00 0000-00-00 0000 0000000 00000000 00000000c0001af0: 00000000 00000000 00000000 00000000c0001b00: 05d3c047 0243d047 006de047 0217f047c0001b10: 04f39047 0695a047 01c5b047 00000000c0001b20: 00000000 00000000 00000000 00000000c0001b30: 00000000 00000000 00000000 00000000c0001b40: 07596005 07597005 00000000 00000000c0001b50: 00000000 00000000 00000000 00000000c0001b60: 00000000 00000000 00000000 00000000c0001b70: 00000000 00000000 00000000 00000000c0001b80: 0272a047 00000000 00000000 00000000c0001b90: 00000000 00000000 00000000 00000000c0001ba0: 00000000 00000000 00000000 00000000c0001bb0: 00000000 00000000 00000000 00000000c0001bc0: 06825047 00000000 00000000 00000000c0001bd0: 00000000 00000000 00000000 00000000c0001be0:

00000000 00000000 00000000 00000000c0001bf0: 00000000 00000000 00000000 00000000c0001c00: 00000000 00000000 00000000 00000000c0001c10: 00000000 00000000 00000000 00000000c0001c20: 00000000 00000000 00000000 00000000c0001c30: 00000000 00000000 00000000 00000000c0001c40: 00000000 00000000 00000000 00000000c0001c50: 00000000 00000000 00000000 00000000c0001c60: 00000000 00000000 00000000 00000000c0001c70: 00000000 00000000 00000000 00000000c0001c80: 00000000 00000000 00000000 00000000c0001c90: 00000000 00000000 00000000 00000000c0001ca0: 00000000 00000000 00000000 00000000c0001cb0: 00000000 00000000 00000000 00000000c0001cc0: 00000000 00000000 00000000 00000000c0001cd0: 00000000 00000000 00000000 00000000c0001ce0: 00000000 00000000 00000000 00000000c0001cf0: 00000000 00000000 00000000 00000000c0001d00: 00000000 00000000 00000000 00000000c0001d10: 00000000 00000000 00000000 00000000c0001d20: 00000000 000,000 00 000 000 000 00000000 0000000 0000000 000,000000 0001D40: 00000000 0 0000000 00000000 00000000c0001d50: 00000000 00000000 00000000 00000000c0001d60: 00000000 00000000 00000000 00000000c0001d70: 00000000 00000000 00000000 00000000c0001d80: 00000000 00000000 00000000 00000000c0001d90: 00000000 00000000 00000000 00000000c0001da0: 00000000 00000000 00000000 00000000c0001db0: 00000000 00000000 00000000 00000000c0001dc0: 04daf047 03c90047 05ba1047 03de2047c0001dd0: 00000000 00000000 00000000 00000000c0001de0: 00000000 00000000 00000000 00000000c0001df0: 00000000 00000000 00000000 00000000c0001e00: 00ef1047 052d2047 05573047 065f4047c0001e10: 01c55047 03a56047 03457047 045b8047c0001e20: 076d9047 037ba047 04f3b047 0347c047c0001e30: 033dd047 05a1e047 01dbf047 02220047c0001e40:

00000000 00000000 00000000 00000000c0001e50: 00000000 00000000 00000000 00000000c0001e60: 00000000 00000000 00000000 00000000c0001e70: 00000000 00000000 00000000 00000000c0001e80: 00000000 00000000 00000000 00000000c0001e90: 00000000 00000000 00000000 00000000c0001ea0: 00000000 00000000 00000000 00000000c0001eb0: 00000000 00000000 00000000 00000000c0001ec0: 00000000 00000000 00000000 00000000c0001ed0: 00000000 00000000 00000000 00000000c0001ee0: 00000000 00000000 00000000 00000000c0001ef0: 00000000 00000000 00000000 00000000c0001f00: 00000000 00000000 00000000 00000000c0001f10: 00000000 00000000 00000000 00000000c0001f20: 00000000 00000000 00000000 00000000c0001f30: 00000000 00000000 00000000 00000000c0001f40: 00000000 00000000 00000000 00000000c0001f50: 00000000 00000000 00000000 00000000c0001f60: 00000000 00000000 00000000 00000000c0001f70: 00000000 00000000 00000000 00000000c0001f80: 00000000100000000000000000000000000000 000000000000 0000000000 0000-00 0000-00 0000000 00000000 00000000c0001fb0: 00000000 00000000 00000000 00000000c0001fc0: 00000000 00000000 00000000 00000000c0001fd0: 00000000 00000000 00000000 00000000c0001fe0: 00000000 00000000 00000000 00000000c0001ff0: 00000000 00000000 00000000 00000000PTE is 0x00000000, means that corresponding 4KB address space mapped nothing.3.4 7 Kinds of ConversionWe can do 7 kinds of conversion as following.1 virtual address -> virtual address of the virtual address corresponding PDEUsing bit31-bit22 this 10 bits of virtual address as index, find the virtual address of the corresponding PDE in page directory The base address of page directory is 0xC0300000,. The size of pde is 4b.pdeva = (VA >> 22) * 4 0xc03000002 Virtual Address ->

virtual address of the virtual address corresponding PTEPage tables are orderly mapped in address space, so using bit31-bit22 this 10 bits of virtual address as index, find the virtual address of the corresponding page table in page tables. Using bit21-bit12 this 10 bits of virtual address as index, find the virtual address of the corresponding PTE in the page table The base address of page tables is 0xC0000000, the size of PTE is 4B.PteVa = (Va >> 12) * 4 0xC00000003 virtual address. - > physical addressIf virtual address above or equal to 0x80000000 and below 0xa0000000, that means the virtual address is in LargePage part, then virtual addres minus 0x80000000 is the physical address.Otherwise, calculate the corresponding virtual address of PDE and PTE, get the corresponding PDE And PTE, IF CORRESPONDING PDE AND PTE ARE Both Valid, The Use the Corresponding Pte's Bit31-Bit12 This 20 Bits As Physical Address's Bit31-Bit12 This 20 Bits, Use the Virtual Address's Bit11-Bit0 this 12 bit s as physical address's bit11-bit0 this 12 bits, so we get the corresponding physical address.4 virtual address of PDE -> PDE corresponding address space rangeA PDE corresponding address space range is 4MB.VaStart = ((PdeVa - 0xC0300000) / 4) << 22VaEnd = VaStart 0x004000005 virtual address of PTE -> PTE corresponding address space rangea PTE corresponding address space range is 4KB.VaStart = ((PteVa - 0xC0000000) / 4) << 12VaEnd = VaStart 0x000010006 virtual address of PTE ->

virtual address of corresponding PDEAccording to the virtual address of PTE, we can calculate corresponding address space range, according to any virtual addres in the range, we can calculate the virtual address of the virtual address corresponding PDE.7 virtual address of PDE -> virtual address range of corresponding PTEsAccording to the virtual address of PDE, we can calculate corresponding address space range, according to the range, we can calculate the virtual address range of corresponding PTEs.4 Invalid Page - Hardware Part4.1 Page-Fault ExceptionAccessing a virtual address, the virtual address corresponding PDE, PTE are all valid, according to the corresponding PDE PTE, CPU automatically translates the virtual address to physical address, and completes the accessing. Accessing a virtual address, the virtual address corresponding PDE or PTE is invalid, Will Generate A page-fault Exception. CPU Directs to Execute The Exception Handler Procedure, The Exception Handler Procedure DO es corresponding disposal, such as, for the page of accessing virtual address is in a file on disk, load the page in file into a physical page, make the corresponding PTE point to the physical page, and set the corresponding PTE valid. When execution of the exception handler is complete, CPU re-executes the instruction that generated the exception, and this time the virtual address that the instruction accessed has mapped to physical memory, and corresponding PDE, PTE are all valid, the instruction can be completed.Exception Is A Interrupt Called "Exception"

. When a exception occurs, using the exception corresponding interrupt vector, CPU finds the corresponding interrupt descriptor in interrupt descriptor table. The interrupt descriptor holds the entry address of exception handler procedure. CPU automatically save some registers on the stack, including EIP where stored the address of the faulting instruction, then directs to the exception handler procedure. The execution of the exception handler is complete with a IRET instruction. When the IRET instruction is executed, CPU will re-execute the faulting instruction according to the faulting instruction address which is saved on the stack The main difference between exception and interrupt called "interrupt" is:.. when a exception occurs, a error code will be pushed on the stack, when a interrupt occurs, no error code will be pushed on the stack CPU can DISTINGUISH BETWEEN Exception or Interrupt by Examing The High 4-Byte '

S BIT10-BIT8 THIS 3 BITS OF INTERRUPT DESCRIPTOR, THIS 3 BITS OF A Interrupt IS 110, THIS 3 BITS OF A Exception IS 111.THE Interrupt Vector of Page-Fault Exception IS 0xE (0N14). It is defined by CPU That interrupt vector of Page-Fault exception is 0xe, for x86 cpu, interrupt vector 0-31, this 32 interrupts are defined by CPU. When a Page-Fault exception occurs, a error code will be saved on the stack, bit0 of error code indicates the fault is caused by an invalid page or by a page-level protection violation, bit1 of error code indicates the access causing the fault is a read or a write. The EIP saved on the stack is the faulting instruction address. The content of the CR2 register is the virtual address that generated the exception 5 Invalid Page -. Software Part5.1 Page-Fault HandlerA PTE is valid, the corresponding page address space is mapped to a physical page, access in the page of address space, won ' T Cause A page-fault Exception. a Pte IS Invalid, The Corresponding Page Add ress space are 4 cases, the content of the page is in a transition physical page, the content of the page is in a mapped file, the content of the page is in a pagefile swap file, the content of the page is nothing, access in the page address space, will cause a Page-Fault exception. For different cases, PTE has different structure definition.The content of page is in a transition state physical page, the content of the page can be out swapped from physical page into file And Hasn '

t been out swapped, it is in a transition state. The higher 20 bits of the invalid PTE is still a physical frame number, the physical page is just the physical page that was pointed by the PTE when PTE was valid, and the content of the physical page has not been modified, is still the content when the PTE was valid. For this case Page-Fault exception handler, only need set the corresponding invalid PTE valid.The content of page is in a mapped file, the corresponding content in mapped file is the backup of the corresponding page in address space. There are two kinds of mapped file, one is called "ImageFileMap", one is called "DataFileMap". ImageFileMap include mapping of process's .exe executable file, mapping of process's loaded. dll dynamic link library file. DataFileMap, mapping that call CreateFileMapping API to load the file into memory. Every process loads process's .exe executable file and process's .dll dynamic link library files to memory by ImageFileMap. Invalid PTE contains t he information to find the corresponding content in file, every file-mapping has a set of relative structures, which keeps some relative information, such as file's handle, structures to implement sharing between processes. The corresponding content in the file can be found by invalid PTE and relative structures of file-mapping. For this case Page-Fault exception handler, according to invalid PTE and relative structures of file-mapping, find the content of a corresponding page in the corresponding file, read the content of the page into a Physical Page, And Set The Corresponding Invalid Pte To Point To The Physical Page and Valid.The Content of Page, Process'

s some data pages which are out swapped from physical memory, are backed in PageFile swap file. In windows 2000, file "pagefile.sys" is the PageFile swap file. Many pages may be out swapped into PageFile, such as, thread's kernel mode stack, pages in user address space except for file-mapping, process's page tables, pages in PagedPool in system address space, etc. Pages in user address space except for file-mapping, such as, process's heap, thread's user mode stack, process environment block, thread environment block, etc. Invalid PTE contains the information to find a certain page in a certain PageFile swap file, every PageFile swap file has a set of relative structures (note, relative structures of PageFile are utterly different from relative structures of file-mapping), which keeps some relative information, such as which pages in PageFile have been used, which pages have not been used. The out swapped content in PageFile can be found by invalid PTE and relative structures of PageF ile. For this case Page-Fault exception handler, according to invalid PTE and relative structures of PageFile, find the content of a corresponding page in a certain PageFile, read the content of the page into a physical page, and set the corresponding invalid PTE TO POINT to the Physical Page And Valid.all Bits of A Pte Are 0, Means That there '

s nothing in this page address space.5.2 Difference between Different Type Invalid PTEThe bit10 of invalid PTE is Prototype flag bit. For Prototype flag bit is equal to 0 case, bit11 is Transition flag bit.Prototype flag bit is equal to 1, invalid PTE is Prototype PTE, is used for the content of the page is in a mapped file case.Prototype flag bit is equal to 0, Transition flag bit is equal to 0, invalid PTE is used for the content of the page is in a PageFile swap file case.Prototype flag bit is equal to 0, Transition flag bit is equal to 1, invalid PTE is used for the content of the page is in a transition state physical page case.6 Some Answers6.1 why the size of address space is 4GB? 32-bit CPU determines that the size of address (pointer) which used very ofen in codes is 32-bit. 32-bit address (pointer) can address 0x00000000-0xFFFFFFFF, the addressing unit is byte, so the size of address Space is 4GB.6.2 Efficiency of Address TranslationWhen Using Paging, All Address of Memory OPE ration are virtual address, CPU will automatically translate it to physical address, you can image that there would be huge amounts of address translation, to translate a single virtual address, CPU need to read page directory, read page table, at last read or write in physical page. So for improving speed and efficiency of address translation, Windows 2000 puts some PDE and PTE in cache. A on-chip cache called TLB (Translation Look-Aside Buffer) is used to store most recently used PDE and PTE, it reduces huge amounts of reading page directory and page table from physical memory in address translation.6.3 WHY the address of page directory is 0xC0300000, WHY 1 page directory and 1024 page tables only use 1024 * 4KB address space?

To map the entire 4GB address space, needing 1024 page tables and 1 page directory, every one is 4KB, 1024 * 4KB 1 * 4KB = 4MB 4KB. But in fact Windows 2000 maps every process's page directory and page tables into 0xC0000000- 0xC03FFFFF, this 4MB address space (page directory is in the 4KB address space beginning from 0xC0300000) .1024 page tables and 1 page directory should need (1024 1) * 4KB address space, why Windows 2000 only use 1024 * 4KB address space? The reason is page tables are mapped into process's address space.If page tables and page directory have not been mapped in process's address space and a process's 4GB address space are all mapped to physical memory, then do need 1024 physical pages to hold page tables And Another 1 Physical, That Needs (1024 1) * 4KB Physical Mapped. But Page Tables Are Mapped in Process'

s address space, this results in the content of a page table and the content of page directory being completely same, just this completely same causes that 1024 page tables and 1 page directory only need 1024 * 4KB address space, one of page tables and page directory is completely overlap.A page table has 1024 entries, every entry maps 4KB address space, a page table maps 4MB address space. 1024 page tables maps entire 4GB address space. 1024 page tables are mapped in 0xC0000000-0xC03FFFFF this 4MB address space. This 4MB address space is mapped by a page table. The page table to map 0xC0000000-0xC03FFFFF this 4MB address space, has 1024 PTEs to map every page in 0xC0000000-0xC03FFFFF this 4MB address space, every page in 0xC0000000-0xC03FFFFF this 4MB address space is a page table, so every PTE of that page table is PDE, and that page table is page directory. Mapping 1024 page tables into address space, results in one of page tables and page directory being completely overlap, it is pag e directory and also page table. So 1 page directory and 1024 page tables only need 1024 * 4KB address space.Where the page tables are mapped in address space, is decided by the operating system's designers. They will think about various problems and make the last decision. But if the address of page tables are determined, then the address of page directory has been determined, unless they intend to use one more page address space to keep the same content of one current page.In windows 2000, page tables are Mapped Into 0xC0000000-0XC03FFFFF this 4MB Address Space, Let '

s calculate the address of this 4MB address space corresponding page table, which is the page table overlapped with page directory. 0xC0000000 is obviously mapped by the first PTE of that page table. PteVa = (Va >> 12) * 4 0xC0000000, ( 0xC0000000 >> 12) * 4 0xC0000000 = 0xC0000 * 4 0xC0000000 = 0x300000 0xC0000000 = 0xC0300000, it's right the virtual address of page directory.We can also see, the physical frame number of the 4 bytes at 0xC0300C00 is equal to the physical frame number of register CR3.0xC0300000-0xC0300FFF this 4KB as a normal page, the corresponding PTE, PteVa = (Va >> 12) * 4 0xC0000000, is 0xC0300C00. That means the 4 bytes at 0xC0300C00 as a PTE, contains the physical frame number of 0xC0300000-0xC0300FFF this page mapped physical page.0xC0300000-0xC0300FFF this 4KB as a page table, the corresponding PDE, PdeVa = (Va >> 22) * 4 0xC0300000, is 0xC0300C00. That means the 4 bytes at 0xC0300C00 AS A PDE, Contains the Physical Frame Number of 0xc0300000-0XC0300FFF this Pa ge table mapped physical page.0xC0300000-0xC0300FFF this 4KB as a page directory, CR3 contains the physical address of the physical page.So the physical frame number of the 4 bytes at 0xC0300C00 is equal to the physical frame number of register CR3.6.4 Physical Memory Needed by Process's Page Directory and Page TablesProcess need physical pages to hold page directory and page tables, if there are 1024 page tables, then need 1024 * 4KB = 4MB physical memory. Does every process need 4MB physical memory to keep just page table information ? IT really doesn't. If The Valid Flag Bit of a PDE IS 0, THE CORRESPONDING Page Table Doesn '

转载请注明原文地址:https://www.9cbs.com/read-129829.html

New Post(0)