1/* $NetBSD: fpsetround.S,v 1.5 2011/09/30 23:45:41 christos 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 12 * Applications should only set exception and round flags 13 */ 14 15 16#ifdef WEAK_ALIAS 17WEAK_ALIAS(fpsetround, _fpsetround) 18ENTRY(_fpsetround) 19#else 20ENTRY(fpsetround) 21#endif 22 23 fnstcw -4(%esp) 24 movl -4(%esp), %edx 25 movl %edx, %eax 26 andl $0x00000c00, %eax 27 andl $0xfffff3ff, %edx 28 movl 4(%esp), %ecx 29 orl %ecx, %edx 30 movl %edx, -4(%esp) 31 fldcw -4(%esp) 32 33 ret 34