1/* $OpenBSD: fpsetsticky.S,v 1.3 2015/05/29 08:50:12 uebayasi Exp $ */ 2/* $NetBSD: fpsetsticky.S,v 1.5 2004/03/09 17:16:13 drochner Exp $ */ 3 4/* 5 * Written by Frank van der Linden at Wasabi Systems for NetBSD 6 * Public domain. 7 */ 8 9#include <machine/asm.h> 10 11/* 12 * XXX set both the x87 status word and the SSE mxcsr register. 13 * Applications should only set exception and round flags 14 * via the fp*() interface, otherwise the status words 15 * will get our of sync. 16 */ 17 18 19#ifdef WEAK_ALIAS 20WEAK_ALIAS(fpsetsticky, _fpsetsticky) 21ENTRY(_fpsetsticky) 22#else 23ENTRY(fpsetsticky) 24#endif 25 fnstenv -28(%rsp) 26 stmxcsr -32(%rsp) 27 28 andl $63,%edi 29 30 movl -24(%rsp),%eax 31 movl %eax,%edx 32 andb $0xc0,%dl 33 34 orl %edi,%edx 35 movl %edx,-24(%rsp) 36 37 movl -32(%rsp),%edx 38 orl %edx,%eax 39 andl $63,%eax 40 andb $0xc0,%dl 41 orl %edi,%edx 42 movl %edx,-32(%rsp) 43 44 ldmxcsr -32(%rsp) 45 fldenv -28(%rsp) 46 ret 47#ifdef WEAK_ALIAS 48END(_fpsetsticky) 49#else 50END(fpsetsticky) 51#endif 52