[bits 16] %include "boot/boot_gdt.asm" switch_to_protected_mode: ; switch off interrupts for now, we don't ; have a valid IDT installed yet cli ; load GDT (global descriptor table) lgdt [gdt_descriptor] ; do the actual switch mov eax, cr0 or eax, 0x1 mov cr0, eax ; unconditional far jump into code segment, ; wipes the instruction prefetch pipeline jmp CODE_SEGMENT:init_pm [bits 32] ; initialize registers and stack for protected mode init_pm: mov ax, DATA_SEGMENT mov ds, ax mov ss, ax mov es, ax mov fs, ax mov gs, ax ; a new stack mov ebp, 0x90000 mov esp, ebp call BEGIN_PROTECTED_MODE [bits 16]