xref: /titanic_50/usr/src/lib/libc/i386/fp/fpcw.s (revision 34f9b3eef6fdadbda0a846aa4d68691ac40eace5)
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	movl	4(%esp),%eax
32	fstcw	(%eax)
33	ret
34	SET_SIZE(_getcw)
35
36	ENTRY(_putcw)
37	fldcw	4(%esp)
38	ret
39	SET_SIZE(_putcw)
40
41	ENTRY(_getsw)
42	movl	4(%esp),%eax
43	fstsw	(%eax)
44	ret
45	SET_SIZE(_getsw)
46
47	ENTRY(_putsw)
48	movl	4(%esp),%ecx
49	andl	$0x3f,%ecx
50	jnz	1f
51	fnclex
52	ret
531:
54	fnstsw	%ax
55	subl	$28,%esp
56	fnstenv	(%esp)
57	andw	$0xffc0,%ax
58	orw	%ax,%cx
59	movw	%cx,4(%esp)
60	fldenv	(%esp)
61	addl	$28,%esp
62	ret
63	SET_SIZE(_putsw)
64
65	ENTRY(_getmxcsr)
66	movl	4(%esp),%eax
67	stmxcsr	(%eax)
68	ret
69	SET_SIZE(_getmxcsr)
70
71	ENTRY(_putmxcsr)
72	ldmxcsr	4(%esp)
73	ret
74	SET_SIZE(_putmxcsr)
75