I'm new to OS development, and I'm currently writing a simple kernel in c.
I (finally) got the interrupts to work, and I mapped my IRQs to interrupts 32-47.
When I fire int $33 for example, the corresponding IRQ handler is correctly called, but I can't get any hardware IRQ.
For example, when I setup the PIT this way :
Code: Select all
irq_install_handler(IRQ0, callback);
// The value we send to the PIT is the value to divide it's input clock
// (1193180 Hz) by, to get our required frequency. Important to note is
// that the divisor must be small enough to fit into 16-bits.
uint32_t divisor = 1193180 / freq;
// Send the command byte.
outb(0x43, 0x36);
// Divisor has to be sent byte-wise, so split here into upper/lower bytes.
uint8_t l = (uint8_t)(divisor & 0xFF);
uint8_t h = (uint8_t)( (divisor>>8) & 0xFF );
// Send the frequency divisor.
outb(0x40, l);
outb(0x40, h);
After the IRQ handler was called, I do
Code: Select all
if (regs->int_no >= 40) // regs->int_no specifies the interrupt number
{
// Send reset signal to slave.
outb(0xA0, 0x20);
}
// Send reset signal to master. (As well as slave, if necessary).
outb(0x20, 0x20);
Thank you in advance, and please excuse me if I'm missing something in my explanation,
alex