cpu: properly reload segment registers after lgdt

This commit is contained in:
Mark
2020-09-19 17:18:39 +03:00
parent 5f7b6e2cee
commit f9eb40dbfb
+22 -2
View File
@@ -2,7 +2,27 @@
.global amd64_gdt_load
amd64_gdt_load:
lgdt (%rdi)
// Not sure if CS reload is needed
movw $0x28, %ax
ltr %ax
retq
mov %rsp, %rdx
mov $0x10, %rax
push %rax
push %rdx
pushf
mov $0x08, %rax
push %rax
lea 1f(%rip), %rax
push %rax
iretq
1:
mov $0x10, %rax
mov %rax, %ds
mov %rax, %es
mov %rax, %fs
mov %rax, %gs
ret