Print this page
8609 want a position independent CRT
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/common/i386/fsr.s
+++ new/usr/src/lib/crt/i86/fsr.s
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 - .ident "%Z%%M% %I% %E% SMI"
27 +#include <sys/asm_linkage.h>
28 28
29 29 .file "fsr.s"
30 30
31 31 .section .data
32 32 .align 4
33 33
34 - .weak __fsr_init_value
35 -
36 -__fsr_init_value_ptr:
37 - .4byte __fsr_init_value
38 - .type __fsr_init_value_ptr,@object
39 - .size __fsr_init_value_ptr,4
40 -
41 34 /*
42 35 * The following table maps trap enable bits in __fsr_init_value
43 36 * (after shifting right one bit):
44 37 *
45 38 * bit 0 - inexact trap
46 39 * bit 1 - division trap
47 40 * bit 2 - underflow trap
48 41 * bit 3 - overflow trap
49 42 * bit 4 - invalid trap
50 43 *
51 44 * to exception masks in the floating point control word
52 45 *
53 46 * bit 0 - invalid mask
54 47 * bit 2 - zero divide mask
55 48 * bit 3 - overflow mask
56 49 * bit 4 - underflow mask
57 50 * bit 5 - inexact mask
58 51 */
59 52 .local trap_table
60 53 .type trap_table,@object
61 54 trap_table:
62 55 .byte 0b11111111
63 56 .byte 0b11011111
64 57 .byte 0b11111011
65 58 .byte 0b11011011
66 59 .byte 0b11101111
67 60 .byte 0b11001111
68 61 .byte 0b11101011
69 62 .byte 0b11001011
70 63 .byte 0b11110111
71 64 .byte 0b11010111
72 65 .byte 0b11110011
73 66 .byte 0b11010011
74 67 .byte 0b11100111
75 68 .byte 0b11000111
76 69 .byte 0b11100011
77 70 .byte 0b11000011
78 71 .byte 0b11111110
79 72 .byte 0b11011110
80 73 .byte 0b11111010
81 74 .byte 0b11011010
82 75 .byte 0b11101110
83 76 .byte 0b11001110
84 77 .byte 0b11101010
85 78 .byte 0b11001010
86 79 .byte 0b11110110
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
87 80 .byte 0b11010110
88 81 .byte 0b11110010
89 82 .byte 0b11010010
90 83 .byte 0b11100110
91 84 .byte 0b11000110
92 85 .byte 0b11100010
93 86 .byte 0b11000010
94 87
95 88 .size trap_table,32
96 89
97 - .section .text
98 - .align 4
99 -
100 - .globl __fsr
101 - .type __fsr,@function
102 -__fsr:
90 +ENTRY_NP(__fsr)
103 91 pushl %ebp
104 92 movl %esp,%ebp
105 93 pushl %edx
106 94 pushl %ecx
95 + pushl %ebx
107 96 subl $4,%esp
108 97
109 - lea __fsr_init_value_ptr, %ecx
110 - movl (%ecx),%ecx /* get the value set by CG */
98 + /* Setup PIC */
99 + call 9f
100 +9: popl %ebx
101 + addl $_GLOBAL_OFFSET_TABLE_ + [. - 9b], %ebx
102 +
103 + movl 8(%ebp), %ecx /* the value set by CG is passed in */
111 104 shrl $1,%ecx /* get rid of fns bit */
112 105 cmpl $0,%ecx /* if remaining bits are zero */
113 106 je 3f /* there's nothing to do */
114 107
115 108 fstcw 0(%esp) /* store the control word */
116 109
117 110 movl %ecx,%edx
118 111 andl $0x1f,%edx /* get the trap enable bits */
119 - movb trap_table(%edx),%al
112 + movl trap_table@GOT(%ebx), %eax
113 + addl %eax,%edx
114 + movb (%edx),%al
120 115 andb %al,0(%esp) /* unmask the corresponding exceptions */
121 116
122 117 testl $0x200,%ecx /* test denormal trap enable */
123 118 jz 1f /* skip if zero */
124 119
125 120 andb $0xfd,0(%esp) /* unmask denormal exception */
126 121
127 122 1:
128 123 movl %ecx,%edx
129 124 andl $0x60,%edx /* get the rounding direction */
130 125 jz 1f /* skip if zero */
131 126
132 127 movl %edx,%eax /* exchange negative<->tozero */
133 128 andl $0x20,%eax /* leaving nearest and positive */
134 129 shll $1,%eax /* as is */
135 130 xorl %eax,%edx
136 131 shll $5,%edx
137 132 andw $0xf3ff,0(%esp) /* update rounding direction */
138 133 orw %dx,0(%esp)
139 134
140 135 1:
141 136 andl $0x180,%ecx /* get the rounding precision */
142 137 jz 1f /* skip if zero */
143 138
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
144 139 xorl $0x180,%ecx /* reverse bits */
145 140 shll $1,%ecx
146 141 andw $0xfcff,0(%esp) /* update rounding precision */
147 142 orw %cx,0(%esp)
148 143
149 144 1:
150 145 fldcw 0(%esp) /* load the modified control word */
151 146
152 147 3:
153 148 addl $4,%esp
149 + popl %ebx
154 150 popl %ecx
155 151 popl %edx
156 152 popl %ebp
157 153 ret
158 -
159 - .size __fsr,[.-__fsr]
154 +SET_SIZE(__fsr)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX