33 lines
452 B
ArmAsm
33 lines
452 B
ArmAsm
.section .text
|
|
|
|
.global gdt_load
|
|
.type gdt_load, @function
|
|
|
|
# gdt_load(struct gdt_ptr *gdtp)
|
|
# Loads GDTR with the specified GDT pointer.
|
|
# Expects entries 1 and 2 (offsets 0x08 and 0x10) to be kernel
|
|
# code and kernel data respectively.
|
|
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 $(1f), %rax
|
|
|
|
push $0x08
|
|
push %rax
|
|
|
|
lretq
|
|
|
|
1:
|
|
popq %rbp
|
|
ret
|