Home | History | Annotate | Line # | Download | only in gen
fpgetmask.c revision 1.1
      1  1.1  chs /*	$NetBSD: fpgetmask.c,v 1.1 2004/07/24 19:09:29 chs 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.1  chs #include <sys/types.h>
     10  1.1  chs #include <ieeefp.h>
     11  1.1  chs 
     12  1.1  chs fp_except
     13  1.1  chs fpgetmask(void)
     14  1.1  chs {
     15  1.1  chs 	uint64_t fpsr;
     16  1.1  chs 
     17  1.1  chs 	__asm__ __volatile__("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
     18  1.1  chs 	return ((fpsr >> 32) & 0x1f);
     19  1.1  chs }
     20