reimplements the gdt

This commit is contained in:
2025-05-29 10:17:18 -04:00
parent 9b980767d7
commit afcf0bea09
3 changed files with 37 additions and 0 deletions

23
kernel/arch/gdt/gdt.s Normal file
View File

@ -0,0 +1,23 @@
gdtr DW 0 ; limit store
DD 0 ; base storage
global setGdt
setGdt:
mov ax, [esp + 4]
mov [gdtr], ax
mov eax, [esp + 8]
mov [gdtr + 2], eax
lgdt [gdtr]
ret
global reloadSegments
reloadSegments:
jmp 0x08:.reload_CS ; 0x08 is a stand in for the code segment
.reload_CS:
mov ax, 0x10 ; stand in for the data segment
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
ret