.intel_syntax noprefix

.global idt_load
idt_load:
    sub rsp, 10
    mov [rsp], si
    mov [rsp + 2], rdi
    lidt [rsp]
    add rsp, 10
    ret

.global lgdt_and_reload
lgdt_and_reload:
    lgdt [rdi]
    push 0x08
    mov rax, offset .reload_cs
    push rax
    retfq
.reload_cs:
    mov ax, 0x10
    mov ds, ax
    mov es, ax
    mov fs, ax
    mov gs, ax
    mov ss, ax
    ret

.global tss_load
tss_load:
    ltr di
    ret

.section .note.GNU-stack,"",@progbits
