1*de1699b1Sart /* $OpenBSD: fpsetsticky.c,v 1.1 2001/08/29 01:34:56 art Exp $ */ 2*de1699b1Sart 3*de1699b1Sart /* 4*de1699b1Sart * Written by J.T. Conklin, Apr 10, 1995 5*de1699b1Sart * Public domain. 6*de1699b1Sart */ 7*de1699b1Sart 8*de1699b1Sart #include <ieeefp.h> 9*de1699b1Sart 10*de1699b1Sart fp_except fpsetsticky(sticky)11*de1699b1Sartfpsetsticky(sticky) 12*de1699b1Sart fp_except sticky; 13*de1699b1Sart { 14*de1699b1Sart fp_except old; 15*de1699b1Sart fp_except new; 16*de1699b1Sart 17*de1699b1Sart __asm__("st %%fsr,%0" : "=m" (*&old)); 18*de1699b1Sart 19*de1699b1Sart new = old; 20*de1699b1Sart new &= ~(0x1f << 5); 21*de1699b1Sart new |= ((sticky & 0x1f) << 5); 22*de1699b1Sart 23*de1699b1Sart __asm__("ld %0,%%fsr" : : "m" (*&new)); 24*de1699b1Sart 25*de1699b1Sart return (old >> 5) & 0x1f; 26*de1699b1Sart } 27