Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: SIGFPE -- the answer!
       [not found] <jrp@jrp.tiac.net>
@ 1997-04-18  7:59 ` Randy Chapman
  0 siblings, 0 replies; only message in thread
From: Randy Chapman @ 1997-04-18  7:59 UTC (permalink / raw)


Yup, that and the ieee_set_fp_control bit and -mieee did the charm!  Time to
move on and finish java/linux/axp!!!!

thanks!
--randy

On Apr 16, 11:17pm, RHS Linux User wrote:
} Subject: SIGFPE -- the answer!
} [ cc'ed to axp-list for everyone's edification ]
} Randy,
}
} I can be soooo dense sometimes.  Remember the divide-by-zero
} exception handling problem you were having?  I figured out what
} was *really* going on.
}
} Seeing as I wrote the floating-point emulation code for Linux/Alpha
} (or, more accurately, I wrote the code for another project which I
} then gave to David M-T to hammer into the Linux sources), I shoulda
} known this.
}
} Anyhow: there is a way to turn off those nasty SIGFPE's and get the
} results you want.  It's a "secret" system call (osf_setsysinfo)
} which can be used to set the floating-point exception enable bits
} in the process struct.
}
} Here's da goods:  To read and write the floating-point exception
} enable bits, you can use the following routines:
}
} 	#include <asm/fpu.h>
}
} 	#define __NR_getsysinfo 256
} 	#define __NR_setsysinfo 257
}
} 	unsigned long read_fpe_bits()
} 	{
} 	    unsigned long fpcw;
} 	    syscall(__NR_getsysinfo, 45, &fpcw, sizeof(fpcw), 0, 0);
} 	    return(fpcw & IEEE_TRAP_ENABLE_MASK);
} 	}
}
} 	void write_fpe_bits(unsigned long fpcw)
} 	{
} 	    syscall(__NR_setsysinfo, 14, &fpcw, sizeof(fpcw), 0, 0);
} 	}
}
} The bits themselves are defined in /usr/include/asm/fpu.h.
} Look for "IEEE_TRAP_ENABLE_xxx".  Apparently INV (invalid operand),
} DZE (divide-by-zero) and OVF (overflow) are turned ON by default
} for all processes, and you have to turn them off manually.
}
} Hope this helps!
}
} --
} Jim Paradis   jrp@jrp.tiac.net
} http://www.tiac.net/users/jrp/index.html
} "It's not procrastination, it's my new Just-In-Time Workload Management
System!"
}-- End of excerpt from RHS Linux User

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-04-18  7:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <jrp@jrp.tiac.net>
1997-04-18  7:59 ` SIGFPE -- the answer! Randy Chapman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox