Home | History | Annotate | Line # | Download | only in gen
      1 /*	$NetBSD: fpsetsticky.S,v 1.6 2014/05/22 15:01:56 uebayasi 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 status 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 
     18 #ifdef WEAK_ALIAS
     19 WEAK_ALIAS(fpsetsticky, _fpsetsticky)
     20 ENTRY(_fpsetsticky)
     21 #else
     22 ENTRY(fpsetsticky)
     23 #endif
     24 	fnstenv	-28(%rsp)
     25 	stmxcsr	-32(%rsp)
     26 
     27 	andl	$63,%edi
     28 
     29 	movl	-24(%rsp),%eax
     30 	movl	%eax,%edx
     31 	andb	$0xc0,%dl
     32 
     33 	orl	%edi,%edx
     34 	movl	%edx,-24(%rsp)
     35 
     36 	movl	-32(%rsp),%edx
     37 	orl	%edx,%eax
     38 	andl	$63,%eax
     39 	andb	$0xc0,%dl
     40 	orl	%edi,%edx
     41 	movl	%edx,-32(%rsp)
     42 
     43 	ldmxcsr	-32(%rsp)
     44 	fldenv	-28(%rsp)
     45 	ret
     46 #ifdef WEAK_ALIAS
     47 END(_fpsetsticky)
     48 #else
     49 END(fpsetsticky)
     50 #endif
     51