Subject: Re: FPU Emulator
To: None <>
From: Ken Nakata <>
List: macbsd-development
Date: 09/01/1994 10:07:23
   Date: Wed, 31 Aug 1994 16:05:57 -0400
   From: "Chris G. Demetriou" <>

   This method has one _significant_ drawback.  Looking in some of the fpsp
   sources (i picked, because it has the most interesting
   name... 8-), you'll find things like:

   so, when running the FPSP emulation code for a given instruction that
   isn't implemented on the '040, you may end up taking numerous traps
   while processing one single trap, which means that:
	   (1) your emulator must be re-entrant

I was aware of that, but didn't think it as a drawback.  A re-entrant
program should use only stack and the registers provided that the processor
status is properly saved... ?  At least that is my impression I got by
writing re-entrant programs (including few device drivers) under
OS-9/68k (which requires most programs be re-entrant), but there may
be some more points I should be aware of in order to make my code
re-entrant under BSD, aren't there?

	   (2) your emulator will be slow as snot (rather than just
		   'slow', as would be expected... 8-) for instructions
		   which aren't implemnted in the '040.

I didn't think of this!  though I can't say I didn't have "FPU-less
machine must be slow anyway" attitude 8-)

   I think this is a reasonable "first step" implementation, but the
   necessary reentrancy might make it more difficult.  'future work'
   after you've done that much, however, would be to write versions of
   the remaining routines, so that they didn't use FP at all.
   (obviously, you wouldn't want, or even be able to, replace the
   FP-using routines, for '040s.)


Thank you (and, of course, Brad Grantham and Adam Kuttel) for your
invaluable comments.  I'm sure there needs still some time until we
have working emulator (or even non-working one...).

Oops, I almost forgot to ask this... Does context switch occur during
the execution of f-line trap handler (i.e. the emulator) or do I have
to explicitly control spl?  (Sorry if this is an obvious question)