xref: /titanic_50/usr/src/lib/libc/amd64/fp/fpcw.s (revision bdb9230ac765cb7af3fc1f4119caf2c5720dceb3)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26	.file	"fpcw.s"
27
28#include <SYS.h>
29
30	ENTRY(_getcw)
31	fstcw	(%rdi)
32	ret
33	SET_SIZE(_getcw)
34
35	ENTRY(_putcw)
36	subq	$8,%rsp
37	movq	%rdi,(%rsp)
38	fldcw	(%rsp)
39	addq	$8,%rsp
40	ret
41	SET_SIZE(_putcw)
42
43	ENTRY(_getsw)
44	fstsw	(%rdi)
45	ret
46	SET_SIZE(_getsw)
47
48	ENTRY(_putsw)
49	andq	$0x3f,%rdi
50	jnz	1f
51	fnclex
52	ret
531:
54	subq	$32,%rsp
55	fnstsw	%ax
56	fnstenv	(%rsp)
57	andw	$0xffc0,%ax
58	orw	%ax,%di
59	movw	%di,4(%rsp)
60	fldenv	(%rsp)
61	addq	$32,%rsp
62	ret
63	SET_SIZE(_putsw)
64
65	ENTRY(_getmxcsr)
66	stmxcsr	(%rdi)
67	ret
68	SET_SIZE(_getmxcsr)
69
70	ENTRY(_putmxcsr)
71	subq	$8,%rsp
72	movq	%rdi,(%rsp)
73	ldmxcsr	(%rsp)
74	addq	$8,%rsp
75	ret
76	SET_SIZE(_putmxcsr)
77