1/* $OpenBSD: fpsetsticky.S,v 1.4 2018/07/03 23:14:05 mortimer 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 RETGUARD_SETUP(fpsetsticky, r11) 26 fnstenv -28(%rsp) 27 stmxcsr -32(%rsp) 28 29 andl $63,%edi 30 31 movl -24(%rsp),%eax 32 movl %eax,%edx 33 andb $0xc0,%dl 34 35 orl %edi,%edx 36 movl %edx,-24(%rsp) 37 38 movl -32(%rsp),%edx 39 orl %edx,%eax 40 andl $63,%eax 41 andb $0xc0,%dl 42 orl %edi,%edx 43 movl %edx,-32(%rsp) 44 45 ldmxcsr -32(%rsp) 46 fldenv -28(%rsp) 47 RETGUARD_CHECK(fpsetsticky, r11) 48 ret 49#ifdef WEAK_ALIAS 50END(_fpsetsticky) 51#else 52END(fpsetsticky) 53#endif 54