| Commit | Line | Data |
|---|---|---|
| 05ecdcef SS |
1 | /* |
| 2 | * Written by Frank van der Linden at Wasabi Systems for NetBSD | |
| 3 | * Public domain. | |
| 4 | * | |
| 5 | * $NetBSD: fpsetsticky.S,v 1.5 2004/03/09 17:16:13 drochner Exp $ | |
| 05ecdcef SS |
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 | andb $0xc0,%dl | |
| 32 | ||
| 33 | orl %edi,%edx | |
| 34 | movl %edx,-24(%rsp) | |
| 35 | ||
| 36 | movl -32(%rsp),%edx | |
| 37 | orl %edx,%eax | |
| 38 | andl $63,%eax | |
| 39 | andb $0xc0,%dl | |
| 40 | orl %edi,%edx | |
| 41 | movl %edx,-32(%rsp) | |
| 42 | ||
| 43 | ldmxcsr -32(%rsp) | |
| 44 | fldenv -28(%rsp) | |
| 45 | ret |