[BACK]Return to fpgetsticky.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / arch / sparc64 / gen

File: [cvs.NetBSD.org] / src / lib / libc / arch / sparc64 / gen / fpgetsticky.c (download)

Revision 1.5, Sun Mar 6 10:32:47 2011 UTC (13 years, 1 month ago) by martin
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, cherry-xenmp-base, cherry-xenmp
Branch point for: yamt-pagecache
Changes since 1.4: +14 -3 lines

While we use hardware (for float and double), but cooperate with softfloat
(to do long double), we need to not only handle the hardware exception
mask and cummulated flags, but also update/query the softfloat variables.
Since this may go away sometime (to make us psABI compliant), ifdef it
properly.

/*	$NetBSD: fpgetsticky.c,v 1.5 2011/03/06 10:32:47 martin Exp $	*/

/*
 * Written by J.T. Conklin, Apr 10, 1995
 * Public domain.
 */

#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetsticky.c,v 1.5 2011/03/06 10:32:47 martin Exp $");
#endif /* LIBC_SCCS and not lint */

#include "namespace.h"

#include <ieeefp.h>

#ifdef __weak_alias
__weak_alias(fpgetsticky,_fpgetsticky)
#endif

#ifdef EXCEPTIONS_WITH_SOFTFLOAT
extern fp_except _softfloat_float_exception_flags;
#endif

fp_except
fpgetsticky()
{
	int x;
	fp_except res;

	__asm("st %%fsr,%0" : "=m" (*&x));
	res = (x >> 5) & 0x1f;

#ifdef EXCEPTIONS_WITH_SOFTFLOAT
	res |= _softfloat_float_exception_flags;
#endif

	return res;
}