Change GDT code to enforce correct CS

This commit is contained in:
Justin C. Miller
2018-05-14 22:52:28 -07:00
parent 09f72f5ac6
commit 0fc369789e
3 changed files with 80 additions and 20 deletions

View File

@@ -14,6 +14,17 @@ idt_load:
global gdt_write
gdt_write:
lgdt [rel g_gdtr]
mov ax, si ; second arg is data segment
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
push qword rdi ; first arg is code segment
lea rax, [rel .next]
push rax
o64 retf
.next:
ret
global gdt_load