Page 1 of 1

Double Fault Interrupt

Posted: Wed Apr 14, 2010 8:47 am
by noobL0l0
hello,

these are my verry first steps of os developement. i strugle with the gdt, idt and pic setup.

what i tried to do was a setup in the following order

Code: Select all

int main(){
  gdt_init();
  idt_init();
  pic_init();
  printf("started:)");
}
the strange thing is that i can call each interrupt via "asm volatile ("int $0x2");" but i don't get any hardware interrupts e.g. the keyboard. so i looked in the tuts and found that i've to call "asm volatile("sti");" but if i add this line below "pic_init();" i recieve a int 8 with i linked with the string "double fault"

the problem is i don't know where the error is and hope somebody can help me to get around this problem

sorry for my horrible english

lolo

Re: Double Fault Interrupt

Posted: Wed Apr 14, 2010 9:02 am
by Combuster
Did you try to run your OS in bochs? Does it give more detailed complaints?

Does you init_pic code work as expected? Most initial set-ups aren't that advanced so that the problems causing a doublefault do not apply to that specific handler, and you're looking at a timer interrupt (which is routed through int8 at boot).

Re: Double Fault Interrupt

Posted: Wed Apr 14, 2010 9:20 am
by noobL0l0
i use QEMU 0.9.1 (it didn't produce a register dump;) and my pic setup looks like the code block appended
i've seen implementations using a "sleep(1 sec)" between each command is this required?
Combuster wrote: Does you init_pic code work as expected?
i really don't know is there a way to figure it out?

Code: Select all

void init_pic(){
  outb(0x20, 0x11);
  outb(0xA0, 0x11);
  outb(0x21, 0x20);
  outb(0xA1, 0x28);
  outb(0x21, 0x04);
  outb(0xA1, 0x02);
  outb(0x21, 0x01);
  outb(0xA1, 0x01);
  outb(0x21, 0x0);
  outb(0xA1, 0x0);
}
thanx for the fast reply

Re: Double Fault Interrupt

Posted: Wed Apr 14, 2010 11:03 am
by noobL0l0
i think i figured it out. it was a more than stupid error. i swapped the the first and second param inside my outportb() function #-o . now i receive a int 0x20 which might be a timer interrupt (IRQ 0) hooked with 0x20.

@Combuster thanks a lot for pushing me in the right direction