Files
42_KFS/src/gdt/set_gdt.s
0x35c d348ac109e fix: interrupt handler function uses an array
fix: gdt calls cli asm instruction at init
2024-10-08 10:56:15 +02:00

21 lines
605 B
ArmAsm

.intel_syntax noprefix
.section .text
.global set_gdt
set_gdt:
cli // disable all interrupts
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