From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <9704180059.ZM19652@wilbursoft.com> Date: Fri, 18 Apr 1997 00:59:50 -0700 From: Randy Chapman Subject: Re: SIGFPE -- the answer! In-Reply-To: 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 } } #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