[lkml]   [1996]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: int 16 & math error

On Wed, 18 Sep 1996, Ulrich Windl wrote:
> Yesterday I've noticed that in /proc/interrupts int 13 is assigned to
> math error while during boot the messages states my Pentium is using
> exception 16. I'm not a processor guru. Is interrupt 13 used? Is
> interrupt 16 used? Is the information in /proc/interrupts correct?

Welcome to the world of confusion.

The original AT/386 had the math chip error line connected to device
interrupt #13. That's not what intel specified if should do, at least not for
the i387, but hey, we all know IBM engineers know exactly what they are doing
and have good reasons for it, don't we? Snicker. IBM engineers had earlier in
the life of the PC ignored intel's specifications that exceptions 0-31 are
reserved, and I guess that along with backwards compatibility with some
strange original-PC 8087 linkage was to blame for this all.

Note that "device interrupt #13" is NOT the same as "exception #13". The
device interrupts (0-15) can be routed to different exceptions (0-255), and
under Linux, for example, interrupt #x is routed to exception #32+x. Under
DOS, interrupt #x is routed to exception #8+x (x < 8) and #XX+(x&7) (x >= 8,
XX is something strange like 0x78 or something).

Now the DOS interrupt layout is really bad, because exception #8+x is also
where the CPU assigns things like page fault exceptions etc. Oops. Chalk one
up for the BIOS writers, who have a special place in hell waiting for them.

Now, the _intel_ exception for math errors is exception #16. However, the
original IBM design said that that was bad, and math exceptions should come
in on irq#13, so they did some non-standard wiring of the 386/387-coupling
instead of just having a straight connection between them.

At this point I'd like to point out that the IBM nonstandard wiring of the
i387 is _really_ _really_ braindamaged. Not just "a bit wrong", but "so
incredibly stupid that it's scary". There are horrible implications of using
(asychronous and blockable) external interrupts for math errors when you do
things like lazy i387 state saving etc. The intel direct exception #16
handling is a lot better, but IBM totally disabled that with their
motherboard setup.

Anyway, when intel made the integrated FPU's, they were able to fix the IBM
braindamage, but on the other hand they wanted to be compatible with it, so
they left the irq13 stuff in as a "special feature". There is a special
external pin to tell the rest of the world about math errors, just so that
those can be looped back through the interrupt controller. Whee!

End result: Linux always uses exception 16 if it works on that hardware. But
all x86 PC motherboards have irq13 (which maps to exception 45 in Linux) tied
to the same signal, and on non-integrated FPU's that's what Linux has to use.
So you can't use irq13 for anything else.


 \ /
  Last update: 2005-03-22 13:37    [W:0.047 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site