02061d74c2
(as received from Jonas Echterhoff)
33 lines
526 B
C
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 |