Hardware IRQs

The term interrupt has been used carelessly in the past to denote interrupts issued by the CPU as well as by external hardware. Savvy readers will certainly have noticed that this is not quite correct. Interrupts cannot be raised directly by processor-external peripherals but must be requested with the help of a standard component known as an interrupt controller that is present in every system.

2Naturally, bus systems with a sophisticated overall design are able to dispense with this option. They provide so many interrupts for hardware devices that there is no need for sharing.

From the peripheral devices (or their slots) electronic lines lead to the component used to send interrupt requests to the interrupt controller. After performing various electro-technical tasks, which are of no further interest to us here, the controller forwards such requests to the interrupt inputs of the CPU. Because peripheral devices cannot directly force interrupts but must request them via the above component, such requests are known more correctly as IRQs, or interrupt requests.

Because, in terms of software, the difference between IRQs and interrupts is not all that great, the two terms are often used interchangeably. This is not a problem as long as it is clear what is meant.

However, one important point concerning the numbering of IRQs and interrupts should not be overlooked as it has an impact on software. Most CPUs make only a small extract from the whole range of available interrupt numbers available for processing hardware interrupts. This range is usually in the middle of the number sequence; for example, IA-32 CPUs provide a total of 16 numbers from 32 to 47.

As any reader who has configured an I/O card on an IA-32 system or has studied the contents of /proc/interrupts knows, IRQ numbering of expansion cards starts at 0 and finishes at 15, provided the classical interrupt controller 8256A is used. This means that there are also 16 different options but with different numerical values. As well as being responsible for the electrical handling of the IRQ signals, the interrupt controller also performs a "conversion" between IRQ number and interrupt number; with the IA-32 system, this is the equivalent of simply adding 32. If a device issues IRQ 9, the CPU produces interrupt 41; this must be taken into account when installing interrupt handlers. Other architectures use other mappings between interrupt and IRQ numbers, but I will not deal with these in detail.

Continue reading here: Processing Interrupts

Was this article helpful?

0 0