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 #include <sys/asm_linkage.h>
35 * The following table maps trap enable bits in __fsr_init_value
36 * (after shifting right one bit):
38 * bit 0 - inexact trap
39 * bit 1 - division trap
40 * bit 2 - underflow trap
41 * bit 3 - overflow trap
42 * bit 4 - invalid trap
44 * to exception masks in the floating point control word
46 * bit 0 - invalid mask
47 * bit 2 - zero divide mask
48 * bit 3 - overflow mask
49 * bit 4 - underflow mask
50 * bit 5 - inexact mask
53 .type trap_table,@object
101 addl $_GLOBAL_OFFSET_TABLE_
+ [. - 9b], %ebx
103 movl
8(%ebp
), %ecx
/* the value set by CG is passed in */
104 shrl $
1,%ecx
/* get rid of fns bit */
105 cmpl $
0,%ecx
/* if remaining bits are zero */
106 je
3f
/* there's nothing to do */
108 fstcw
0(%esp
) /* store the control word */
111 andl $
0x1f,%edx
/* get the trap enable bits */
112 movl trap_table@GOT
(%ebx
), %eax
115 andb
%al
,0(%esp
) /* unmask the corresponding exceptions */
117 testl $
0x200,%ecx
/* test denormal trap enable */
118 jz
1f
/* skip if zero */
120 andb $
0xfd,0(%esp
) /* unmask denormal exception */
124 andl $
0x60,%edx
/* get the rounding direction */
125 jz
1f
/* skip if zero */
127 movl
%edx
,%eax
/* exchange negative<->tozero */
128 andl $
0x20,%eax
/* leaving nearest and positive */
129 shll $
1,%eax
/* as is */
132 andw $
0xf3ff,0(%esp
) /* update rounding direction */
136 andl $
0x180,%ecx
/* get the rounding precision */
137 jz
1f
/* skip if zero */
139 xorl $
0x180,%ecx
/* reverse bits */
141 andw $
0xfcff,0(%esp
) /* update rounding precision */
145 fldcw
0(%esp
) /* load the modified control word */