Use the macros from machine/fsr.h; some minor cleanups.

This commit is contained in:
Thomas Moestl 2002-09-14 18:07:03 +00:00
parent 8579151e4b
commit 6c788325fa

View File

@ -6,6 +6,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <machine/fsr.h>
#include <ieeefp.h>
fp_except_t
@ -15,13 +16,13 @@ fpsetmask(mask)
fp_except_t old;
fp_except_t new;
__asm__("st %%fsr,%0" : "=m" (*&old));
__asm__("st %%fsr,%0" : "=m" (old));
new = old;
new &= ~(0x1f << 23);
new |= ((mask & 0x1f) << 23);
new &= ~FSR_TEM_MASK;
new |= FSR_TEM(mask & FSR_EXC_MASK);
__asm__("ld %0,%%fsr" : : "m" (*&new));
__asm__("ld %0,%%fsr" : : "m" (new));
return (old >> 23) & 0x1f;
return (FSR_GET_TEM(old));
}