diff --git a/src/boot/switch32.s b/src/boot/switch32.s index 7fa64ce..b4338ab 100644 --- a/src/boot/switch32.s +++ b/src/boot/switch32.s @@ -16,12 +16,20 @@ [bits 16] switch_to_protected_mode: - cli ; We disable interrupts... - lgdt [gdt_descriptor] ; ... load the GDT descriptor... + ; We enable the A20 line using + ; the ol' but (mostly) reliable + ; keyboard controller method + mov al, 0xd1 + out 0x64, al + mov al, 0xdf + out 0x60, al + cli ; Now we disable interrupts + lgdt [gdt_descriptor] ; Time to load the GDT descriptor + ; We set 32-bit mode in CR0. Almost done! mov eax, cr0 - or eax, 0x1 ; ... set 32-bit mode in CR0 + or eax, 0x1 mov cr0, eax - jmp CODE_SEG:switch32 ; ... and perform a far jump using a different segment + jmp CODE_SEG:switch32 ; At last, we perform a far jump into a different segment [bits 32]