Added Global Descriptor Table(GDT)...not working yet(as always)

This commit is contained in:
ice-bit
2019-07-04 12:49:53 +02:00
parent 222ab282d9
commit ccd31d8fab
7 changed files with 264 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
OBJS = multiboot.asm.o kernel_loader.asm.o ports.asm.o
OBJS = multiboot.asm.o kernel_loader.asm.o ports.asm.o gdt.asm.o
ASM = nasm
ASMFLAGS = -f elf

15
kernel/cpu/gdt.asm Normal file
View File

@@ -0,0 +1,15 @@
global gdt_flush ; for drivers/gdt.c
section .text
gdt_flush:
mov eax, [esp+4] ; get address of gdt_ptr_t
lgdt [eax] ; Load GDT
mov ax, 0x10 ; offset in the GDT of the data segment
mov ds, ax ; Load data segment selectors
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp 0x08:.flush ; offset in the GDT of the code segment
.flush:
ret