-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathanswer.txt
53 lines (48 loc) · 2.47 KB
/
answer.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Exercise3.Question1.
It casts a char pointer to x, since the physical address can not be dereference, the x should be uintptr_t type.
Question2.
---------------------------------------------------------
| Entry | BVA | Point to (logically) |
---------------------------------------------------------
| 1023 | 0xFFC00000 |pt for top 4MB of phys mem |
---------------------------------------------------------
| 1022 | 0XFF800000 |pt for 2nd top 4MB of phys mem |
---------------------------------------------------------
| . | | |
---------------------------------------------------------
| 960 | 0XF0000000 | PHYSMEM: all phys memory |
---------------------------------------------------------
| 959 | 0xEFC00000 | KSTACK |
---------------------------------------------------------
| 958 | 0xEF800000 | KSTACK: kernel stack |
---------------------------------------------------------
| 957 | 0xEF400000 | UPAGES |
---------------------------------------------------------
| 956 | 0xEF000000 | UPAGES: RO PAGES |
---------------------------------------------------------
| . | | |
---------------------------------------------------------
| 2 | 0x00800000 | UTEXT: Program Data & Heap |
---------------------------------------------------------
| 1 | 0x00400000 | UTEMP: empty memory |
---------------------------------------------------------
| 0 | 0x00000000 | [see next question] |
---------------------------------------------------------
Question3.
Each time when the program wants to enter the next level page table, the program will check the permission code of the current value. If failed, the method will exix, otherwise go on.
Question4.
256MB
# PGSIZE = 4096 = 4k
# PDX(KERNBASE) = 0x3c0
# NPTENTRIES = PGSIZE/WORDSIZE = 1k = 0x400
# PTSIZE = PGSIZE * NPENTRIES = 4k * 1k = 4MB
# MEM = PGSIZE*ENTRIES = PTSIZE*(NPTENRIES-PDX(KERNBASE)) = 256MB
Question5.
4MB + 4KB
# HEADOVER = PGSIZE * (NPTENTRIES + 1) = 4096 * 1025
Question6.
At the the following code, %eip jump up above KERNBASE
movl $relocated, %eax
jmp *%eax
the low address and high address correspoding to the same virtual address.
After setting the page, low address in disabled, and the eip will not find the correct address if not jump up.