Subject: [fpe] posting floating point exceptions to the processes
To: None <macbsd-development@NetBSD.ORG>
From: Ken Nakata <kxn3796@hertz.njit.edu>
List: macbsd-development
Date: 09/21/1994 11:17:38
Hi,

To be short, would the following scheme work?  I think, it's a lot
easier to post a signal when fpe detects an exception than to imitate
real FPCP behavior which would require making up stack frame and
jumping to the appropriate exception handler.  I looked up i386 fpe
code, but it doesn't seem to generate a signal when it detects an
exception (it does only for illegal instructions?).

eg)

struct fpr; /* internal representation of extended float */

/* Fdiv: dst <- src2 / src1 */
void Fdiv(struct fpr *src1, struct fpr *src2, struct fpr *dst)
{
  if (IS_ZERO(src1) &&
      IS_ENABLED(DZ_EXCP)) {
    psignal(u.u_procp->p_pid, SIGFPR);
    sleep(WHATEVER_THE_VALUE_TO_PUT_THE_PROCESS_TO_SLEEP);
  }
  DO_REAL_WORK;
}

I hope meaning of these pseudo-macros (e.g. IS_ZERO()) are obvious to
anyone.  My main concern is that it obviously wouldn't work if it's
called from the bottom half of the kernel.

Any suggestion is appreciated.

Ken

PS. I'm working on fpe on my Ultrix account (hertz.njit.edu) with
2Mbytes/300files disk quota... :( I'll set up my SE/30 again as soon
as possible, but it will take some time (a week or two, maybe).

PPS. By the way, does anyone want to sell me an external hard disk?
What I really want is its chasis and power supply, so I don't mind the
capacity.  Any info regarding this would be appreciated as well.