1 1.1.12.1 nathanw /* $NetBSD: fpsetmask.c,v 1.1.12.1 2002/01/28 20:50:18 nathanw Exp $ */ 2 1.1 eeh 3 1.1 eeh /* 4 1.1 eeh * Written by J.T. Conklin, Apr 10, 1995 5 1.1 eeh * Public domain. 6 1.1 eeh */ 7 1.1 eeh 8 1.1.12.1 nathanw #include <sys/cdefs.h> 9 1.1.12.1 nathanw 10 1.1.12.1 nathanw #include "namespace.h" 11 1.1.12.1 nathanw 12 1.1 eeh #include <ieeefp.h> 13 1.1.12.1 nathanw 14 1.1.12.1 nathanw #ifdef __weak_alias 15 1.1.12.1 nathanw __weak_alias(fpsetmask,_fpsetmask) 16 1.1.12.1 nathanw #endif 17 1.1 eeh 18 1.1 eeh fp_except 19 1.1 eeh fpsetmask(mask) 20 1.1 eeh fp_except mask; 21 1.1 eeh { 22 1.1 eeh fp_except old; 23 1.1 eeh fp_except new; 24 1.1 eeh 25 1.1 eeh __asm__("st %%fsr,%0" : "=m" (*&old)); 26 1.1 eeh 27 1.1 eeh new = old; 28 1.1 eeh new &= ~(0x1f << 23); 29 1.1 eeh new |= ((mask & 0x1f) << 23); 30 1.1 eeh 31 1.1 eeh __asm__("ld %0,%%fsr" : : "m" (*&new)); 32 1.1 eeh 33 1.1 eeh return (old >> 23) & 0x1f; 34 1.1 eeh } 35