1

I am getting continuous GPF after installing the irqs with PIT and enabling interrupts by sti.

This is the IRQ handler code in the :

  void irq_handler(struct regs *r)
  {   
  void (*handler)(struct regs *r);

  handler = irq_routines[r->int_no - 32];
  if (handler)
    handler(r);

  if (r->int_no >= 40)
  {
    outportb(0xA0, 0x20);
  }

  outportb(0x20, 0x20);
  }

irq_rountine is an array of function pointers. I believe my IDT implementations(structures) are correct and setting the IRQs by idt_set_gate(32, (unsigned)irq0, 0x08, 0x8E);.

IRQ common handler code in main.asm :

 irq_common_stub:
 pusha
 push %ds
 push %es
 push %fs
 push %gs
 mov $0x10, %ax
 mov %ax, %ds
 mov %ax, %es
 mov %ax, %fs
 mov %ax, %gs
 mov %esp, %eax
 push %eax
 mov $irq_handler, %eax
 call *%eax
 pop %eax
 pop %gs
 pop %fs
 pop %es
 pop %ds
 popa
 add $0x8, %esp
 iret
4

0 に答える 0