First post, by ThatGuy2244@live.com
I am trying to make a DOS program that is 32-bit, but when I try to enter 32-bit mode I get an error from DOSbox ("exit on error: JMP Invalid Descriptor Type 0"). I have tried different things to try to fix or isolate this problem and it seems to have nothing to do with the descriptors I set up, but only has a problem with my JMP instruction to a 32-bit descriptor. My code for entering the 32-bit environment is:
cli
lgdt [GDT]
mov eax, cr0
or eax, 1
mov cr0, eax
sti
jmp 0x08:PMode
GDT:
dw GDTEnd - GDTStart - 1
dd GDTStart
GDTStart:
dd 0x00000000 ;Descriptor 0 Null
dd 0x00000000
dw 0xffff ;Descriptor 1 Code
dw 0x0000
db 0x00
db 10011010b
db 11001111b
db 0x00
dw 0xffff ;Descriptor 2 Data
dw 0x0000
db 0x00
db 10010010b
db 11001111b
db 0x00
GDTEnd:
My descriptors are set up to be a flat memory model for data and code.