Added experimental code to enable A20 line

This commit is contained in:
Nocturn9x 2022-11-18 01:39:08 +01:00
parent 18f8b5c23f
commit 22e5f89bb1
1 changed files with 12 additions and 4 deletions

View File

@ -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]