xref: /netbsd/lib/libc/arch/x86_64/gen/fpgetmask.S (revision adeb86dd)
1*adeb86ddSuebayasi/*	$NetBSD: fpgetmask.S,v 1.4 2014/05/22 15:01:56 uebayasi Exp $	*/
210f59d7bSfvdl
310f59d7bSfvdl/*
410f59d7bSfvdl * Written by J.T. Conklin, Apr 4, 1995
510f59d7bSfvdl * Public domain.
610f59d7bSfvdl */
710f59d7bSfvdl
810f59d7bSfvdl#include <machine/asm.h>
910f59d7bSfvdl
104f2f06c9Sfvdl/*
114f2f06c9Sfvdl * XXX only read x87 control word here. If an application only
124f2f06c9Sfvdl * uses the fp* interface to manipulate FP bits, it should
134f2f06c9Sfvdl * always remain in sync with the SSE mxcsr register.
144f2f06c9Sfvdl */
154f2f06c9Sfvdl
165d3e8294Sthorpej#ifdef WEAK_ALIAS
175d3e8294SthorpejWEAK_ALIAS(fpgetmask, _fpgetmask)
185d3e8294SthorpejENTRY(_fpgetmask)
195d3e8294Sthorpej#else
2010f59d7bSfvdlENTRY(fpgetmask)
215d3e8294Sthorpej#endif
2210f59d7bSfvdl	fnstcw -4(%rsp)
2310f59d7bSfvdl	movl -4(%rsp),%eax
2410f59d7bSfvdl	notl %eax
2510f59d7bSfvdl	andl $63,%eax
2610f59d7bSfvdl	ret
27*adeb86ddSuebayasi#ifdef WEAK_ALIAS
28*adeb86ddSuebayasiEND(_fpgetmask)
29*adeb86ddSuebayasi#else
30*adeb86ddSuebayasiEND(fpgetmask)
31*adeb86ddSuebayasi#endif
32