1 1.5 martin /* $NetBSD: fpgetsticky.c,v 1.5 2011/03/06 10:32:47 martin 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.2 thorpej #include <sys/cdefs.h> 9 1.3 lukem #if defined(LIBC_SCCS) && !defined(lint) 10 1.5 martin __RCSID("$NetBSD: fpgetsticky.c,v 1.5 2011/03/06 10:32:47 martin Exp $"); 11 1.3 lukem #endif /* LIBC_SCCS and not lint */ 12 1.2 thorpej 13 1.2 thorpej #include "namespace.h" 14 1.2 thorpej 15 1.1 eeh #include <ieeefp.h> 16 1.2 thorpej 17 1.2 thorpej #ifdef __weak_alias 18 1.2 thorpej __weak_alias(fpgetsticky,_fpgetsticky) 19 1.2 thorpej #endif 20 1.1 eeh 21 1.5 martin #ifdef EXCEPTIONS_WITH_SOFTFLOAT 22 1.5 martin extern fp_except _softfloat_float_exception_flags; 23 1.5 martin #endif 24 1.5 martin 25 1.1 eeh fp_except 26 1.1 eeh fpgetsticky() 27 1.1 eeh { 28 1.1 eeh int x; 29 1.5 martin fp_except res; 30 1.1 eeh 31 1.4 perry __asm("st %%fsr,%0" : "=m" (*&x)); 32 1.5 martin res = (x >> 5) & 0x1f; 33 1.5 martin 34 1.5 martin #ifdef EXCEPTIONS_WITH_SOFTFLOAT 35 1.5 martin res |= _softfloat_float_exception_flags; 36 1.5 martin #endif 37 1.5 martin 38 1.5 martin return res; 39 1.1 eeh } 40