rename amd64 architecture to x86_64
[dragonfly.git] / lib / libc / x86_64 / gen / fpsetmask.S
CommitLineData
05ecdcef
SS
1/*
2 * Written by Frank van der Linden at Wasabi Systems for NetBSD.
3 * Public domain.
4 *
5 * $NetBSD: fpsetmask.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $
05ecdcef
SS
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
18WEAK_ALIAS(fpsetmask, _fpsetmask)
19ENTRY(_fpsetmask)
20#else
21ENTRY(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