1 1.4 perry /* $NetBSD: fpgetmask.c,v 1.4 2005/12/24 21:42:32 perry Exp $ */ 2 1.1 chs 3 1.1 chs /* $OpenBSD: fpgetmask.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */ 4 1.1 chs 5 1.1 chs /* 6 1.1 chs * Written by Miodrag Vallat. Public domain 7 1.1 chs */ 8 1.1 chs 9 1.2 lukem #include <sys/cdefs.h> 10 1.2 lukem #if defined(LIBC_SCCS) && !defined(lint) 11 1.4 perry __RCSID("$NetBSD: fpgetmask.c,v 1.4 2005/12/24 21:42:32 perry Exp $"); 12 1.2 lukem #endif /* LIBC_SCCS and not lint */ 13 1.2 lukem 14 1.1 chs #include <sys/types.h> 15 1.1 chs #include <ieeefp.h> 16 1.1 chs 17 1.1 chs fp_except 18 1.1 chs fpgetmask(void) 19 1.1 chs { 20 1.1 chs uint64_t fpsr; 21 1.1 chs 22 1.4 perry __asm volatile("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr)); 23 1.1 chs return ((fpsr >> 32) & 0x1f); 24 1.1 chs } 25