GPF when I switch to a LDT descriptor using a far jmp
Posted: Sun Jan 04, 2015 12:17 pm
I am a beginner in the OS's world and I need your help please
I wrote a bare metal kernel which runs in the protected mode and I wanna do a jump to an LDT code segment, but when I tried to do that I got a general protection fault.
This is the GDT and the LDT entries:
And I jumped in the Kernel using:
Is it correct to jump directly to LDT descriptor or I have some kind of misunderstanding??
I wrote a bare metal kernel which runs in the protected mode and I wanna do a jump to an LDT code segment, but when I tried to do that I got a general protection fault.
This is the GDT and the LDT entries:
Code: Select all
gdt_data:
dd 0 ; null descriptor
dd 0
; gdt code: ; code descriptor
dw 0FFFFh ; limit low
dw 0 ; base low
db 0 ; base middle
db 10011010b ; access
db 11001111b ; granularity
db 0 ; base high
; gdt data: ; data descriptor
dw 0FFFFh ; limit low
dw 0 ; base low
db 0 ; base middle
db 10010010b ; access
db 11001111b ; granularity
db 0 ; base high
; ldt entry:
dw 00FFh ; limit
dw ldt_data ; base low
db 0 ; base middle
db 10000010b ; access
db 01000000b ; granularity
db 0 ; base high
; LDT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ldt_data:
dd 0 ; null descriptor
dd 0
; ldt code: ; code descriptor
dw 0x100 ; limit low
dw 0 ; base low
db 0x80 ; base middle
db 10011010b ; access
db 11000000b ; granularity
db 0 ; base high
; ldt data: ; data descriptor
dw 0x100 ; limit low
dw 0 ; base low
db 0x80 ; base middle
db 10010010b ; access
db 11000000b ; granularity
db 0 ; base high
And I jumped in the Kernel using:
Code: Select all
jmp dword 0x82 : 0x0000