xref: /openbsd-src/lib/libc/arch/amd64/gen/fpgetmask.S (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1/*	$OpenBSD: fpgetmask.S,v 1.2 2015/05/29 08:50:12 uebayasi 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	fnstcw -4(%rsp)
24	movl -4(%rsp),%eax
25	notl %eax
26	andl $63,%eax
27	ret
28#ifdef WEAK_ALIAS
29END(_fpgetmask)
30#else
31END(fpgetmask)
32#endif
33