Double Fault Interrupt

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
noobL0l0
Posts: 3
Joined: Wed Apr 14, 2010 8:36 am

Double Fault Interrupt

Post 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
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Double Fault Interrupt

Post 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).
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
noobL0l0
Posts: 3
Joined: Wed Apr 14, 2010 8:36 am

Re: Double Fault Interrupt

Post 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
noobL0l0
Posts: 3
Joined: Wed Apr 14, 2010 8:36 am

Re: Double Fault Interrupt

Post 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
Post Reply