Sabtu, 21 September 2013

Programming the PIC

What is the PIC?
The PIC is a controller in the PC hardware that handles hardware interrupts (IRQ0, IRQ1, etc.). When there wasn't a PIC, we would have to poll the hardware devices regularly, this would be time expensive. So instead of that, when a hardware interrupt occurs, the PIC gets the signal and sends it to the CPU. The CPU stops execution and processes the interrupt handler. We actually we have two PICs. The first one is for IRQ0-IRQ7, and the second for IRQ8-IRQ15. We must have a connection between PIC1 and PIC2.

The CPU only knows interrupts - it makes no difference between hardware or software interrupts. So it's the
job of the programmer to map the hardware interrupts into interrupts that the CPU understands. In Real Mode, the hardware interrupts are mapped to interrupt 8-15 (first PIC) and 70-77 (second PIC). But that's a problem when we get into Protected Mode because interrupt 8-15 are reserved for exceptions. That would mean that when we would get an exception, the CPU would call a handler for the keyboard, for example. So we have to remap the PICs to use other interrupts...


Summary

That's it - I hope you understood the basic things, and take a look at the link I just gave you above. You will
need some knowledge of programming the PICs as a OS developer, so do not think it's not important.

best regards,
Alexander Blessing

Tidak ada komentar:

Posting Komentar