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