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