For some reason, as soon as I set the first bit of cr0 to enter protected mode, my computer restarts. Gereral protection error? Any help would be greatly appreciated.
Thanks,
Tyler
protected mode problem
RE:protected mode problem
lgdt [gSize] ; load GDTR with base and limit address
mov eax, cr0
or eax, 1 ; set first bit to 1 (pmode)
mov cr0, eax ; move value into cr0
ret ; return for now
gdt: ; create gdt (this label marks start of gdt)
null_descriptor: ; first descriptor in gdt needs to be null
dw 0x0
dw 0x0
dw 0x0
dw 0x0
code_descriptor: ; code descriptor
dw 0xffff ; segment base address
dw 0x0000 ; segment limit
db 0x0 ; base
db 10011010b
db 11001111b
db 0x0
data_descriptor ; data descriptor
dw 0xffff ; segment base address
dw 0x0000 ; segment limit
db 0x0 ; base
db 10010010b
db 11001111b
db 0x0
gdt_end:
gSize: ; these values loaded into gdtr with lgdtr
dw (3*8)-1 ; 16 bit limit address
dd gdt ; 32 bit base address
mov eax, cr0
or eax, 1 ; set first bit to 1 (pmode)
mov cr0, eax ; move value into cr0
ret ; return for now
gdt: ; create gdt (this label marks start of gdt)
null_descriptor: ; first descriptor in gdt needs to be null
dw 0x0
dw 0x0
dw 0x0
dw 0x0
code_descriptor: ; code descriptor
dw 0xffff ; segment base address
dw 0x0000 ; segment limit
db 0x0 ; base
db 10011010b
db 11001111b
db 0x0
data_descriptor ; data descriptor
dw 0xffff ; segment base address
dw 0x0000 ; segment limit
db 0x0 ; base
db 10010010b
db 11001111b
db 0x0
gdt_end:
gSize: ; these values loaded into gdtr with lgdtr
dw (3*8)-1 ; 16 bit limit address
dd gdt ; 32 bit base address
RE:protected mode problem
Do you do this in your code "cli" (clear interrutpt flag) before go into pmode ?.
ASHLEY4.
ASHLEY4.
RE:protected mode problem
Thanks for your prompt reply..
I do clear interrupts before enabling protected mode...
Maybe it has to do with my enabling my 21'st address line incorrectly?
Thanks again.
Tyler
I do clear interrupts before enabling protected mode...
Maybe it has to do with my enabling my 21'st address line incorrectly?
Thanks again.
Tyler