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