image/svg+xml Xen Xen Virtual 0x80000000(2GB, KERNBASE) I/O Space Kernel text 0xe000000(PHYSTOP)234MB Kernel R/W data 0xfe000000 0xffffffff I/O Space 0 4GB User-memory Kernel-memory 2GB free nenory(alloc()) end KERNBASE + 0x10000000 2GB Xen Xen Virtual 0x80000000(2GB, KERNBASE) I/O Space Kernel text 0xe000000(PHYSTOP)234MB Kernel R/W data 0xfe000000 0xffffffff I/O Space 0 4GB User-memory Kernel-memory 2GB free nenory(alloc()) end KERNBASE + 0x10000000 2GB Processtext Processdata Processstack GuardPage Processheap 4K (one page) 4K (one page) Xen Xen Xen Xen Virtual 0x80000000(2GB, KERNBASE) I/O Space Kernel text 0xe000000(PHYSTOP)234MB Kernel R/W data 0xfe000000 0xffffffff I/O Space 0 4GB User-memory Kernel-memory 2GB free nenory(alloc()) end KERNBASE + 0x10000000 2GB Processtext Processdata Xen Physical 0xe000000(PHYSTOP)234MB Top of physical memory 0 Ununsed by xv6 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 Xen I/O Space Kernel text Kernel R/W data Xen Xen Xen Xen Virtual 0x80000000(2GB, KERNBASE) I/O Space Kernel text 0xe000000(PHYSTOP)234MB Kernel R/W data 0xfe000000 0xffffffff I/O Space 0 4GB User-memory Kernel-memory 2GB free nenory(alloc()) end KERNBASE + 0x10000000 2GB Processtext Processdata Xen Xen Xen read program code and data Xen Xen Xen Xen Virtual 0x80000000(2GB, KERNBASE) I/O Space Kernel text 0xe000000(PHYSTOP)234MB Kernel R/W data 0xfe000000 0xffffffff I/O Space 0 4GB Kernel-memory 2GB free nenory(alloc()) end KERNBASE + 0x10000000 Xen Physical 0xe000000(PHYSTOP)234MB Top of physical memory 0 Ununsed by xv6 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 Xen I/O Space Kernel text Kernel R/W data Xen Xen Stack Guard Xen Xen Processdata Processtext Xen Process 1 (ls) Xen Memory Process 2 (ls) Xen x x + baseP1 baseP1 baseP2 x x + baseP2 Xen Process 1 (ls) Xen Memory Process 2 (ls) x x Xen Process 1 (ls) Xen Memory Process 2 (ls) Xen x x + baseP1 baseP1 baseP2 x x + baseP2 Xen Process 1 (ls) Xen Memory Process 2 (ls) Xen malloc() = x x + baseP1 baseP1 baseP2 x x + baseP2 Xen Process 1 (ls) Xen Memory Process 2 (ls) Xen malloc() = x x + baseP1 baseP1 baseP2 x x + baseP2 Xen Process 1 (ls) Xen Memory Process 2 (ls) malloc() = Xen x + baseP2 x x + baseP1 baseP1 baseP2 x x + baseP2 Or even swap it out(move to disk) Xen Process 1 (ls) Xen Memory Process 2 (ls) Xen malloc() = Xen x + baseP2 x x + baseP1 baseP1 baseP2 x x + baseP2 move P2(copy it's memory) Xen Xen Xen Physical Virtual 0 0 4GB Xen Xen Xen Xen Xen User 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 ... 0 - 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 Process 1 (ls) Xen Memory Process 2 (ls) Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen x x Xen Process 1 (ls) Xen Memory Process 2 (ls) Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen x x ... 0 - 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 Process 1 (ls) Xen Memory Process 2 (ls) Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Xen Shared code (ls) Xen Xen Xen Xen Xen ... 0 1 Xen 2 Virtual Address Space (or Memory)of the Process ... ... 0 1 2 3 4 5 6 7 1023 ... Level 1 (Page Table Directory) 7 Level 2(Page Table) ... ... 0 1 2 3 4 5 6 7 1023 ... 12 Page ... ... 0 4 8 12 16 20 24 4092 ... 55 Xen 00 0000 0101 00 0000 0011 0000 0000 0001 mov (%EBX), EAX # mov value from the location pointed by EBX into EAXEAX = 0 EBX = 20 983 809 20 983 809 = Xen page number = 5123 or (0b1 0100 0000 0011) page number 1M (1,048,575) Xen Physical Memory Xen Xen Xen Xen Xen Xen Xen Xen 0 1 2 3 4 5 6 7 8 9 10 11 12 CR3 = 0 32 bits (4 bytes)