[bits 16] enter_protected: cli ; Disable interrupts lgdt [gdt_descriptor] ; load the GDT mov eax, cr0 or eax, 0x1 ; set 32-bit mode bit mov cr0, eax jmp CODE_SEG:init_protected ; far jump into a different segment [bits 32] init_protected: ; now in 32bit mov ax, DATA_SEG ; update segment registers mov ds, ax mov ss, ax mov es, ax mov fs, ax mov gs, ax mov ebp, 0x90000 ; update stack to top of free space mov esp, ebp call BEGIN_PROTECTED ; call known label with useful code