jump_protected: gate type 0 unsupported
Posted: Fri Sep 12, 2003 4:40 am
Here is my kernel loader. My bootsector loads my kernelloader and it loads my kernel(The code below not loads kernel yet):
But this code crashes with error "jump_protected: gate type 0 unsupported" in bochs when I want to jmp protected mode part. (jmp CODESELECTOR:FlushPipeline) Ill be crazy if someone doesnt help....
Code: Select all
[BITS 16]
jmp loadermain
GDTR:
GDTsize DW GDTEND - GDT - 1
GDTbase DD 500h
GDT:
NULLSELECTOR EQU $ - GDT
DD 0x0
DD 0x0
CODESELECTOR EQU $ - GDT ; 4GB Flat Code at 0x0 with max 0xFFFFF limit
DW 0FFFFh ; Limit(2):0xFFFF
DW 0h ; Base(3)
DB 0h ; Base(2)
DB 09Ah ; Type: present,ring0,code,exec/read/accessed (10011000)
DB 0CFh ; Limit(1):0xF | Flags:4Kb inc,32bit (11001111)
DB 0h ; Base(1)
DATASELECTOR EQU $ - GDT ; 4GB Flat Data at 0x0 with max 0xFFFFF limit
DW 0FFFFh ; Limit(2):0xFFFF
DW 0h ; Base(3)
DB 0h ; Base(2)
DB 092h ; Type: present,ring0,data/stack,read/write (10010010)
DB 0CFh ; Limit(1):0xF | Flags:4Kb inc,32bit (11001111)
DB 0h ; Base(1)
GDTEND:
loadermain:
mov ax, cs
mov ds, ax
mov es, ax
mov fs, ax
cli
mov ax, 1D0h
mov ss, ax
mov sp, 0200h
call EnableA20
sti
lMoveGDT:
xor ax, ax
mov ds, ax
mov es, ax
mov si, GDT
mov di, [GDTbase]
mov cx, [GDTsize]
cld
rep movsb
lEnterPMode:
cli
mov eax, cr0
or al, 1
mov cr0, eax
lgdt[GDTR]
jmp CODESELECTOR:FlushPipeline ;<-- crashes here...
[BITS 32]
FlushPipeline:
mov eax, DATASELECTOR
mov ds, eax
mov es, eax
mov fs, eax
mov gs, eax
mov ss, eax
mov esp, 0ffffh
jmp $
cli
hlt