1/* $OpenBSD: fpsetround.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */ 2/* 3 * Written by Charles M. Hannum, Apr 9, 1995 4 * Public domain. 5 */ 6 7#include <machine/asm.h> 8 9ENTRY(fpsetround) 10 subl $4,%esp 11 12 fnstcw (%esp) 13 movl (%esp),%eax 14 15 rorl $10,%eax 16 movl %eax,%edx 17 andl $3,%eax 18 19 subl %eax,%edx 20 movl 8(%esp),%ecx 21 andl $3,%ecx 22 orl %ecx,%edx 23 roll $10,%edx 24 movl %edx,(%esp) 25 fldcw (%esp) 26 27 addl $4,%esp 28 ret 29