diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-03-28 18:35:28 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-03-28 18:39:15 +0100 |
| commit | fbd1ebe4f7c5985554fdca7c7fc05de15d47dd3a (patch) | |
| tree | aa693a6f6edc717a1f3e184141d0ee1c150c57d7 /arch/x86_64/src/boot | |
| parent | 91c37142dbed40e42fd1a27a2755a79b8ccc329c (diff) | |
| download | teachos-fbd1ebe4f7c5985554fdca7c7fc05de15d47dd3a.tar.xz teachos-fbd1ebe4f7c5985554fdca7c7fc05de15d47dd3a.zip | |
gdt: fix reload of GDT
The core problems were/are the following:
- The flags of the segments were not entirely correct. Please recheck
them against the spec!
- The GDT pointer did not contain the address of the first (null) GTD
entry, but the address of the stl::vector containing the GDT
entries.
- The far pointer must consist of:
- the address to jump to
- the byte index into the GDT for the desired segement descriptor to
be loaded into CS.
- The type of the "dummy" function we jump to was wrong (it's a
function, we should declare it as such).
- We cannot enable interrupts right now, since we die with a triple
fault. This is caused by some initia fault which seems to lead to a
general protection fault, which then triple faults since we cannot
find the IDT.
Some FIXMEs have been added to the code. Please look at them carefully
and compare things against the specs.
Diffstat (limited to 'arch/x86_64/src/boot')
| -rw-r--r-- | arch/x86_64/src/boot/boot.s | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86_64/src/boot/boot.s b/arch/x86_64/src/boot/boot.s index bf150a3..108dbe5 100644 --- a/arch/x86_64/src/boot/boot.s +++ b/arch/x86_64/src/boot/boot.s @@ -356,6 +356,9 @@ prepare_page_maps: .global reload_segment_register reload_segment_register: + // FIXME: maybe we should set the actually correct values here. We'd need to communicate them down from C++. + // Alternatively, we could probably implement this as a [[gnu::naked]] function in C++, to have easier access to + // arguments and symbols. Maybe later. xor %rax, %rax mov %rax, %ss mov %rax, %ds |
