Home | History | Annotate | Line # | Download | only in gen
fpsetmask.S revision 1.3
      1 /*	$NetBSD: fpsetmask.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $	*/
      2 
      3 /*
      4  * Written by Frank van der Linden at Wasabi Systems for NetBSD.
      5  * Public domain.
      6  */
      7 
      8 #include <machine/asm.h>
      9 
     10 /*
     11  * XXX set both the x87 control word and the SSE mxcsr register.
     12  * Applications should only set exception and round flags
     13  * via the fp*() interface, otherwise the status words
     14  * will get our of sync.
     15  */
     16 
     17 #ifdef WEAK_ALIAS
     18 WEAK_ALIAS(fpsetmask, _fpsetmask)
     19 ENTRY(_fpsetmask)
     20 #else
     21 ENTRY(fpsetmask)
     22 #endif
     23 	fnstcw	-4(%rsp)
     24 	stmxcsr	-8(%rsp)
     25 	andl	$63,%edi
     26 	notl	%edi
     27 
     28 	movl	-4(%rsp),%edx
     29 	movl	%edx,%eax
     30 	andl	%edi,%edx
     31 	movl	%edx,-4(%rsp)
     32 
     33 	movl	-8(%rsp),%edx
     34 	roll	$7,%edi
     35 	andl	%edi,%edx
     36 	movl	%edx,-8(%rsp)
     37 
     38 	fldcw	-4(%rsp)
     39 	ldmxcsr	-8(%rsp)
     40 	andl	$63,%eax
     41 	ret
     42