You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Minor layout fixes
* Replace memory manager image
* Fixing indentation and line overflows
* Update yaml headers with margin and image fixes
---------
Co-authored-by: Dean <dean243@hotmail.com>
Copy file name to clipboardExpand all lines: 02_Architecture/06_ACPITables.md
+31-34Lines changed: 31 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,11 +36,11 @@ As already mentioned there are two different version of RSDP, basic data structu
36
36
37
37
```c
38
38
struct RSDPDescriptor {
39
-
char Signature[8];
40
-
uint8_t Checksum;
41
-
char OEMID[6];
42
-
uint8_t Revision;
43
-
uint32_t RsdtAddress;
39
+
char Signature[8];
40
+
uint8_t Checksum;
41
+
char OEMID[6];
42
+
uint8_t Revision;
43
+
uint32_t RsdtAddress;
44
44
} __attribute__ ((packed));
45
45
```
46
46
@@ -55,13 +55,12 @@ Where the fields are:
55
55
The structure for the v2 header is an extension of the previous one, so the fields above are still valid, but in addition it has also the following extra-fields:
56
56
57
57
```c
58
-
struct RSDP2Descriptor
59
-
{
60
-
//v1 fields
61
-
uint32_t Length;
62
-
uint64_t XSDTAddress;
63
-
uint8_t ExtendedChecksum;
64
-
uint8_t Reserved[3];
58
+
struct RSDP2Descriptor {
59
+
//v1 fields
60
+
uint32_t Length;
61
+
uint64_t XSDTAddress;
62
+
uint8_t ExtendedChecksum;
63
+
uint8_t Reserved[3];
65
64
};
66
65
```
67
66
@@ -75,11 +74,11 @@ Before proceeding let's explain little bit better the validation. For both versi
Copy file name to clipboardExpand all lines: 03_Video_Output/02_DrawingTextOnFB.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,8 +122,8 @@ All the fields are 4 bytes in size, so creating a structure that can hold it is
122
122
Let's assume from now on that we have a data structure called PSF_font with all the fields specified above. The first thing that we need of course, is to access to this variable:
123
123
124
124
```C
125
-
// We have linked _binary_font_psf_start from another .o file so we must specify that we are dealing
126
-
// with an external variable
125
+
// We have linked _binary_font_psf_start from another .o file so we must
126
+
//specify that we are dealing with an external variable.
Since we know that every glyph has the same size, and this is available in the PSF_Header, if we want to access the *i-th* character, we just need to do the following:
Copy file name to clipboardExpand all lines: 04_Memory_Management/01_Overview.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,13 +17,13 @@ We will cover the following topics:
17
17
18
18
*Authors note: don't worry, we will try to keep it as simple as possible, using basic algorithms and explaining all the gray areas as we go. The logic may sometimes be hard to follow, you will most likely have to go through several reads of this part multiple times.*
19
19
20
-
Each of the layers has a dedicated section below, however we'll start with a high level look at how they fit together. Before proceeding let's briefly define the concepts above:
20
+
Each of the layers has a dedicated chapter, however we'll start with a high level look at how they fit together. Before proceeding let's briefly define the concepts above:
21
21
22
22
| Memory Management Layer | Description |
23
-
|---|---|
23
+
|---|------|
24
24
| Physical Memory Manager | Responsible for keeping track of which parts of the available hardware memory (usually ram) are free/in-use. It usually allocates in fixed size blocks, the native page size. This is 4096 bytes on x86.|
25
25
| Paging | It introduces the concepts of *virtual memory* and *virtual addresses*, providing the OS with a bigger address space, protection to the data and code in its pages, and isolation between programs. |
26
-
| Virtual memory manager | For a lot of projects, the VMM and paging will be the same thing. However the VMM should be seen as the virtual memory *manager*, and paging is just one tool that it uses to accomplish its job: ensuring that a program has memory where it needs it, when it needs it. Often this is just mapping physical ram to the requested virtual address (via paging or segmentation), but it can evolve into stealing pages from other processes.|
26
+
| Virtual memory manager | For a lot of projects, the VMM and paging will be the same thing. However the VMM should be seen as the virtual memory *manager*, and paging is just one tool that it uses to accomplish its job: ensuring that a program has memory where it needs it, when it needs it. Often this is just mapping physical ram to the requested virtual address (via paging or segmentation) |
27
27
| Heap Allocator | The VMM can handle page-sized allocations just fine, but that is not always useful. A heap allocator allows for allocations of any size, big or small. |
What we're describing here is the left node being "swallowed" by the right one, and growing in size. The memory that the left node owns and is responsible for is now part of the right oneTo make it easier to understand, consider the portion of a hypothetical heap in the picture below:
403
404
404
-

405
+

405
406
406
407
407
408
Basically the heap starts from address 0, the first node is marked as free and the next two nodes are both used. Now imagine that `free()` is called on the second address (for this exammple we consider size of the heap node structure to be just of 2 bytes):
@@ -413,7 +414,7 @@ free(0x27); //Remember the overhead
413
414
414
415
This means that the allocator (before marking this location as free and returning) will check if it is possible to merge first to the left (YES) and then to the right (NO since the next node is still in use) and then will proceed with a merge only on the left side. The final result will be:
@@ -54,8 +53,7 @@ This function also uses the `naked` attribute. If unfamiliar with attributes, th
54
53
Now, let's combine our wrapper function with our example system call from above. We're going to write a `memcpy` function that could be called by another code, but uses the system call internally:
0 commit comments