[SOLVED]p mode Jump weird behaviour
Posted: Sat Dec 25, 2010 5:33 am
Hello!
I made a protected mode boot loader that loads my kernel , and I want to make an absolute jump to another part in it, but for some reason it can not jump over more than 498 bytes
in Bochs it gives me this error:
interrupt () : gate descriptor is not valid sys reg
..and resets.
- I loaded the sectors at 10000 decimal and it gives the same error
- i made an IDT thinking it will fix the problem and now it doesn't give any errors but it doesn't jump either:
- I also tried to jump with
... and it doesn't work
My GDT is an avrage gdt , nothing fancy
Why can't I jump anywhere I want?
I made a protected mode boot loader that loads my kernel , and I want to make an absolute jump to another part in it, but for some reason it can not jump over more than 498 bytes
Code: Select all
org 1050000 ; decimal
jmp 8:a1
times 500 -($-$$) db 0
a1:
interrupt () : gate descriptor is not valid sys reg
..and resets.
- I loaded the sectors at 10000 decimal and it gives the same error
- i made an IDT thinking it will fix the problem and now it doesn't give any errors but it doesn't jump either:
Code: Select all
org 10000
lidt [idt]
jmp 8:fidt
idt_A:
dw isr0 , 8 , 1000111000000000b , 0
dw isr1 , 8 , 1000111000000000b , 0
dw isr2 , 8 , 1000111000000000b ,0
dw isr3 , 8 , 1000111000000000b , 0
dw isr4 , 8 , 1000111000000000b , 0
dw isr5 , 8 , 1000111000000000b , 0
dw isr6 , 8 , 1000111000000000b , 0
dw isr7 , 8 , 1000111000000000b , 0
dw isr8 , 8 , 1000111000000000b , 0
dw isr9 , 8 , 1000111000000000b , 0
dw isr10 , 8 , 1000111000000000b , 0
dw isr11 , 8 , 1000111000000000b , 0
dw isr12 , 8 , 1000111000000000b , 0
dw isr13 , 8 , 1000111000000000b , 0
dw isr14 , 8 , 1000111000000000b , 0
dw isr15 , 8 , 1000111000000000b , 0
dw isr16 , 8 , 1000111000000000b , 0
dw isr17 , 8 , 1000111000000000b , 0
dw isr18 , 8 , 1000111000000000b , 0
dw isr19 , 8 , 1000111000000000b , 0
dw isr20 , 8 , 1000111000000000b , 0
dw isr21 , 8 , 1000111000000000b , 0
dw isr22 , 8 , 1000111000000000b , 0
dw isr23 , 8 , 1000111000000000b , 0
dw isr24 , 8 , 1000111000000000b , 0
dw isr25 , 8 , 1000111000000000b , 0
dw isr26 , 8 , 1000111000000000b , 0
dw isr27 , 8 , 1000111000000000b , 0
dw isr28 , 8 , 1000111000000000b , 0
dw isr29 , 8 , 1000111000000000b , 0
dw isr30 , 8 , 1000111000000000b , 0
dw isr31 , 8 , 1000111000000000b , 0
dw irq0 , 8 , 1000111000000000b , 0
dw irq1 , 8 , 1000111000000000b , 0
dw irq2 , 8 , 1000111000000000b , 0
dw irq3 , 8 , 1000111000000000b , 0
dw irq4 , 8 , 1000111000000000b , 0
dw irq5 , 8 , 1000111000000000b ,0
dw irq6 , 8 , 1000111000000000b , 0
dw irq7 , 8 , 1000111000000000b , 0
idt_B:
idt:
dw idt_B - idt_A - 1
dd idt_A
...
jmp 8:a1
times 800 -($-$$) db 0 ; 498
a1:
mov byte[0xB8004], "3"
mov byte[0xB8005], 00011011b
hlt
Code: Select all
push cs
push a1
retf
My GDT is an avrage gdt , nothing fancy
Code: Select all
cli
lgdt [gdt]
mov eax,17
mov cr0,eax
jmp 8:Mode32
gdt_A:
NullDescriptor:
dq 0
CodeDescriptor: ; CodeDescriptor = 8
dw 0FFFFh
dw 0
db 0
db 10011010b
db 11001111b
db 0
DataDescriptor: ; DataDescriptor = 16
dw 0FFFFh
dw 0
db 0
db 10010010b
db 11001111b
db 0
gdt_B:
gdt:
dw gdt_B - gdt_A - 1
dd gdt_A
Why can't I jump anywhere I want?