image/svg+xml Xen Xen Xen Physical Virtual 0x80000000(2GB, KERNBASE) 0x100000(EXTMEM, or KERNLINK) I/O Space Kernel text + R/O data 0x109000(data) 0xe000000(PHYSTOP)234MB Kernel R/W data + free memory Xen 0xfe000000 0xffffffff I/O Space 512MB 0 0 4GB User-memory Kernel-memory 2GB 2GB Unused by xv6 Xen 0 - 4MB 0x0 ... 2GB - 2GB + 4MB ... Page table(entrypgdir) ESP: stack SS : 0x10 EIP: main CS : 0x8 IDT: 0x0 GDT: 0x7c78 TSS: 0x0 Protected Mode CR3: entrypgdir Xen Xen Physical Virtual 0x80000000(2GB, KERNBASE) 0x100000(EXTMEM, or KERNLINK) I/O Space Kernel text + R/O data 0x109000(data) 0xe000000(PHYSTOP)234MB Kernel R/W data + free memory Xen 0xfe000000 0xffffffff I/O Space 512MB 0 0 4GB 0x400000 0x80100000 4MB 4MB 4MB Xen Kernel Kernel end 0x80400000 0x100000 Xen Xen Xen Physical Virtualof Process 1 0xe000000(PHYSTOP)234MB Top of physical memory 0 0 4GB Process 1 Xen Xen Xen Xen Xen User memory (2GB) Kernel memory (2GB) Xen Xen Xen Xen Ununsed by xv6 Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen 0 Process 2 Xen Xen Xen Xen Xen Xen Xen Xen Xen Virtualof Process 2 Xen Xen Xen Xen Xen ... 0 - 4MB ... 2GB - 2GB + 4MB 4 - 8MB Page tableLevel 1 Level 2 ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4MB ... 2GB - 2GB + 4MB 4 - 8MB Page tableLevel 1 Level 2 ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB Page TableProcess 1 Page TableProcess 2 Xen Xen Xen Physical Virtual 0x80000000(2GB, KERNBASE) 0xe000000(PHYSTOP)234MB Top of physical memory 0 0 4GB Process 1 Xen Xen Xen Xen Xen User memory (2GB) Kernel memory (2GB) Xen Xen Xen Xen Ununsed by xv6 Xen Xen Xen Xen Xen Xen Xen Xen Xen ... 0 - 4MB ... 2GB - 2GB + 4MB 4 - 8MB Page tableLevel 1 Level 2 ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB Xen Xen Xen Physical Virtual 0 0 4GB Process 1 Xen Xen Xen Xen Xen User can access (2GB) Kernel can access (4GB) Xen Xen Xen Xen Ununsed by xv6 Xen Xen Xen Xen Xen Xen Xen Xen Xen ... 0 - 4MB ... 2GB - 2GB + 4MB 4 - 8MB Page tableLevel 1 Level 2 ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB Xen 4GB Linear 0 Kernel Code Kernel Data Xen User Code User Data NULL: 0x0 KCODE: DPL=0, 0 - 4GB KDATA: DPL=0, 0 - 4GB CODE: DPL=3, 0 - 4GB K_CPU: DPL=0, 4 bytes TSS: sizeof(ts) DATA: DPL=3, 0 - 4GB GDT User bit = 1 User bit = 0 User bit = 1 User bit = 0 Xen Xen Xen Physical Virtual 0 0 4GB Xen Xen Xen Xen Xen User memory (2GB) Kernel memory (2GB) Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen ... 0 - 4MB ... 2GB - 2GB + 4MB 4 - 8MB Page tableLevel 1 Level 2 ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB ... 0 - 4K 4K - 8K ... (4MB-4K) - 4MB Xen 4GB Linear 0 Kernel Code Kernel Data Xen User Code User Data NULL: 0x0 KCODE: DPL=0, 0 - 4GB KDATA: DPL=0, 0 - 4GB CODE: DPL=3, 0 - 4GB K_CPU: DPL=0, 4 bytes TSS: sizeof(ts) DATA: DPL=3, 0 - 4GB GDT Xen 0 - 4MB 0x0 ... 2GB - 2GB + 4MB ... Page table(entrypgdir) ESP: stack SS : 0x10 EIP: main CS : 0x8 IDT: 0x0 GDT: 0x7c78 TSS: 0x0 Protected Mode CR3: entrypgdir Xen Xen Physical Virtual I/O Space Kernel text + R/O data Kernel R/W data + free memory Xen I/O Space 0 0 Xen Kernel Kernel ... ... v PDX PTX Page tableDirectory p ... ... Page tableLevel 2 Xen 0 - 4MB 0x0 ... 2GB - 2GB + 4MB ... Page table(entrypgdir) ESP: stack SS : 0x10 EIP: main CS : 0x8 IDT: 0x0 GDT: 0x7c78 TSS: 0x0 Protected Mode CR3: entrypgdir Xen Xen Physical Virtual I/O Space Kernel text + R/O data Kernel R/W data + free memory Xen I/O Space 0 0 Xen Kernel Kernel ... ... v PDX PTX Page tableDirectory p Xen 0 - 4MB 0x0 ... 2GB - 2GB + 4MB ... Page table(entrypgdir) ESP: stack SS : 0x10 EIP: main CS : 0x8 IDT: 0x0 GDT: 0x7c78 TSS: 0x0 Protected Mode CR3: entrypgdir Xen Xen Physical Virtual I/O Space Kernel text + R/O data Kernel R/W data + free memory Xen I/O Space 0 0 Xen Kernel Kernel ... ... v PDX PTX Page tableDirectory p ... ... Page tableLevel 2 pgtab = alloc() Xen 0 - 4MB 0x0 ... 2GB - 2GB + 4MB ... Page table(entrypgdir) ESP: stack SS : 0x10 EIP: main CS : 0x8 IDT: 0x0 GDT: 0x7c78 TSS: 0x0 Protected Mode CR3: entrypgdir Xen Xen Xen Physical Virtual I/O Space Kernel text + R/O data Kernel R/W data + free memory Xen I/O Space 0 0 Xen Kernel Kernel ... ... v +4K PDX PTX Page tableDirectory p+4K ... ... Page tableLevel 2 Xen Xen 0 - 4MB 0x0 ... 2GB - 2GB + 4MB ... Page table(entrypgdir) ESP: stack SS : 0x10 EIP: main CS : 0x8 IDT: 0x0 GDT: 0x7c78 TSS: 0x0 Protected Mode CR3: entrypgdir Xen Xen Xen Physical Virtual I/O Space Kernel text + R/O data Kernel R/W data + free memory Xen I/O Space 0 0 Xen Kernel Kernel ... ... v PDX PTX Page tableDirectory p = p | mode ... ... Page tableLevel 2 Xen