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
* Add markdown detection as language
* Update FUNDING.yml
* Update README.md
Update some parts of the readme, removing text staitng that was a work in progress.
* Typo fixes
* Fix typo in boot protocols chapter
* Minor fixes on boot protocl chapter
* Add detail for gdb
* Fix error in cross comiler character
* Update updates
Copy file name to clipboardExpand all lines: 01_Build_Process/02_Boot_Protocols.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
@@ -8,7 +8,7 @@ This chapter covers 2 protocols _Sultiboot 2_ and _Stivale 2_:
8
8
9
9
*_Stivale 2_ (also superceding stivale 1) is the native protocol of the limine bootloader. Limine and stivale were designed many years after multiboot 2 as an attempt to make hobbyist OS development easier. _Stivale 2_ is a more complex spec to read through, but it leaves the machine in a more known state prior to handing off to the kernel.
10
10
11
-
Recently limine has added a new protocol (the limine boot protocol) which is not covered here. It's based on stivale2, with mainly architectural architectural changes, but similar concepts behind it. If familiar with the concepts of stivale 2, the limine protocol is easy enough to understand.
11
+
Recently limine has added a new protocol (the limine boot protocol) which is not covered here. It's based on stivale2, with mainly architectural changes, but similar concepts behind it. If familiar with the concepts of stivale 2, the limine protocol is easy enough to understand.
12
12
13
13
All the referenced specifications and documents are provided as links at the start of this chapter/in the readme.
14
14
@@ -215,9 +215,9 @@ Stivale 2 has a number of major differences to multiboot 2 though:
215
215
216
216
- The kernel starts in 64-bit long mode, by default. No need for a protected mode stub to setup up some initial paging.
217
217
- The kernel starts with the first 4GB of memory and any usable regions of memory identity mapped.
218
-
- Stivale 2 also sets up a 'higher half direct map', or hhdm. This is the same identity map as the lower half, but it starts as the hhdm_offset returned in a struct tag when the kernel runs. The idea is that as long we ensure all the pointers are in the higher half, we can zero the bottom half of the page tables and easily be ready for userspace programs. No need to move code/data around.
218
+
- Stivale 2 also sets up a _higher half direct map_, or _hhdm_. This is the same identity map as the lower half, but it starts at the `hhdm_offset` returned in a struct tag when the kernel runs. The idea is that as long we ensure all the pointers are in the higher half, we can zero the bottom half of the page tables and easily be ready for userspace programs. No need to move code/data around.
219
219
- A well-defined GDT is provided.
220
-
- Unlike mb2, a distinction is made between usable memory and the memory used by the bootloader, kernel/modules, and framebuffer. These are separate types in the memory, and don't intersect. Meaning usable memory regions can be used immediately.
220
+
- Unlike _mb2_, a distinction is made between usable memory and the memory used by the bootloader, kernel/modules, and framebuffer. These are separate types in the memory, and don't intersect. Meaning usable memory regions can be used immediately.
221
221
222
222
To get the next tag in the chain, it's as simple as:
Copy file name to clipboardExpand all lines: 02_Architecture/06_ACPITables.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ We need to access the ACPI Tables in order to read the IO-APIC information, used
8
8
9
9
Most of the information is organized and accessible through different data structures, but since the ACPI spec is quite big, and covers so many different components, we focus only on what we need to get the information about the APIC.
10
10
11
-
Before proceeding, let's keep in mind that all address described below are physical, so if we have enabled paging, we need to ensure they are properly mapped in the virtual memory space.
11
+
Before proceeding, let's keep in mind that all addresses described below are physical, so if we we have enabled paging, we need to ensure they are properly mapped in the virtual memory space.
Having last byte means that `result mod 0x100` is 0. Now there are two ways to test it:
85
+
Having last byte equals `0`, means that `result mod 0x100` is 0. Now there are two ways to test it:
86
86
87
87
* Using the `mod` instruction, and check the result, if is 0 the structure is valid, otherwise it should be ignored.
88
88
* Just checking the last byte of the result it can be achieved in several ways: for example is possible cast the result to `uint_8` if the content after casting is 0 the struct is valid, or use bitwise AND with `0xFF` value (`0xFF` is equivalent to the `0b11111111` byte) `sum & 0xFF`, if it is 0 the struct is valid otherwise it has to be ignored.
Copy file name to clipboardExpand all lines: 02_Architecture/07_APIC.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Both types of APIC are accessed by memory mapped registers, with 32-bit wide reg
17
17
18
18
## Local APIC
19
19
20
-
When a system boots up, the cpu starts in PIC8259A emulation mode for legacy reasons. This simply means that instead of having the LAPIC and I/O APIC up and running, we have them working to emulate the old interrupt controller, so before we can use them properly we should to disable the PIC8259 emulation.
20
+
When a system boots up, the cpu starts in PIC8259A emulation mode for legacy reasons. This simply means that instead of having the LAPIC and I/O APIC up and running, we have them working to emulate the old interrupt controller, so before we can use them properly we should disable the PIC8259 emulation.
Copy file name to clipboardExpand all lines: 08_VirtualFileSystem/02_VirtualFileSystem.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,8 +24,8 @@ It shows a portion of a unix directory tree (starting from root), the gray circl
24
24
25
25
So for example:
26
26
27
-
* /home/userA point to a folder into the file system that is loaded at the "/" folder (we say that it's *mounted*)
28
-
* /mnt/ext_device instead points to a file that is mounted within the /mnt folder
27
+
* /home/user1 point to a folder into the file system that is loaded at the "/" folder (we say that it's *mounted*)
28
+
* /mnt/ext_device/A instead points to a file that is mounted within the /mnt folder
29
29
30
30
When a filesystem is *mounted* in a folder it means that the folder is no longer a container of other files/directories for the same filesystem but is referring to another one somewhere else (it can be a network drive, external device, an image file, etc.) and the folder takes the name of *mountpoint*.
Copy file name to clipboardExpand all lines: 99_Appendices/E_Cross_Compilers.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,7 +138,7 @@ As usual let's create a new folder called `build_qemu` and move into it. The con
138
138
```
139
139
where:
140
140
141
-
*`--target-list=riscv64-softmmu,x86_64`: is a comma separated list of platforms we want to support.
141
+
*`--target-list=riscv64-softmmu,x86_64-softmmu`: is a comma separated list of platforms we want to support.
142
142
*`--enable-tools`: will build support utilities that comes with qemu
143
143
*`--enable-gtk`: it will enable the gtk+ interface
144
144
*`--enable-vhost-net` : it will enable the vhost-net kernel acceleration support
@@ -167,6 +167,8 @@ The last two options enable compiling the text-user-interface (`--enable-tui`) a
167
167
168
168
The `--target=` flag is special here in that it can also take an option `all` which builds gdb with support for every single architecture it can support. If we're going to develop on one machine but test on multiple architectures (via qemu or real hardware) this is nice. It allows a single instance of gdb to debug multiple architectures without needing different versions of gdb. Often this is how the 'gdb-multiarch' package is created for distros that have it.
169
169
170
+
The `--host=` flags specify the host system running gdb, in the example above an `x86_64-linux-gnu` system, this should be changed depedning on the system used.
171
+
170
172
After running the configure script, we can build and install our custom gdb like so:
A collection of notes, organised as a book, intended to guide a reader through the steps of building an operating system kernel from scratch. Written while writing (and re-writing) our own kernels, each chapter covers a step from selecting a bootloader to running a loaded ELF in userspace.
10
-
11
-
Currently these notes are a work in progress, but many chapters are functionally complete and available to read below. We'll keep updating old chapters and adding new ones over time so be sure to check back occasionally.
9
+
A book, originated as a collection of notes, intended to guide a reader through the steps of building an operating system kernel from scratch. Written while writing (and re-writing) our own kernels, each chapter covers a step of the process from selecting a bootloader to running a loaded ELF in userspace.
12
10
13
11
We hope you enjoy, and find something interesting here!
0 commit comments