fpsetsticky.S revision 1.4 1 /* $NetBSD: fpsetsticky.S,v 1.4 2004/03/05 16:27:56 drochner 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
32 orl %edi,%edx
33 movl %edx,-24(%rsp)
34
35 movl -32(%rsp),%edx
36 orl %edx,%eax
37 andl $63,%eax
38 andb $0xc0,%dl
39 orl %edi,%edx
40 movl %edx,-32(%rsp)
41
42 ldmxcsr -32(%rsp)
43 fldenv -28(%rsp)
44 ret
45