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
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.
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]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 .ident "%Z%%M% %I% %E% SMI"
34 .weak __fsr_init_value
37 .4byte __fsr_init_value
38 .type __fsr_init_value_ptr,@object
39 .size __fsr_init_value_ptr,4
42 * The following table maps trap enable bits in __fsr_init_value
43 * (after shifting right one bit):
45 * bit 0 - inexact trap
46 * bit 1 - division trap
47 * bit 2 - underflow trap
48 * bit 3 - overflow trap
49 * bit 4 - invalid trap
51 * to exception masks in the floating point control word
53 * bit 0 - invalid mask
54 * bit 2 - zero divide mask
55 * bit 3 - overflow mask
56 * bit 4 - underflow mask
57 * bit 5 - inexact mask
60 .type trap_table,@object
101 .type __fsr,@function
109 lea __fsr_init_value_ptr
, %ecx
110 movl
(%ecx
),%ecx
/* get the value set by CG */
111 shrl $
1,%ecx
/* get rid of fns bit */
112 cmpl $
0,%ecx
/* if remaining bits are zero */
113 je
3f
/* there's nothing to do */
115 fstcw
0(%esp
) /* store the control word */
118 andl $
0x1f,%edx
/* get the trap enable bits */
119 movb trap_table
(%edx
),%al
120 andb
%al
,0(%esp
) /* unmask the corresponding exceptions */
122 testl $
0x200,%ecx
/* test denormal trap enable */
123 jz
1f
/* skip if zero */
125 andb $
0xfd,0(%esp
) /* unmask denormal exception */
129 andl $
0x60,%edx
/* get the rounding direction */
130 jz
1f
/* skip if zero */
132 movl
%edx
,%eax
/* exchange negative<->tozero */
133 andl $
0x20,%eax
/* leaving nearest and positive */
134 shll $
1,%eax
/* as is */
137 andw $
0xf3ff,0(%esp
) /* update rounding direction */
141 andl $
0x180,%ecx
/* get the rounding precision */
142 jz
1f
/* skip if zero */
144 xorl $
0x180,%ecx
/* reverse bits */
146 andw $
0xfcff,0(%esp
) /* update rounding precision */
150 fldcw
0(%esp
) /* load the modified control word */
159 .size __fsr,[.-__fsr]