diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2005-08-03 14:49:17 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-08-03 14:49:17 -0400 |
commit | f148af2593ef76ac705d1cc6abe48f455c9912cc (patch) | |
tree | cd1e0b0959624234ca3489df8888434ffea5050e /arch/arm/nwfpe/softfloat.h | |
parent | 1fcf844861eb08ee05e05dba13b5436f2f2e29ed (diff) |
[PATCH] ARM: 2837/2: Re: ARM: Make NWFPE preempt safe
Patch from Richard Purdie
NWFPE used global variables which meant it wasn't safe for use with
preemptive kernels. This patch removes them and communicates the
information between functions in a preempt safe manner. Generation
of some exceptions was broken and this has also been corrected.
Tests with glibc's maths test suite show no change in the results
before/after this patch.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/nwfpe/softfloat.h')
-rw-r--r-- | arch/arm/nwfpe/softfloat.h | 68 |
1 files changed, 29 insertions, 39 deletions
diff --git a/arch/arm/nwfpe/softfloat.h b/arch/arm/nwfpe/softfloat.h index 1e1743173899..1c8799b9ee4d 100644 --- a/arch/arm/nwfpe/softfloat.h +++ b/arch/arm/nwfpe/softfloat.h | |||
@@ -74,7 +74,7 @@ enum { | |||
74 | Software IEC/IEEE floating-point rounding mode. | 74 | Software IEC/IEEE floating-point rounding mode. |
75 | ------------------------------------------------------------------------------- | 75 | ------------------------------------------------------------------------------- |
76 | */ | 76 | */ |
77 | extern signed char float_rounding_mode; | 77 | //extern int8 float_rounding_mode; |
78 | enum { | 78 | enum { |
79 | float_round_nearest_even = 0, | 79 | float_round_nearest_even = 0, |
80 | float_round_to_zero = 1, | 80 | float_round_to_zero = 1, |
@@ -86,7 +86,6 @@ enum { | |||
86 | ------------------------------------------------------------------------------- | 86 | ------------------------------------------------------------------------------- |
87 | Software IEC/IEEE floating-point exception flags. | 87 | Software IEC/IEEE floating-point exception flags. |
88 | ------------------------------------------------------------------------------- | 88 | ------------------------------------------------------------------------------- |
89 | extern signed char float_exception_flags; | ||
90 | enum { | 89 | enum { |
91 | float_flag_inexact = 1, | 90 | float_flag_inexact = 1, |
92 | float_flag_underflow = 2, | 91 | float_flag_underflow = 2, |
@@ -99,7 +98,6 @@ ScottB: November 4, 1998 | |||
99 | Changed the enumeration to match the bit order in the FPA11. | 98 | Changed the enumeration to match the bit order in the FPA11. |
100 | */ | 99 | */ |
101 | 100 | ||
102 | extern signed char float_exception_flags; | ||
103 | enum { | 101 | enum { |
104 | float_flag_invalid = 1, | 102 | float_flag_invalid = 1, |
105 | float_flag_divbyzero = 2, | 103 | float_flag_divbyzero = 2, |
@@ -121,7 +119,7 @@ void float_raise( signed char ); | |||
121 | Software IEC/IEEE integer-to-floating-point conversion routines. | 119 | Software IEC/IEEE integer-to-floating-point conversion routines. |
122 | ------------------------------------------------------------------------------- | 120 | ------------------------------------------------------------------------------- |
123 | */ | 121 | */ |
124 | float32 int32_to_float32( signed int ); | 122 | float32 int32_to_float32( struct roundingData *, signed int ); |
125 | float64 int32_to_float64( signed int ); | 123 | float64 int32_to_float64( signed int ); |
126 | #ifdef FLOATX80 | 124 | #ifdef FLOATX80 |
127 | floatx80 int32_to_floatx80( signed int ); | 125 | floatx80 int32_to_floatx80( signed int ); |
@@ -132,7 +130,7 @@ floatx80 int32_to_floatx80( signed int ); | |||
132 | Software IEC/IEEE single-precision conversion routines. | 130 | Software IEC/IEEE single-precision conversion routines. |
133 | ------------------------------------------------------------------------------- | 131 | ------------------------------------------------------------------------------- |
134 | */ | 132 | */ |
135 | signed int float32_to_int32( float32 ); | 133 | signed int float32_to_int32( struct roundingData *, float32 ); |
136 | signed int float32_to_int32_round_to_zero( float32 ); | 134 | signed int float32_to_int32_round_to_zero( float32 ); |
137 | float64 float32_to_float64( float32 ); | 135 | float64 float32_to_float64( float32 ); |
138 | #ifdef FLOATX80 | 136 | #ifdef FLOATX80 |
@@ -144,13 +142,13 @@ floatx80 float32_to_floatx80( float32 ); | |||
144 | Software IEC/IEEE single-precision operations. | 142 | Software IEC/IEEE single-precision operations. |
145 | ------------------------------------------------------------------------------- | 143 | ------------------------------------------------------------------------------- |
146 | */ | 144 | */ |
147 | float32 float32_round_to_int( float32 ); | 145 | float32 float32_round_to_int( struct roundingData*, float32 ); |
148 | float32 float32_add( float32, float32 ); | 146 | float32 float32_add( struct roundingData *, float32, float32 ); |
149 | float32 float32_sub( float32, float32 ); | 147 | float32 float32_sub( struct roundingData *, float32, float32 ); |
150 | float32 float32_mul( float32, float32 ); | 148 | float32 float32_mul( struct roundingData *, float32, float32 ); |
151 | float32 float32_div( float32, float32 ); | 149 | float32 float32_div( struct roundingData *, float32, float32 ); |
152 | float32 float32_rem( float32, float32 ); | 150 | float32 float32_rem( struct roundingData *, float32, float32 ); |
153 | float32 float32_sqrt( float32 ); | 151 | float32 float32_sqrt( struct roundingData*, float32 ); |
154 | char float32_eq( float32, float32 ); | 152 | char float32_eq( float32, float32 ); |
155 | char float32_le( float32, float32 ); | 153 | char float32_le( float32, float32 ); |
156 | char float32_lt( float32, float32 ); | 154 | char float32_lt( float32, float32 ); |
@@ -164,9 +162,9 @@ char float32_is_signaling_nan( float32 ); | |||
164 | Software IEC/IEEE double-precision conversion routines. | 162 | Software IEC/IEEE double-precision conversion routines. |
165 | ------------------------------------------------------------------------------- | 163 | ------------------------------------------------------------------------------- |
166 | */ | 164 | */ |
167 | signed int float64_to_int32( float64 ); | 165 | signed int float64_to_int32( struct roundingData *, float64 ); |
168 | signed int float64_to_int32_round_to_zero( float64 ); | 166 | signed int float64_to_int32_round_to_zero( float64 ); |
169 | float32 float64_to_float32( float64 ); | 167 | float32 float64_to_float32( struct roundingData *, float64 ); |
170 | #ifdef FLOATX80 | 168 | #ifdef FLOATX80 |
171 | floatx80 float64_to_floatx80( float64 ); | 169 | floatx80 float64_to_floatx80( float64 ); |
172 | #endif | 170 | #endif |
@@ -176,13 +174,13 @@ floatx80 float64_to_floatx80( float64 ); | |||
176 | Software IEC/IEEE double-precision operations. | 174 | Software IEC/IEEE double-precision operations. |
177 | ------------------------------------------------------------------------------- | 175 | ------------------------------------------------------------------------------- |
178 | */ | 176 | */ |
179 | float64 float64_round_to_int( float64 ); | 177 | float64 float64_round_to_int( struct roundingData *, float64 ); |
180 | float64 float64_add( float64, float64 ); | 178 | float64 float64_add( struct roundingData *, float64, float64 ); |
181 | float64 float64_sub( float64, float64 ); | 179 | float64 float64_sub( struct roundingData *, float64, float64 ); |
182 | float64 float64_mul( float64, float64 ); | 180 | float64 float64_mul( struct roundingData *, float64, float64 ); |
183 | float64 float64_div( float64, float64 ); | 181 | float64 float64_div( struct roundingData *, float64, float64 ); |
184 | float64 float64_rem( float64, float64 ); | 182 | float64 float64_rem( struct roundingData *, float64, float64 ); |
185 | float64 float64_sqrt( float64 ); | 183 | float64 float64_sqrt( struct roundingData *, float64 ); |
186 | char float64_eq( float64, float64 ); | 184 | char float64_eq( float64, float64 ); |
187 | char float64_le( float64, float64 ); | 185 | char float64_le( float64, float64 ); |
188 | char float64_lt( float64, float64 ); | 186 | char float64_lt( float64, float64 ); |
@@ -198,31 +196,23 @@ char float64_is_signaling_nan( float64 ); | |||
198 | Software IEC/IEEE extended double-precision conversion routines. | 196 | Software IEC/IEEE extended double-precision conversion routines. |
199 | ------------------------------------------------------------------------------- | 197 | ------------------------------------------------------------------------------- |
200 | */ | 198 | */ |
201 | signed int floatx80_to_int32( floatx80 ); | 199 | signed int floatx80_to_int32( struct roundingData *, floatx80 ); |
202 | signed int floatx80_to_int32_round_to_zero( floatx80 ); | 200 | signed int floatx80_to_int32_round_to_zero( floatx80 ); |
203 | float32 floatx80_to_float32( floatx80 ); | 201 | float32 floatx80_to_float32( struct roundingData *, floatx80 ); |
204 | float64 floatx80_to_float64( floatx80 ); | 202 | float64 floatx80_to_float64( struct roundingData *, floatx80 ); |
205 | |||
206 | /* | ||
207 | ------------------------------------------------------------------------------- | ||
208 | Software IEC/IEEE extended double-precision rounding precision. Valid | ||
209 | values are 32, 64, and 80. | ||
210 | ------------------------------------------------------------------------------- | ||
211 | */ | ||
212 | extern signed char floatx80_rounding_precision; | ||
213 | 203 | ||
214 | /* | 204 | /* |
215 | ------------------------------------------------------------------------------- | 205 | ------------------------------------------------------------------------------- |
216 | Software IEC/IEEE extended double-precision operations. | 206 | Software IEC/IEEE extended double-precision operations. |
217 | ------------------------------------------------------------------------------- | 207 | ------------------------------------------------------------------------------- |
218 | */ | 208 | */ |
219 | floatx80 floatx80_round_to_int( floatx80 ); | 209 | floatx80 floatx80_round_to_int( struct roundingData *, floatx80 ); |
220 | floatx80 floatx80_add( floatx80, floatx80 ); | 210 | floatx80 floatx80_add( struct roundingData *, floatx80, floatx80 ); |
221 | floatx80 floatx80_sub( floatx80, floatx80 ); | 211 | floatx80 floatx80_sub( struct roundingData *, floatx80, floatx80 ); |
222 | floatx80 floatx80_mul( floatx80, floatx80 ); | 212 | floatx80 floatx80_mul( struct roundingData *, floatx80, floatx80 ); |
223 | floatx80 floatx80_div( floatx80, floatx80 ); | 213 | floatx80 floatx80_div( struct roundingData *, floatx80, floatx80 ); |
224 | floatx80 floatx80_rem( floatx80, floatx80 ); | 214 | floatx80 floatx80_rem( struct roundingData *, floatx80, floatx80 ); |
225 | floatx80 floatx80_sqrt( floatx80 ); | 215 | floatx80 floatx80_sqrt( struct roundingData *, floatx80 ); |
226 | char floatx80_eq( floatx80, floatx80 ); | 216 | char floatx80_eq( floatx80, floatx80 ); |
227 | char floatx80_le( floatx80, floatx80 ); | 217 | char floatx80_le( floatx80, floatx80 ); |
228 | char floatx80_lt( floatx80, floatx80 ); | 218 | char floatx80_lt( floatx80, floatx80 ); |