cpu: properly reload segment registers after lgdt
This commit is contained in:
+22
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user