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.
I continue to receive normal keyboard interrupts after unmasking irq0. But irq0 only fires once thus prints "pit called" only once... can anyone please shed some light on this??
possible options are:
[*] you reprogrammed the channel 0 of the PIT the wrong way and it is in "single-shot more"
[*] your printing function is overwriting the same video area again and again
[*] interrupts were disabled (or IRQ0 was masked back) just after the first PIT is handled. One possible cause is a "cli: hlt" that occurs too early (in which case keyboard should respond any longer) or you disabled IRQ0 while unmasking some other IRQ. I would say your IDT should be good if those handlers were called correctly. But indeed, what about the unmasking routine ?
void unmaskIRQ(int irq)
{
unsigned short int ocw1 = 0xffff;
ocw1 &= ~(1 << irq); // enable propriate bit with shifting to left
// invert to enable the interrupt
// use & to not disturb other bits
if (irq < 8)
outb(MASTER + 1, ocw1 & 0xFF); // AND with 0xFF to clear the high 8
// bits because we send to PIC1
else
outb(SLAVE + 1, ocw1 >> 8); // move high 8 bits to low 8 bits
// since we send to PIC2
}
your printing function is overwriting the same video area again and again
No my kprintf function takes care of that.
interrupts were disabled (or IRQ0 was masked back) just after the first PIT is handled.
It might just be me (I've been away for a little while, I'm probably rusty), but isn't your unmasking function only unmasking the last irq you pass to it and masking the rest? I'm getting this from the line
Otherwise, each time you call the function you're telling it to mask everything except the irq you are passing, as opposed to leaving everything the same and just unmasking that irq.
bkilgore wrote:
It might just be me (I've been away for a little while, I'm probably rusty), but isn't your unmasking function only unmasking the last irq you pass to it and masking the rest?
True. That was just the mistake i expected him to make ... So as soon as you enable IRQ0, you get the interrupt that was pending from a loooong time, then the timer ISR returns and you'll unmask the keyboard, masking back the timer.