|
|
@@ -2,13 +2,13 @@
|
|
2
|
2
|
|
|
3
|
3
|
### Warmup
|
|
4
|
4
|
|
|
5
|
|
-| VA Number | Virtual Adress | Physical Adress | Valid |
|
|
6
|
|
-| --------- | :----------------- | ----------------------- | ----- |
|
|
7
|
|
-| VA 0 | 0x11 --> 0010001 | **00**0010001 --> 0x11 | YES |
|
|
8
|
|
-| VA 1 | 0x6c --> 1101100 | **11**1101100 --> 0x1ec | YES |
|
|
9
|
|
-| VA 2 | 0x61 --> 1100001 | **11**1100001 --> 0x1e1 | NO |
|
|
10
|
|
-| VA 3 | 0x20 --> 0100000 | **00**100000 --> 0x1e1 | NO |
|
|
11
|
|
-| VA 4 | 0x3f --> 0111111 | **00**111111 --> 0x1e1 | NO |
|
|
|
5
|
+| VA Number | Virtual Adress | Physical Adress | Valid |
|
|
|
6
|
+| --------- | :----------------- | ------------------- | ----- |
|
|
|
7
|
+| VA 0 | 0x11 --> 0010001 | 000010001 --> 0x011 | YES |
|
|
|
8
|
+| VA 1 | 0x6c --> 1101100 | 111101100 --> 0x1ec | YES |
|
|
|
9
|
+| VA 2 | 0x61 --> 1100001 | 111100001 --> 0x1e1 | NO |
|
|
|
10
|
+| VA 3 | 0x20 --> 0100000 | 00100000 --> 0x020 | NO |
|
|
|
11
|
+| VA 4 | 0x3f --> 0111111 | 00111111 --> 0x03f | NO |
|
|
12
|
12
|
|
|
13
|
13
|
|
|
14
|
14
|
|
|
|
@@ -29,9 +29,11 @@
|
|
29
|
29
|
|
|
30
|
30
|
## Questions
|
|
31
|
31
|
|
|
32
|
|
-1. Die höchste erlaubte Adresse in Segment 0 ist 0x00000020. Die niedrigste valide Addresse des Segments 1 ist 0x000001ec. Um zu testen ob das stimmt kann mann alle validen Adressen des ersten Segments UND Adressen über dem Limit
|
|
|
32
|
+1. Die höchste erlaubte Adresse in Segment 0 ist 0x00000013. Die niedrigste valide Addresse des Segments 1 ist 0x000001ec. Die niedrigste illegale Adresse ist 0x0000014 und die höchste illegale Adresse ist 0x000001eb im gesamten Adressraum. Um zu testen ob das stimmt kann mann alle validen virtuellen Adressen der Segmente UND jeweils (mindestens) eine über dem Limit mit `-A` angeben.
|
|
33
|
33
|
|
|
34
|
|
- `-A 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127`
|
|
|
34
|
+ `-A 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,`
|
|
|
35
|
+
|
|
|
36
|
+ `106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127`
|
|
35
|
37
|
|
|
36
|
38
|
|
|
37
|
39
|
2. Der Aufruf muss wie folgt aussehen:
|
|
|
@@ -44,31 +46,39 @@
|
|
44
|
46
|
|
|
45
|
47
|
Segment 1 nimmt die Adressen 14 und 15 an
|
|
46
|
48
|
|
|
47
|
|
-3. Man sollte das Limit `-l` so wählen, dass es 90% der Adressen des Adressraums `-a` abdeckt. Dann werden die restliche 10% über das gesetzte Limit gehen und einen Segmentation Fault auslösen.
|
|
|
49
|
+3. Man sollte das Limit `-l` so wählen, dass es 90% der Adressen des Adressraums `-a` abdeckt. Dann werden die restlichen 10% der virtuellen Adressen über das gesetzte Limit gehen und einen Segmentation Fault auslösen.
|
|
|
50
|
+
|
|
|
51
|
+4. Man setzt die Limits der Segmente mit `-l 0` auf 0, dann ist keine virtuelle Adresse valide.
|
|
48
|
52
|
|
|
49
|
|
-4. Man setzt die Limits der Segmente auf 0, dann ist keine virtuelle Adresse valide.
|
|
|
53
|
+5. Im folgenden wird VA für virtuelle Adresse und PA für physikalische Adresse benutzt.
|
|
50
|
54
|
|
|
51
|
|
-5. `Segment 0: 0x0000 bis 0x0040`
|
|
|
55
|
+ `Segment 0: 0x0000 bis 0x0040`
|
|
52
|
56
|
|
|
53
|
57
|
`Segment 1: 0x0380 bis 0x0400`
|
|
54
|
58
|
|
|
55
|
|
- | VA Nr. | Virtual Address | Physical Address HEX | PA DEC |
|
|
56
|
|
- | ------ | --------------- | -------------------- | ------ |
|
|
57
|
|
- | 0 | 0x0000005c | | |
|
|
58
|
|
- | 1 | 0x00000011 | | |
|
|
59
|
|
- | 2 | 0x00000043 | | |
|
|
60
|
|
- | 3 | 0x00000021 | | |
|
|
61
|
|
- | 4 | 0x0000006c | | |
|
|
62
|
|
- | 5 | 0x0000007a | | |
|
|
63
|
|
- | 6 | 0x00000050 | | |
|
|
64
|
|
- | 7 | 0x00000037 | | |
|
|
65
|
|
- | 8 | 0x000000ff | | |
|
|
66
|
|
- | 9 | 0x000000e9 | | |
|
|
67
|
|
- | 10 | 0x00000001 | | |
|
|
68
|
|
- | 11 | 0x0000014c | | |
|
|
69
|
|
- | 12 | 0x000000b4 | | |
|
|
70
|
|
- | 13 | 0x000000cf | | |
|
|
71
|
|
- | 14 | 0x0000012b | | |
|
|
72
|
|
- | 15 | 0x00000084 | | |
|
|
73
|
|
-
|
|
74
|
|
-
|
|
|
59
|
+ Höchste VA **0x16C** -> (mappt auf) höchste PA **0x400**
|
|
|
60
|
+
|
|
|
61
|
+ 1024 - 364 = 660 (Segment 1 Offset)
|
|
|
62
|
+
|
|
|
63
|
+ | VA Nr. | VA HEX | VA BIN | Physical Address HEX | PA DEC |
|
|
|
64
|
+ | ------ | ---------- | --------------- | ---------------------- | :----: |
|
|
|
65
|
+ | 0 | 0x0000005c | 00\|1011100 | Segmentation Violation | - |
|
|
|
66
|
+ | 1 | 0x00000011 | 00\|0010001 | **0x00000011** | 17 |
|
|
|
67
|
+ | 2 | 0x00000043 | 00\|1000011 | Segmentation Violation | - |
|
|
|
68
|
+ | 3 | 0x00000021 | 00\|0100001 | **0x00000021** | 33 |
|
|
|
69
|
+ | 4 | 0x0000006c | 00\|1101100 | Segmentation Violation | - |
|
|
|
70
|
+ | 5 | 0x0000007a | 00\|1111010 | Segmentation Violation | - |
|
|
|
71
|
+ | 6 | 0x00000050 | 00\|1010000 | Segmentation Violation | - |
|
|
|
72
|
+ | 7 | 0x00000037 | 00\|0110111 | **0x00000037** | 55 |
|
|
|
73
|
+ | 8 | 0x000000ff | **01**\|1111111 | **0x00000393** | 915 |
|
|
|
74
|
+ | 9 | 0x000000e9 | **01**\|1101001 | Segmentation Violation | - |
|
|
|
75
|
+ | 10 | 0x00000001 | 00\|0000001 | **0x00000001** | 1 |
|
|
|
76
|
+ | 11 | 0x0000014c | **10**\|1001100 | **0x000003e0** | 992 |
|
|
|
77
|
+ | 12 | 0x000000b4 | **01**\|0110100 | Segmentation Violation | - |
|
|
|
78
|
+ | 13 | 0x000000cf | **01**\|1001111 | Segmentation Violation | - |
|
|
|
79
|
+ | 14 | 0x0000012b | **10**\|0101011 | **0x000003bf** | 959 |
|
|
|
80
|
+ | 15 | 0x00000084 | **01**\|0000100 | Segmentation Violation | - |
|
|
|
81
|
+
|
|
|
82
|
+ Zuerst überprüft man in welchem Segment die VA liegt, indem man auf das höchste bit der binären VA schaut. Wenn sie im Segment 0 liegt dann ist VA => PA und man kann prüfen, ob die Adresse im oben berechneten physikalischen Adressbereich von Segment 0 liegt. Wenn nicht => SEG FAULT.
|
|
|
83
|
+
|
|
|
84
|
+ Wenn die VA in Segment 1 liegt, dann muss man vorher den berechneten Offset vonn dezimal 660 oder hexadezimal 0x258 aufaddieren. Dann hat man die PA und kann dann schauen ob sie im physikalischen Adressbereich von Segment 1 liegt. Wenn nicht => SEG FAULT.
|