Implemented GDT initialisation
This commit is contained in:
28
arch/x86_64/gdt_load.S
Normal file
28
arch/x86_64/gdt_load.S
Normal file
@@ -0,0 +1,28 @@
|
||||
.section .text
|
||||
|
||||
.global gdt_load
|
||||
.type gdt_load, @function
|
||||
|
||||
gdt_load:
|
||||
pushq %rbp
|
||||
movq %rsp, %rbp
|
||||
|
||||
lgdt (%rdi)
|
||||
|
||||
mov $0x10, %ax
|
||||
mov %ax, %ss
|
||||
mov %ax, %ds
|
||||
mov %ax, %es
|
||||
mov %ax, %fs
|
||||
mov %ax, %gs
|
||||
|
||||
movabsq $(gdt_load2), %rax
|
||||
|
||||
push $0x08
|
||||
push %rax
|
||||
|
||||
lretq
|
||||
|
||||
gdt_load2:
|
||||
popq %rbp
|
||||
ret
|
||||
Reference in New Issue
Block a user