fix: gdt work I think

This commit is contained in:
2024-09-10 21:36:28 +02:00
parent bc99b99c82
commit 365ed0cc2e
4 changed files with 80 additions and 73 deletions

18
src/gdt/set_gdt.s Normal file
View File

@ -0,0 +1,18 @@
.intel_syntax noprefix
.section .text
.global set_gdt
set_gdt:
mov eax, [esp+4] // 1st parameter : pointer to the IDT
lgdt [eax]
mov ax, 0x10 // 0x10 is the offset in the GDT to our data segment
mov ds, ax // Load all data segment selectors
mov fs, ax
mov gs, ax
mov es, ax
mov ax, 0x18 // 0x18 is the offset in the GDT to our kernel stack
mov ss, ax
jmp 0x08:.flush // 0x08 is the offset to our code segment: far jump on it
.flush:
ret