xref: /openbsd/lib/libc/arch/amd64/gen/fpgetmask.S (revision 73471bf0)
1/*	$OpenBSD: fpgetmask.S,v 1.3 2018/07/03 23:14:05 mortimer Exp $	*/
2/*	$NetBSD: fpgetmask.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 only read x87 control word here. If an application only
13 * uses the fp* interface to manipulate FP bits, it should
14 * always remain in sync with the SSE mxcsr register.
15 */
16
17#ifdef WEAK_ALIAS
18WEAK_ALIAS(fpgetmask, _fpgetmask)
19ENTRY(_fpgetmask)
20#else
21ENTRY(fpgetmask)
22#endif
23	RETGUARD_SETUP(fpgetmask, r11)
24	fnstcw -4(%rsp)
25	movl -4(%rsp),%eax
26	notl %eax
27	andl $63,%eax
28	RETGUARD_CHECK(fpgetmask, r11)
29	ret
30#ifdef WEAK_ALIAS
31END(_fpgetmask)
32#else
33END(fpgetmask)
34#endif
35