Annotation of src/lib/libc/arch/x86_64/gen/fpsetround.S, Revision 1.4
1.4 ! christos 1: /* $NetBSD: fpsetround.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */
1.1 fvdl 2:
3: /*
1.3 fvdl 4: * Written by Frank van der Linden at Wasabi Systems for NetBSD.
1.1 fvdl 5: * Public domain.
6: */
7:
8: #include <machine/asm.h>
9:
1.3 fvdl 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:
1.2 thorpej 18: #ifdef WEAK_ALIAS
19: WEAK_ALIAS(fpsetround, _fpsetround)
20: ENTRY(_fpsetround)
21: #else
1.1 fvdl 22: ENTRY(fpsetround)
1.2 thorpej 23: #endif
1.4 ! christos 24:
1.3 fvdl 25: fnstcw -4(%rsp)
1.4 ! christos 26: movl -4(%rsp), %edx
! 27: movl %edx, %eax
! 28: andl $0x00000c00, %eax
! 29: andl $0xfffff3ff, %edx
! 30: orl %edi, %edx
! 31: movl %edx, -4(%rsp)
! 32: fldcw -4(%rsp)
1.3 fvdl 33:
1.4 ! christos 34: stmxcsr -4(%rsp)
! 35: movl -4(%rsp), %edx
! 36: andl $0xffff9fff, %edx
! 37: sall $3, %edi
1.3 fvdl 38: orl %edi,%edx
39: movl %edx,-4(%rsp)
1.4 ! christos 40: ldmxcsr -4(%rsp)
1.3 fvdl 41:
1.1 fvdl 42: ret
CVSweb <webmaster@jp.NetBSD.org>