Interrupt Sharing

by Jeff Newmiller <>

Notice that an ISA slot has two connectors right next to each other... the original PC only had an 8 bit bus, and only 8 interrupt signals. The "standard" serial card was designed for this situation, and so was the BIOS and thus MS-DOS. I think the origin of the third and fourth "standard" port hardware definition was an "enhanced" serial card that supported four ports by sharing the interrupts on the card. Using two out of eight interrupts for serial ports was probably appropriate at the time.

The design screwup was a subtle one, made quite possibly because they had one type of chip laying around, and not another.

Most TTL signal outputs force the voltage to 5 volts or to 0 volts ("totem pole" from the way the schematic of that circuit looks). This arrangement will not be happy if two outputs are connected to the same wire, because if they disagree then the high output will put out as much current as it can in an effort to force the signal high, and the low output will suck up as much current as it can to force the output low. The result is like a short circuit to ground, and if the parts don't burn up or the supply voltage get pulled down, then it is anybody's guess as to what the actual output voltage will be.

Interrupt outputs typically only force the signal low, and just back off otherwise ("wired-or", or "open collector"). If there is a resistor between the signal and the power supply, then when the interrupt signal backs off, the signal will float up to the supply voltage. (The resistor sort of acts like a "spring" hanging from something, and the open collector outputs like someone grabbing one end and pulling down on it or letting go. No problem if two people pull down, as long as nobody pulls up.)

ISA interrupt lines are driven with circuits that are kind of a mix between wired-or and totem-pole outputs... when they are disabled, they act like they are disconnected entirely, but when they are enabled, they act like totem-pole outputs. Thus, you can put a multifunction ISA card in and disable, say, the serial port, without causing problems with an existing serial port. However, only one card is allowed to actually use an interrupt wire at a time! (EISA uses open-collector outputs, so it can share interrupts on the hardware side.)

On the software side, interrupt service routines (ISRs) traditionally put a pointer to themselves in a special memory location so they will be notified when the interrupt signal comes in. Part of doing this is usually to save a copy of the pointer that was stored there before the ISR installed itself (even if only to restore that pointer when the ISR is removed). To share an interrupt, the ISR installed first must silently ignore interrupts that its hardware didn't generate, and the ISR installed second must remember to call the first ISR before it finishes its own work and returns.

Linux did not support serial port IRQ sharing until version 2.2, but I haven't yet learned what this means to people like you and I who want to setup multiple serial ports yet. (Actually, I was surprised to learn that the it DIDN'T support interrupt sharing, since it is easy to do and there are PC busses that do support hardware sharing.)