1*0a6a1f1dSLionel Sambuc/* $NetBSD: fpsetround.S,v 1.6 2014/05/23 02:34:19 uebayasi Exp $ */ 22fe8fb19SBen Gras 32fe8fb19SBen Gras/* 4f14fb602SLionel Sambuc * Written by Frank van der Linden at Wasabi Systems for NetBSD. 52fe8fb19SBen Gras * Public domain. 62fe8fb19SBen Gras */ 72fe8fb19SBen Gras 82fe8fb19SBen Gras#include <machine/asm.h> 92fe8fb19SBen Gras 10f14fb602SLionel Sambuc/* 11f14fb602SLionel Sambuc * XXX set both the x87 control word 12f14fb602SLionel Sambuc * Applications should only set exception and round flags 13f14fb602SLionel Sambuc */ 14f14fb602SLionel Sambuc 15f14fb602SLionel Sambuc 162fe8fb19SBen Gras#ifdef WEAK_ALIAS 172fe8fb19SBen GrasWEAK_ALIAS(fpsetround, _fpsetround) 182fe8fb19SBen GrasENTRY(_fpsetround) 192fe8fb19SBen Gras#else 202fe8fb19SBen GrasENTRY(fpsetround) 212fe8fb19SBen Gras#endif 222fe8fb19SBen Gras 23f14fb602SLionel Sambuc fnstcw -4(%esp) 24f14fb602SLionel Sambuc movl -4(%esp), %edx 25f14fb602SLionel Sambuc movl %edx, %eax 26f14fb602SLionel Sambuc andl $0x00000c00, %eax 27f14fb602SLionel Sambuc andl $0xfffff3ff, %edx 28f14fb602SLionel Sambuc movl 4(%esp), %ecx 292fe8fb19SBen Gras orl %ecx, %edx 30f14fb602SLionel Sambuc movl %edx, -4(%esp) 31f14fb602SLionel Sambuc fldcw -4(%esp) 322fe8fb19SBen Gras 332fe8fb19SBen Gras ret 34*0a6a1f1dSLionel Sambuc#ifdef WEAK_ALIAS 35*0a6a1f1dSLionel SambucEND(_fpsetround) 36*0a6a1f1dSLionel Sambuc#else 37*0a6a1f1dSLionel SambucEND(fpsetround) 38*0a6a1f1dSLionel Sambuc#endif 39