Skip to content

Commit 668d471

Browse files
committed
minor typo fixes
1 parent 575cba9 commit 668d471

3 files changed

Lines changed: 20 additions & 19 deletions

File tree

04_Memory_Management/03_Paging.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,29 +179,29 @@ Note about PWT and PCD, the definiton of those bits depends on whether PAT (page
179179

180180
If we are using 2MB pages this is how the address will be handled by the paging mechanism:
181181

182-
| | | | | |
183-
|------------|-----------|---------------------|------------|--------------|
184-
| 63 .... 48 | 47 ... 39 | 38 ... 32 31 30 | 29 .. 21 | 20 19 ... 0 |
185-
| 1 ... 1 | 1 ... 1 | 1 ... 1 1 0 | 0 ... 0 | 0 0 ... 0 |
186-
| Sgn. ext | PML4 | PDPR | Page dir | Offset |
182+
| | | | | |
183+
|------------|-----------|---------------|------------|-----------|
184+
| 63 .... 48 | 47 ... 39 | 38 ... 30 | 29 .. 21 | 20 ... 0 |
185+
| 1 ... 1 | 1 ... 1 | 1 ... 0 | 0 ... 0 | 0 ... 0 |
186+
| Sgn. ext | PML4 | PDPR | Page dir | Offset |
187187

188188
* Bits 63 to 48, not used in address translation.
189189
* Bits 47 ... 39 are the PML4 entry.
190190
* Bits 38 ... 30 are the PDPR entry.
191191
* Bits 29 ... 21 are the PD entry.
192192
* Offset in the page directory.
193193

194-
Every table has 512 elements, so we have an address space of $2^{512} * 2^{512} * 2^{512} * 0x200000$ (that is the page size)
194+
Every table has 512 elements, so we have an address space of $2^{512}*2^{512}*2^{512}*0x200000$ (that is the page size)
195195

196196
### Address translation Using 4KB Pages
197197

198198
If we are using 4kB pages this is how the address will be handled by the paging mechanism:
199199

200-
| | | | | | |
201-
|------------|-----------|---------------------|------------|-------------|--------------|
202-
| 63 .... 48 | 47 ... 39 | 38 ... 32 31 30 | 29 .. 21 | 20 ... 12 | 11 10 ... 0 |
203-
| 1 ... 1 | 1 ... 1 | 1 ... 1 1 0 | 0 ... 0 | 0 ... 0 | 0 ... ... 0 |
204-
| Sgn. ext | PML4 | PDPR | Page dir | Page Table | Offset |
200+
| | | | | | |
201+
|-----------|-----------|-----------|-----------|-------------|-----------|
202+
| 63 ... 48 | 47 ... 39 | 38 ... 30 | 29 ... 21 | 20 ... 12 | 11 ... 0 |
203+
| 1 ... 1 | 1 ... 1 | 1 ... 0 | 0 ... 0 | 0 ... 0 | 0 ... 0 |
204+
| Sgn. ext | PML4 | PDPR | Page dir | Page Table | Offset |
205205

206206
* Bits 63 to 48, not used in address translation.
207207
* Bits 47 ... 39 are the PML4 entry.
@@ -211,7 +211,7 @@ If we are using 4kB pages this is how the address will be handled by the paging
211211
* Offset in the page table.
212212

213213
Same as above:
214-
Every table has 512 elements, so we have an address space of: $2^{512} * 2^{512} * 2^{512} * 2^{512} * 0x1000$ (that is the page size)
214+
Every table has 512 elements, so we have an address space of: $2^{512}*2^{512}*2^{512}*2^{512}*0x1000$ (that is the page size)
215215

216216
## Page Fault
217217

@@ -248,6 +248,6 @@ A few examples of recursive addresses:
248248

249249
* PML4: 511 (hex: 1ff) - PDPR: 510 (hex: 1fe) - PD 0 (hex: 0) using 2mb pages translates to: `0xFFFF'FFFF'8000'0000`.
250250
* Let's assume we mapped PML4 into itself at entry 510,
251-
- If we want to access the content of the PML4 page itself, using the recursion we need to build a special address using the entries: PML4: 510, PDPR: 510, PD: 510, PT: 510, now keep in mind that the 510th entry of PML4 is PML4 itself, so this means that when the processor loads that entry, it loads PML4 itself instead of PDPR, but now the value for the PDPR entry is still 510, that is still PML4 then, the table loaded is PML4 again, repat this process for PD and PT wit page number equals to 510, and we obtain access to the PML4 page itself.
252-
- Now using a similar approach we can get acces to other tables, for example the following values: PML4: 510, PDPR:510, PD: 1, PT: 256, will give access at the Page Directory PD at entry number 256 in PDPR that is contained in the first PML4 entry .
251+
- If we want to access the content of the PML4 page itself, using the recursion we need to build a special address using the entries: _PML4: 510, PDPR: 510, PD: 510, PT: 510_, now keep in mind that the 510th entry of PML4 is PML4 itself, so this means that when the processor loads that entry, it loads PML4 itself instead of PDPR, but now the value for the PDPR entry is still 510, that is still PML4 then, the table loaded is PML4 again, repat this process for PD and PT with page number equals to 510, and we got access to the PML4 table.
252+
- Now using a similar approach we can get acces to other tables, for example the following values: _PML4: 510, PDPR:510, PD: 1, PT: 256_, will give access at the Page Directory PD at entry number 256 in PDPR that is contained in the first PML4 entry.
253253

05_Scheduling/04_Locks.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ void thead_two() {
4242
}
4343
```
4444

45-
What would we expect to see on the serial output? We don't know! It's essentially non-deterministic, since we can't know how these will be scheduled. Each thread may get to write the full string before the other is scheduled, but more like they will get in the way of each other.
46-
45+
What would we expect to see on the serial output? We don't know! It's essentially non-deterministic, since we can't know how these will be scheduled. Each thread may get to write the full string before the other is scheduled, but more likely they will get in the way of each other.
46+
4747
![Tasks execution sequence](/Images/taskssequence.png)
4848

49-
One example of what we could see is `Iwh aI ammi lethe secfionrsd t stristngring`. This contains all the right characters but it's completely unreadable. The image below shows what could happen:
49+
The image above is an example of threads being scheduled, assuming there are only three of them in the system (labeled as _A, B, C_.
50+
Imagine that A is `thread_one` and B is `thread_two`, while C does not interact with the serial. One example of what we could see then is `Iwh aI ammi lethe secfionrsd t stristngring`. This contains all the right characters but it's completely unreadable. The image below shows what could happen:
5051

51-
![Shared Resource Sequence](Images/sharedressequence.png)
52+
![Shared Resource Sequence](/Images/sharedressequence.png)
5253

5354
What we'd expect to see is one of two outcomes: `I am the first string while I am the second` or `while I am the second I am the first string`.
5455

09_Loading_Elf/03_Loading_And_Running.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ For a program to be compatible with our loader:
88
- All libraries must be statically linked, we won't support dynamic linking for now. This feature isn't too hard to implement, but we will leave this as an exercise to the reader.
99
- The program must be freestanding! As of right now we don't have a libc that targets our kernel. It can be worth porting (or writing) a libc later on.
1010

11-
# Steps Required
11+
## Steps Required
1212

1313
In the previous chapter we looked at the details of loading program headers, but we glossed over a lot of the high level details of loading a program. Assuming we want to start running a new program (we're ignoring `fork()` and `exec()` for the moment), we'll need to do a few things. Most of this was covered in previous chapters, and now it's a matter of putting it all together.
1414

0 commit comments

Comments
 (0)