PMODE ERROR
Posted: Sun Dec 05, 2004 12:00 am
I'm having great difficulty getting into protected mode. Every time my loader sets the lsb of cr0 to 1, my computer reboots. I'v searched the net, but came up with nothing. Sorry if this is a dumb question. (Maybe I sould just read all the IA32 manuals...) Here is my code:
Thanks,
Ty
Code: Select all
enable_A20:
mov ax, 0x2401 ; bios enable a20 line
int 0x15
jnc enter_pmode ; if no error, go to pmode
mov si, A20_error ; Otherwise, error msg
call print
enter_pmode:
cli ; dissable interrupts
lgdt [gdtr] ; load gtdr
mov eax, cr0 ; edit cr0
or al, 0x01 ; lsb sets pmode
mov cr0, eax ; and set pmode bit
init: ; initialize selectors
mov ax, 0x10 ; second descriptor
mov ds, ax
gdt: ; 64 bit segment descriptors
dw 0x0 ; null descriptor
dw 0x0
dw 0x0
dw 0x0
dw 0xffff ; code descriptor
dw 0x0000
dw 0x9a00
dw 0x00cf
dw 0xffff ; data descriptor
dw 0x0000
dw 0x9200
dw 0x00cf
gdt_end: ; used for calculation of limit
gdtr: ; base and limit of gdt
dw gdt_end-gdt-1 ; gdt limit
dd gdt ; gdt base address
Thanks,
Ty