xref: /netbsd-src/lib/libc/arch/i386/gen/fpgetround.S (revision 0d34bfa26d596b4f9bcb49175a92020d91572850)
1*0d34bfa2Suebayasi/*	$NetBSD: fpgetround.S,v 1.7 2014/05/23 02:34:19 uebayasi Exp $	*/
2a3a46419Sperry
380bba6a1Sjtc/*
480bba6a1Sjtc * Written by J.T. Conklin, Apr 4, 1995
580bba6a1Sjtc * Public domain.
680bba6a1Sjtc */
780bba6a1Sjtc
880bba6a1Sjtc#include <machine/asm.h>
980bba6a1Sjtc
106dd90d6dSchristos/*
116dd90d6dSchristos * XXX load only x87 state.
126dd90d6dSchristos */
136dd90d6dSchristos
145d3e8294Sthorpej#ifdef WEAK_ALIAS
155d3e8294SthorpejWEAK_ALIAS(fpgetround, _fpgetround)
165d3e8294SthorpejENTRY(_fpgetround)
175d3e8294Sthorpej#else
1880bba6a1SjtcENTRY(fpgetround)
195d3e8294Sthorpej#endif
206dd90d6dSchristos	fnstcw -4(%esp)
216dd90d6dSchristos	movl -4(%esp), %eax
226dd90d6dSchristos	andl $0x00000c00, %eax
2380bba6a1Sjtc	ret
24*0d34bfa2Suebayasi#ifdef WEAK_ALIAS
25*0d34bfa2SuebayasiEND(_fpgetround)
26*0d34bfa2Suebayasi#else
27*0d34bfa2SuebayasiEND(fpgetround)
28*0d34bfa2Suebayasi#endif
29