Re: Math emulator (fwd)

From: Peter Holzer <hp_at_nospam.org>
Date: Mon Oct 18 1993 - 09:26:07 PDT

[I seem to have difficulties hitting the right keys. Andy, can you
 configure your mailing-list server to include a Reply-To field? :-)]

You (Andrew Valencia) wrote:

> Not only is their no thought on doing a math emulator, there's no thought
> on supporting a math coprocessor! I would think the best path would be
> to add 387 support (by that, I mean 387 as well as the 387 part of a i486),
> then leave hooks to do emulation when the 387 is absent.

In any case the kernel needs to save the 387 status if a context switch
between two processes using the 387 occurs. This shouldn't be too much
work.

> V7 UNIX did math emulation in the SIGFPE handler. I'd think this would
> be a good first step, since it leaves it out of the kernel.

How about using a soft-float library? If our shared-lib plans ever take
off, this library could use 387 instructions on machines which have one,
and 386 instructions on other machines. Sure this is not as fast as
using inline code, but I think it is a fair compromise if you want to
distribute binaries (If you really want speed, you probably want to
recompile with -mi486 or something, anyway).

Oh, and btw, if you are using soft-float, be sure to use
no-fp-ret-in-387 too. Doesn't make too much sense to need an emulator
just for function returns (like SysV).

GCC 1.37 for Minix used the SIGFPE trampoline and it was really slow (of
course signal delivery is somewhat complicated in Minix. Don't know
about VSTa in this respect).

Hmm, different idea: Can the 387-missing interrupt be redirected to the
offending process without kernel interaction? This would make 387
emulation very easy and fast. Best of both worlds.

Just rambling,
        hp

-- 
   _  | hp@vmars.tuwien.ac.at | Peter Holzer | TU Vienna | CS/Real-Time Systems
|_|_) |------------------------------------------------------------------------
| |   |  ...and it's finished!  It only has to be written.
__/   |         -- Karl Lehenbauer
-- 
   _  | hp@vmars.tuwien.ac.at | Peter Holzer | TU Vienna | CS/Real-Time Systems
|_|_) |------------------------------------------------------------------------
| |   |  ...and it's finished!  It only has to be written.
__/   |         -- Karl Lehenbauer
Received on Mon Oct 18 09:34:04 1993

This archive was generated by hypermail 2.1.8 : Wed Sep 21 2005 - 19:37:12 PDT