1/* $OpenBSD: fpgetround.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2/* $NetBSD: fpgetround.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */ 3 4/* 5 * Written by J.T. Conklin, Apr 4, 1995 6 * Public domain. 7 */ 8 9#include <machine/asm.h> 10 11/* 12 * XXX store only x87 state. If an application only uses the fp* 13 * interface, this should be in sync with the SSE mxcsr register. 14 */ 15 16#ifdef WEAK_ALIAS 17WEAK_ALIAS(fpgetround, _fpgetround) 18ENTRY(_fpgetround) 19#else 20ENTRY(fpgetround) 21#endif 22 fnstcw -4(%rsp) 23 movl -4(%rsp),%eax 24 rorl $10,%eax 25 andl $3,%eax 26 ret 27