I Can't Get Interrupts Working: Difference between revisions

[unchecked revision][unchecked revision]
m (Internal link fixed)
Line 58:
 
Each IRQ needs to be acknowledged to the PIC manually by sending an EOI. You need to have <source lang="c"> outb(0x20,0x20) </source> within any master handler and any <source lang="c"> outb(0x20,0x20); outb(0xa0,0x20); </source> within any slave handler.
 
 
Also, if you are following the barebones tutorial, be sure that your main function doesn't exit too soon (because when it does, it disables interrupts). A common solution to make sure it doesn't exit prematurely is to add <source lang="c"> for(;;) {
asm("hlt");
} </source>
to your main kernel function. The ''for'' loop is necessary because execution continues after the CPU receives an interrupt.
 
=== When I try to enable the PIT, the keyboard doesn't work anymore ===
Anonymous user