I have been following the tutorials at http://www.brokenthorn.com/Resources/OSDevIndex.html and http://www.osdever.net/bkerndev/Docs/intro.htm. I have setup a GDT and IDT that seem to be working correctly. I have also setup all the ISRs and an exception handler function that saves the registers and prints a message to the screen about the interrupt.
The problem is that ISR0 is not being called (or any other ISR) when a DivideByZeroException occurs. Instead of the CPU handling this exception and jumping to and executing the ISR, printing a message that an exception has occured, the CPU just triple faults.
To test the interrupts, I have added the code
Code: Select all
asm("int ")
Code: Select all
printf("%s\n", 4/0)
http://pastebin.com/R2JRVCiT (gdt.asm)
http://pastebin.com/vDZUfRXK (gdt.c)
idt.asm:
Code: Select all
global _idt_install
extern idt_p
_idt_install:
lidt [idt_p]
ret
http://pastebin.com/hAzX2Y11 (isrs.asm)
http://pastebin.com/9z217v7q (isrs.c)
The fault_handler function and all the ISRs seem to be working correctly. If I put
Code: Select all
isr0()
Sorry that I posted a lot of code, I'm just not sure where the problem is. It's also my first post.
I'm using qemu to test my OS with GRUB legacy and am in protected mode.