Redline/source/fpu_exc.c
maride 02061d74c2 Original 1.0.5 code
(as received from Jonas Echterhoff)
2016-04-02 14:43:55 +02:00

33 lines
526 B
C

#ifdef __ppc__
#include <architecture/ppc/fp_regs.h>
#include <fenv.h>
#ifndef SIG_HOLD
#define SIG_HOLD (void (*)(int))5
#endif
void EnableFPUExceptions()
{
long resp;
if(Gestalt(gestaltSystemVersion,&resp)!=noErr)
return;
if(resp<0x00001040)
return;
ppc_fp_scr_t fpscr=get_fp_scr();
fpscr.ze=1;
fpscr.ni=1;
/* fpscr.oe=1;
fpscr.ue=1;
fpscr.ve=1;*/
set_fp_scr(fpscr);
feclearexcept(FE_ALL_EXCEPT);
signal(SIGFPE,SIG_HOLD);
printf("FPU Exceptions enabled.\n");
}
#else
void EnableFPUExceptions()
{
}
#endif