387 traps

Roger Schlafly uunet!borland.com!schlafly
Fri Feb 26 12:04:00 PST 1993


>>Designs like x87 depend on hardware flags with two states:
>>
>>	A) no exception encountered, trap on first one
>>	B) one or more exceptions encountered, do not trap on subsequent ones

I don't think so.  On the 387 an exception is either masked, in which
case a sticky status bit is set, or unmasked, in which case an exception
calls the trap handler every time it occurs.

If you unmask an exception when the status bit is on, an exception
occurs immediately.  Thus, for the original question,

	(disable interrupts)
	X = Y/0
	(enable interrupts)

will cause a trap unless the library routine avoids it.  The question
remains as to whether the library should avoid it.  Maybe the user wants
the interrupt.  If he didn't, he could clear the status bits before
enabling the exceptions.

Roger Schlafly



More information about the Numeric-interest mailing list