i'm new to kernel development and have sucessfully switched to pmode and implemented an idt and have turned on paging.
when i try to jump to code at dpl 3 i get a general protection fault.
my gdt looks like this
Code: Select all
gdt: ; Address for the GDT
gdt_null: ; Null Segment
dd 0
dd 0
gdt_code: ; Code segment, read/execute, nonconforming
dw 0FFFFh
dw 0
db 0
db 10011010b
db 11001111b
db 0
gdt_data: ; Data segment, read/write, expand down
dw 0FFFFh
dw 0
db 0
db 10010010b
db 11001111b
db 0
gdt_interrupts: ; Interrupt segment, read/execute, nonconforming
dw 0FFFFh
dw 01000h ; Start at address 01000h
db 0
db 10011010b
db 11001111b
db 0
gdt_apps: ; Interrupt segment, read/execute, nonconforming
dw 0FFFFh
dw 0
db 0
db 10111011b
db 11001111b
db 0
gdt_end: ; Used to calculate the size of the GDT
gdt_desc: ; The GDT descriptor
dw gdt_end - gdt - 1 ; Limit (size)
dd gdt ; Address of the GDT
Code: Select all
mov ax, 0febch ; for debuging
jmp 18h:test_user
; we never get here there is a General protection fault
test_user
mov ax, 1234h ; for debuging
int 3 ;break point
bochs prints the message:
check_cs: non-conforming code seg descriptor dpl != cpl
but my kerel runs at ring 0 !?
does anyone know why i cant jum to this code?
Thank you.