BITS 16 org 0x7C00 start: cli xor ax, ax mov ds, ax ; Enable A20 in al, 0x92 or al, 2 out 0x92, al ; Load GDT lgdt [gdt_descriptor] ; Enter protected mode mov eax, cr0 or eax, 1 mov cr0, eax jmp 0x08:protected_mode BITS 32 protected_mode: mov ax, 0x10 mov ds, ax mov ss, ax mov esp, 0x90000 ; Jump to kernel at 0x100000 jmp 0x100000 hang: jmp hang gdt_start: dq 0 dq 0x00CF9A000000FFFF dq 0x00CF92000000FFFF gdt_end: gdt_descriptor: dw gdt_end - gdt_start - 1 dd gdt_start times 510-($-$$) db 0 dw 0xAA55