xref: /titanic_44/usr/src/lib/libc/sparcv9/fp/fpsetmask.s (revision b65731f1f612238279eb4d997f43589b535c5646)
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, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*	Copyright (c) 1988 AT&T	*/
23/*	  All Rights Reserved	*/
24
25
26/*	Copyright (c) 1989 by Sun Microsystems, Inc.		*/
27
28.ident	"%Z%%M%	%I%	%E% SMI"
29		/* SVr4.0 1.4.1.9	*/
30
31/*
32 * fp_except fpsetmask(mask)
33 * 	fp_except mask;
34 * set exception masks as defined by user and return
35 * previous setting
36 * any sticky bit set whose corresponding mask is dis-abled
37 * is cleared
38 */
39
40	.file	"fpsetmask.s"
41
42#include <sys/asm_linkage.h>
43
44	ANSI_PRAGMA_WEAK(fpsetmask,function)
45
46#include "synonyms.h"
47
48	ENTRY(fpsetmask)
49	add	%sp, -SA(MINFRAME), %sp	! get an additional word of storage
50	set	0x0f800000, %o4		! mask of trap enable bits
51	sll	%o0, 23, %o1		! move input bits into position
52	st	%fsr, [%sp+STACK_BIAS+ARGPUSH]	! get fsr value
53	ld	[%sp+STACK_BIAS+ARGPUSH], %o0	! load into register
54	and	%o1, %o4, %o1		! generate new fsr value
55	andn	%o0, %o4, %o2
56	or	%o1, %o2, %o1
57	st	%o1, [%sp+STACK_BIAS+ARGPUSH]	! move new fsr value to memory
58	ld	[%sp+STACK_BIAS+ARGPUSH], %fsr	! load fsr with new value
59	and	%o0, %o4, %o0		! mask off bits of interest in old fsr
60	srl	%o0, 23, %o0		! return old trap enable value
61	retl
62	add	%sp, SA(MINFRAME), %sp	! reclaim stack space
63
64	SET_SIZE(fpsetmask)
65