1/* $OpenBSD: fpsetmask.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2/* $NetBSD: fpsetmask.S,v 1.3 2002/06/12 19:17:22 fvdl 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 control 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#ifdef WEAK_ALIAS 19WEAK_ALIAS(fpsetmask, _fpsetmask) 20ENTRY(_fpsetmask) 21#else 22ENTRY(fpsetmask) 23#endif 24 fnstcw -4(%rsp) 25 stmxcsr -8(%rsp) 26 andl $63,%edi 27 notl %edi 28 29 movl -4(%rsp),%edx 30 movl %edx,%eax 31 andl %edi,%edx 32 movl %edx,-4(%rsp) 33 34 movl -8(%rsp),%edx 35 roll $7,%edi 36 andl %edi,%edx 37 movl %edx,-8(%rsp) 38 39 fldcw -4(%rsp) 40 ldmxcsr -8(%rsp) 41 andl $63,%eax 42 ret 43