1*0d34bfa2Suebayasi/* $NetBSD: fpsetround.S,v 1.6 2014/05/23 02:34:19 uebayasi Exp $ */ 2a3a46419Sperry 310b402aaSmycroft/* 46dd90d6dSchristos * Written by Frank van der Linden at Wasabi Systems for NetBSD. 510b402aaSmycroft * Public domain. 610b402aaSmycroft */ 710b402aaSmycroft 810b402aaSmycroft#include <machine/asm.h> 910b402aaSmycroft 106dd90d6dSchristos/* 116dd90d6dSchristos * XXX set both the x87 control word 126dd90d6dSchristos * Applications should only set exception and round flags 136dd90d6dSchristos */ 146dd90d6dSchristos 156dd90d6dSchristos 165d3e8294Sthorpej#ifdef WEAK_ALIAS 175d3e8294SthorpejWEAK_ALIAS(fpsetround, _fpsetround) 185d3e8294SthorpejENTRY(_fpsetround) 195d3e8294Sthorpej#else 2010b402aaSmycroftENTRY(fpsetround) 215d3e8294Sthorpej#endif 2210b402aaSmycroft 236dd90d6dSchristos fnstcw -4(%esp) 246dd90d6dSchristos movl -4(%esp), %edx 256dd90d6dSchristos movl %edx, %eax 266dd90d6dSchristos andl $0x00000c00, %eax 276dd90d6dSchristos andl $0xfffff3ff, %edx 28a92b0ce4Schristos movl 4(%esp), %ecx 29a92b0ce4Schristos orl %ecx, %edx 306dd90d6dSchristos movl %edx, -4(%esp) 316dd90d6dSchristos fldcw -4(%esp) 3210b402aaSmycroft 3310b402aaSmycroft ret 34*0d34bfa2Suebayasi#ifdef WEAK_ALIAS 35*0d34bfa2SuebayasiEND(_fpsetround) 36*0d34bfa2Suebayasi#else 37*0d34bfa2SuebayasiEND(fpsetround) 38*0d34bfa2Suebayasi#endif 39