1/* $NetBSD: fpsetprec.S,v 1.2 2014/05/22 15:01:56 uebayasi Exp $ */ 2 3/* 4 * Written by Frank van der Linden at Wasabi Systems for NetBSD. 5 * Public domain. 6 */ 7 8#include <machine/asm.h> 9 10/* 11 * XXX set both the x87 control word and the SSE mxcsr register. 12 * Applications should only set exception and round flags 13 * via the fp*() interface, otherwise the status words 14 * will get our of sync. 15 */ 16 17 18#ifdef WEAK_ALIAS 19WEAK_ALIAS(fpsetprec, _fpsetprec) 20ENTRY(_fpsetprec) 21#else 22ENTRY(fpsetprec) 23#endif 24 fnstcw -4(%rsp) 25 26 andl $3,%edi 27 28 movl -4(%rsp),%edx 29 rorl $8,%edx 30 movl %edx,%eax 31 andl $3,%eax 32 33 andl $~3,%edx 34 orl %edi,%edx 35 roll $8,%edx 36 movl %edx,-4(%rsp) 37 38 fldcw -4(%rsp) 39 ret 40#ifdef WEAK_ALIAS 41END(_fpsetprec) 42#else 43END(fpsetprec) 44#endif 45