Subject: Floating point traps
To: None <port-pc532@NetBSD.ORG>
From: Ian Dall <dall@hfrd.dsto.gov.au>
List: port-pc532
Date: 08/23/1995 15:24:41
With lites for the pc532, I have a problem with floating point
traps. When a floating point trap happens, the pc points at the
instruction which faulted. Most processes just core dump on a SIGFPE,
so there is no problem, but recently I discovered that if a process
trys to either catch or ignore SIGFPEs, then the execution takes the
same trap immediately. Hence, you get stuck infinitely repeating the
same trap.
Ideally, one should use the trap to optionally emulate the correct
ieee operation. There are several commercial unixes which allow you
to, for example, get a SIGFPE on a floating divide by zero or have
+-Infinity generated as per the ieee spec. It seems to me that to do
this, one needs to decode the instruction and its operands, optionally
emulate the correct behaviour and position the pc at the end of the
instruction. If you do enough to emulate all the correct behaviour,
including denorms, then you have pretty much written a complete ieee
emulator which would be nice to have.
The question for port-532 folks is, "What does netbsd do with floating
exceptions?" The question for Lites folks is where should this be
done? The micro kernel doesn't seem like the right place. So that
leaves should it be done in the emulator or in the server? I can't
imagine this is ns32k specific in so far as lots of fpus only do the
core ieee functionality in hardware relying on software emulation to
du the tricky bits.
If there is no emulator for the ns32k floating point instructions,
what about a generic one? There must be lots of code in common.
Finally, is any concensus emerging on a standard way for a user program
to alter fpu bahaviour?
Ian