1*adeb86ddSuebayasi/* $NetBSD: fpsetmask.S,v 1.6 2014/05/22 15:01:56 uebayasi Exp $ */ 210f59d7bSfvdl 310f59d7bSfvdl/* 44f2f06c9Sfvdl * Written by Frank van der Linden at Wasabi Systems for NetBSD. 510f59d7bSfvdl * Public domain. 610f59d7bSfvdl */ 710f59d7bSfvdl 810f59d7bSfvdl#include <machine/asm.h> 910f59d7bSfvdl 104f2f06c9Sfvdl/* 114f2f06c9Sfvdl * XXX set both the x87 control word and the SSE mxcsr register. 124f2f06c9Sfvdl * Applications should only set exception and round flags 134f2f06c9Sfvdl * via the fp*() interface, otherwise the status words 144f2f06c9Sfvdl * will get our of sync. 154f2f06c9Sfvdl */ 164f2f06c9Sfvdl 175d3e8294Sthorpej#ifdef WEAK_ALIAS 185d3e8294SthorpejWEAK_ALIAS(fpsetmask, _fpsetmask) 195d3e8294SthorpejENTRY(_fpsetmask) 205d3e8294Sthorpej#else 2110f59d7bSfvdlENTRY(fpsetmask) 225d3e8294Sthorpej#endif 234f2f06c9Sfvdl notl %edi 24a988f62dSnjoly andl $0x0000003f,%edi 254f2f06c9Sfvdl 26a988f62dSnjoly fnstcw -4(%rsp) 274f2f06c9Sfvdl movl -4(%rsp), %edx 284f2f06c9Sfvdl movl %edx, %eax 29a988f62dSnjoly andl $0xffffffc0, %edx 30a988f62dSnjoly orl %edi, %edx 3110f59d7bSfvdl movl %edx,-4(%rsp) 3210f59d7bSfvdl fldcw -4(%rsp) 33a988f62dSnjoly 34a988f62dSnjoly stmxcsr -4(%rsp) 35a988f62dSnjoly movl -4(%rsp), %edx 36640797b5Sdrochner andl $0xffffe07f, %edx 37a988f62dSnjoly sall $7, %edi 38a988f62dSnjoly orl %edi, %edx 39a988f62dSnjoly movl %edx,-4(%rsp) 40a988f62dSnjoly ldmxcsr -4(%rsp) 41a988f62dSnjoly 42a988f62dSnjoly notl %eax 43a988f62dSnjoly andl $0x0000003f, %eax 4410f59d7bSfvdl ret 45*adeb86ddSuebayasi#ifdef WEAK_ALIAS 46*adeb86ddSuebayasiEND(_fpsetmask) 47*adeb86ddSuebayasi#else 48*adeb86ddSuebayasiEND(fpsetmask) 49*adeb86ddSuebayasi#endif 50