.global boot64 boot64: lgdt (GdtPointer) // try reloading gdt again mov $(6 << 3 | 3), %ax // SEG_TSS ltr %ax push %rdi // preserve multiboot struct call sysenter_setup pop %rdi // multiboot struct in %rdi jmp kmain_early .section .shared /* https://wiki.osdev.org/Task_State_Segment#Long_Mode */ .global TSS .align 8 TSS: .4byte 0 /* reserved */ .rept 3 .8byte _isr_mini_stack /* stacks for privilege level changes */ .endr .8byte 0 /* reserved */ .rept 7 .8byte _isr_mini_stack /* IST - stack pointer loaded for interrupts */ .endr .8byte 0 /* reserved */ .4byte 0 /* reserved + IOPB (unused) */ .if . - TSS != 104 .error "bad tss size" .abort .endif