Home | History | Annotate | Line # | Download | only in gen
      1 /*	$NetBSD: fpsetround.S,v 1.6 2014/05/23 02:34:19 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 control word
     12  * Applications should only set exception and round flags
     13  */
     14 
     15 
     16 #ifdef WEAK_ALIAS
     17 WEAK_ALIAS(fpsetround, _fpsetround)
     18 ENTRY(_fpsetround)
     19 #else
     20 ENTRY(fpsetround)
     21 #endif
     22 
     23 	fnstcw	-4(%esp)
     24 	movl	-4(%esp), %edx
     25 	movl	%edx, %eax
     26 	andl	$0x00000c00, %eax
     27 	andl	$0xfffff3ff, %edx
     28 	movl	4(%esp), %ecx
     29 	orl	%ecx, %edx
     30 	movl	%edx, -4(%esp)
     31 	fldcw	-4(%esp)
     32 
     33 	ret
     34 #ifdef WEAK_ALIAS
     35 END(_fpsetround)
     36 #else
     37 END(fpsetround)
     38 #endif
     39