diff options
author | Daniel Jacobowitz <drow@false.org> | 2006-08-30 10:06:39 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-08-30 10:06:39 -0400 |
commit | 0355b3e039c621d15321fd0d5cf72d8bdb8f723d (patch) | |
tree | 005fd5c6e3e78ec39ee2a3924371cbdc69b34fac /arch/arm/vfp | |
parent | dc709bd190c130b299ac19d596594256265c042a (diff) |
[ARM] 3750/3: Fix double VFP emulation for EABI kernels
Patch from Daniel Jacobowitz
vfp_put_double didn't work in a CONFIG_AEABI kernel. By swapping
the arguments, we arrange for them to be in the same place regardless
of ABI. I made the same change to vfp_put_float for consistency.
Signed-off-by: Daniel Jacobowitz <dan@codesourcery.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/vfp')
-rw-r--r-- | arch/arm/vfp/vfp.h | 10 | ||||
-rw-r--r-- | arch/arm/vfp/vfpdouble.c | 20 | ||||
-rw-r--r-- | arch/arm/vfp/vfphw.S | 10 | ||||
-rw-r--r-- | arch/arm/vfp/vfpsingle.c | 20 |
4 files changed, 27 insertions, 33 deletions
diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h index 5fbdf81a8aa..96fdf30f6a3 100644 --- a/arch/arm/vfp/vfp.h +++ b/arch/arm/vfp/vfp.h | |||
@@ -156,7 +156,7 @@ struct vfp_single { | |||
156 | }; | 156 | }; |
157 | 157 | ||
158 | extern s32 vfp_get_float(unsigned int reg); | 158 | extern s32 vfp_get_float(unsigned int reg); |
159 | extern void vfp_put_float(unsigned int reg, s32 val); | 159 | extern void vfp_put_float(s32 val, unsigned int reg); |
160 | 160 | ||
161 | /* | 161 | /* |
162 | * VFP_SINGLE_MANTISSA_BITS - number of bits in the mantissa | 162 | * VFP_SINGLE_MANTISSA_BITS - number of bits in the mantissa |
@@ -267,7 +267,7 @@ struct vfp_double { | |||
267 | */ | 267 | */ |
268 | #define VFP_REG_ZERO 16 | 268 | #define VFP_REG_ZERO 16 |
269 | extern u64 vfp_get_double(unsigned int reg); | 269 | extern u64 vfp_get_double(unsigned int reg); |
270 | extern void vfp_put_double(unsigned int reg, u64 val); | 270 | extern void vfp_put_double(u64 val, unsigned int reg); |
271 | 271 | ||
272 | #define VFP_DOUBLE_MANTISSA_BITS (52) | 272 | #define VFP_DOUBLE_MANTISSA_BITS (52) |
273 | #define VFP_DOUBLE_EXPONENT_BITS (11) | 273 | #define VFP_DOUBLE_EXPONENT_BITS (11) |
@@ -341,12 +341,6 @@ static inline int vfp_double_type(struct vfp_double *s) | |||
341 | 341 | ||
342 | u32 vfp_double_normaliseround(int dd, struct vfp_double *vd, u32 fpscr, u32 exceptions, const char *func); | 342 | u32 vfp_double_normaliseround(int dd, struct vfp_double *vd, u32 fpscr, u32 exceptions, const char *func); |
343 | 343 | ||
344 | /* | ||
345 | * System registers | ||
346 | */ | ||
347 | extern u32 vfp_get_sys(unsigned int reg); | ||
348 | extern void vfp_put_sys(unsigned int reg, u32 val); | ||
349 | |||
350 | u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand); | 344 | u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand); |
351 | 345 | ||
352 | /* | 346 | /* |
diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c index 04bd3425b29..add48e36c2d 100644 --- a/arch/arm/vfp/vfpdouble.c +++ b/arch/arm/vfp/vfpdouble.c | |||
@@ -195,7 +195,7 @@ u32 vfp_double_normaliseround(int dd, struct vfp_double *vd, u32 fpscr, u32 exce | |||
195 | s64 d = vfp_double_pack(vd); | 195 | s64 d = vfp_double_pack(vd); |
196 | pr_debug("VFP: %s: d(d%d)=%016llx exceptions=%08x\n", func, | 196 | pr_debug("VFP: %s: d(d%d)=%016llx exceptions=%08x\n", func, |
197 | dd, d, exceptions); | 197 | dd, d, exceptions); |
198 | vfp_put_double(dd, d); | 198 | vfp_put_double(d, dd); |
199 | } | 199 | } |
200 | return exceptions; | 200 | return exceptions; |
201 | } | 201 | } |
@@ -250,19 +250,19 @@ vfp_propagate_nan(struct vfp_double *vdd, struct vfp_double *vdn, | |||
250 | */ | 250 | */ |
251 | static u32 vfp_double_fabs(int dd, int unused, int dm, u32 fpscr) | 251 | static u32 vfp_double_fabs(int dd, int unused, int dm, u32 fpscr) |
252 | { | 252 | { |
253 | vfp_put_double(dd, vfp_double_packed_abs(vfp_get_double(dm))); | 253 | vfp_put_double(vfp_double_packed_abs(vfp_get_double(dm)), dd); |
254 | return 0; | 254 | return 0; |
255 | } | 255 | } |
256 | 256 | ||
257 | static u32 vfp_double_fcpy(int dd, int unused, int dm, u32 fpscr) | 257 | static u32 vfp_double_fcpy(int dd, int unused, int dm, u32 fpscr) |
258 | { | 258 | { |
259 | vfp_put_double(dd, vfp_get_double(dm)); | 259 | vfp_put_double(vfp_get_double(dm), dd); |
260 | return 0; | 260 | return 0; |
261 | } | 261 | } |
262 | 262 | ||
263 | static u32 vfp_double_fneg(int dd, int unused, int dm, u32 fpscr) | 263 | static u32 vfp_double_fneg(int dd, int unused, int dm, u32 fpscr) |
264 | { | 264 | { |
265 | vfp_put_double(dd, vfp_double_packed_negate(vfp_get_double(dm))); | 265 | vfp_put_double(vfp_double_packed_negate(vfp_get_double(dm)), dd); |
266 | return 0; | 266 | return 0; |
267 | } | 267 | } |
268 | 268 | ||
@@ -287,7 +287,7 @@ static u32 vfp_double_fsqrt(int dd, int unused, int dm, u32 fpscr) | |||
287 | vdp = &vfp_double_default_qnan; | 287 | vdp = &vfp_double_default_qnan; |
288 | ret = FPSCR_IOC; | 288 | ret = FPSCR_IOC; |
289 | } | 289 | } |
290 | vfp_put_double(dd, vfp_double_pack(vdp)); | 290 | vfp_put_double(vfp_double_pack(vdp), dd); |
291 | return ret; | 291 | return ret; |
292 | } | 292 | } |
293 | 293 | ||
@@ -476,7 +476,7 @@ static u32 vfp_double_fcvts(int sd, int unused, int dm, u32 fpscr) | |||
476 | return vfp_single_normaliseround(sd, &vsd, fpscr, exceptions, "fcvts"); | 476 | return vfp_single_normaliseround(sd, &vsd, fpscr, exceptions, "fcvts"); |
477 | 477 | ||
478 | pack_nan: | 478 | pack_nan: |
479 | vfp_put_float(sd, vfp_single_pack(&vsd)); | 479 | vfp_put_float(vfp_single_pack(&vsd), sd); |
480 | return exceptions; | 480 | return exceptions; |
481 | } | 481 | } |
482 | 482 | ||
@@ -573,7 +573,7 @@ static u32 vfp_double_ftoui(int sd, int unused, int dm, u32 fpscr) | |||
573 | 573 | ||
574 | pr_debug("VFP: ftoui: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); | 574 | pr_debug("VFP: ftoui: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); |
575 | 575 | ||
576 | vfp_put_float(sd, d); | 576 | vfp_put_float(d, sd); |
577 | 577 | ||
578 | return exceptions; | 578 | return exceptions; |
579 | } | 579 | } |
@@ -648,7 +648,7 @@ static u32 vfp_double_ftosi(int sd, int unused, int dm, u32 fpscr) | |||
648 | 648 | ||
649 | pr_debug("VFP: ftosi: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); | 649 | pr_debug("VFP: ftosi: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); |
650 | 650 | ||
651 | vfp_put_float(sd, (s32)d); | 651 | vfp_put_float((s32)d, sd); |
652 | 652 | ||
653 | return exceptions; | 653 | return exceptions; |
654 | } | 654 | } |
@@ -1084,7 +1084,7 @@ static u32 vfp_double_fdiv(int dd, int dn, int dm, u32 fpscr) | |||
1084 | vdn_nan: | 1084 | vdn_nan: |
1085 | exceptions = vfp_propagate_nan(&vdd, &vdn, &vdm, fpscr); | 1085 | exceptions = vfp_propagate_nan(&vdd, &vdn, &vdm, fpscr); |
1086 | pack: | 1086 | pack: |
1087 | vfp_put_double(dd, vfp_double_pack(&vdd)); | 1087 | vfp_put_double(vfp_double_pack(&vdd), dd); |
1088 | return exceptions; | 1088 | return exceptions; |
1089 | 1089 | ||
1090 | vdm_nan: | 1090 | vdm_nan: |
@@ -1104,7 +1104,7 @@ static u32 vfp_double_fdiv(int dd, int dn, int dm, u32 fpscr) | |||
1104 | goto pack; | 1104 | goto pack; |
1105 | 1105 | ||
1106 | invalid: | 1106 | invalid: |
1107 | vfp_put_double(dd, vfp_double_pack(&vfp_double_default_qnan)); | 1107 | vfp_put_double(vfp_double_pack(&vfp_double_default_qnan), dd); |
1108 | return FPSCR_IOC; | 1108 | return FPSCR_IOC; |
1109 | } | 1109 | } |
1110 | 1110 | ||
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S index eb683cd7716..e51e6679c40 100644 --- a/arch/arm/vfp/vfphw.S +++ b/arch/arm/vfp/vfphw.S | |||
@@ -178,12 +178,12 @@ vfp_get_float: | |||
178 | 178 | ||
179 | .globl vfp_put_float | 179 | .globl vfp_put_float |
180 | vfp_put_float: | 180 | vfp_put_float: |
181 | add pc, pc, r0, lsl #3 | 181 | add pc, pc, r1, lsl #3 |
182 | mov r0, r0 | 182 | mov r0, r0 |
183 | .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 | 183 | .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 |
184 | mcr p10, 0, r1, c\dr, c0, 0 @ fmsr r0, s0 | 184 | mcr p10, 0, r0, c\dr, c0, 0 @ fmsr r0, s0 |
185 | mov pc, lr | 185 | mov pc, lr |
186 | mcr p10, 0, r1, c\dr, c0, 4 @ fmsr r0, s1 | 186 | mcr p10, 0, r0, c\dr, c0, 4 @ fmsr r0, s1 |
187 | mov pc, lr | 187 | mov pc, lr |
188 | .endr | 188 | .endr |
189 | 189 | ||
@@ -203,9 +203,9 @@ vfp_get_double: | |||
203 | 203 | ||
204 | .globl vfp_put_double | 204 | .globl vfp_put_double |
205 | vfp_put_double: | 205 | vfp_put_double: |
206 | add pc, pc, r0, lsl #3 | 206 | add pc, pc, r2, lsl #3 |
207 | mov r0, r0 | 207 | mov r0, r0 |
208 | .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 | 208 | .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 |
209 | fmdrr d\dr, r1, r2 | 209 | fmdrr d\dr, r0, r1 |
210 | mov pc, lr | 210 | mov pc, lr |
211 | .endr | 211 | .endr |
diff --git a/arch/arm/vfp/vfpsingle.c b/arch/arm/vfp/vfpsingle.c index 78d7cac5f36..8f6c179cafb 100644 --- a/arch/arm/vfp/vfpsingle.c +++ b/arch/arm/vfp/vfpsingle.c | |||
@@ -200,7 +200,7 @@ u32 vfp_single_normaliseround(int sd, struct vfp_single *vs, u32 fpscr, u32 exce | |||
200 | s32 d = vfp_single_pack(vs); | 200 | s32 d = vfp_single_pack(vs); |
201 | pr_debug("VFP: %s: d(s%d)=%08x exceptions=%08x\n", func, | 201 | pr_debug("VFP: %s: d(s%d)=%08x exceptions=%08x\n", func, |
202 | sd, d, exceptions); | 202 | sd, d, exceptions); |
203 | vfp_put_float(sd, d); | 203 | vfp_put_float(d, sd); |
204 | } | 204 | } |
205 | 205 | ||
206 | return exceptions; | 206 | return exceptions; |
@@ -257,19 +257,19 @@ vfp_propagate_nan(struct vfp_single *vsd, struct vfp_single *vsn, | |||
257 | */ | 257 | */ |
258 | static u32 vfp_single_fabs(int sd, int unused, s32 m, u32 fpscr) | 258 | static u32 vfp_single_fabs(int sd, int unused, s32 m, u32 fpscr) |
259 | { | 259 | { |
260 | vfp_put_float(sd, vfp_single_packed_abs(m)); | 260 | vfp_put_float(vfp_single_packed_abs(m), sd); |
261 | return 0; | 261 | return 0; |
262 | } | 262 | } |
263 | 263 | ||
264 | static u32 vfp_single_fcpy(int sd, int unused, s32 m, u32 fpscr) | 264 | static u32 vfp_single_fcpy(int sd, int unused, s32 m, u32 fpscr) |
265 | { | 265 | { |
266 | vfp_put_float(sd, m); | 266 | vfp_put_float(m, sd); |
267 | return 0; | 267 | return 0; |
268 | } | 268 | } |
269 | 269 | ||
270 | static u32 vfp_single_fneg(int sd, int unused, s32 m, u32 fpscr) | 270 | static u32 vfp_single_fneg(int sd, int unused, s32 m, u32 fpscr) |
271 | { | 271 | { |
272 | vfp_put_float(sd, vfp_single_packed_negate(m)); | 272 | vfp_put_float(vfp_single_packed_negate(m), sd); |
273 | return 0; | 273 | return 0; |
274 | } | 274 | } |
275 | 275 | ||
@@ -333,7 +333,7 @@ static u32 vfp_single_fsqrt(int sd, int unused, s32 m, u32 fpscr) | |||
333 | vsp = &vfp_single_default_qnan; | 333 | vsp = &vfp_single_default_qnan; |
334 | ret = FPSCR_IOC; | 334 | ret = FPSCR_IOC; |
335 | } | 335 | } |
336 | vfp_put_float(sd, vfp_single_pack(vsp)); | 336 | vfp_put_float(vfp_single_pack(vsp), sd); |
337 | return ret; | 337 | return ret; |
338 | } | 338 | } |
339 | 339 | ||
@@ -517,7 +517,7 @@ static u32 vfp_single_fcvtd(int dd, int unused, s32 m, u32 fpscr) | |||
517 | return vfp_double_normaliseround(dd, &vdd, fpscr, exceptions, "fcvtd"); | 517 | return vfp_double_normaliseround(dd, &vdd, fpscr, exceptions, "fcvtd"); |
518 | 518 | ||
519 | pack_nan: | 519 | pack_nan: |
520 | vfp_put_double(dd, vfp_double_pack(&vdd)); | 520 | vfp_put_double(vfp_double_pack(&vdd), dd); |
521 | return exceptions; | 521 | return exceptions; |
522 | } | 522 | } |
523 | 523 | ||
@@ -613,7 +613,7 @@ static u32 vfp_single_ftoui(int sd, int unused, s32 m, u32 fpscr) | |||
613 | 613 | ||
614 | pr_debug("VFP: ftoui: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); | 614 | pr_debug("VFP: ftoui: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); |
615 | 615 | ||
616 | vfp_put_float(sd, d); | 616 | vfp_put_float(d, sd); |
617 | 617 | ||
618 | return exceptions; | 618 | return exceptions; |
619 | } | 619 | } |
@@ -692,7 +692,7 @@ static u32 vfp_single_ftosi(int sd, int unused, s32 m, u32 fpscr) | |||
692 | 692 | ||
693 | pr_debug("VFP: ftosi: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); | 693 | pr_debug("VFP: ftosi: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); |
694 | 694 | ||
695 | vfp_put_float(sd, (s32)d); | 695 | vfp_put_float((s32)d, sd); |
696 | 696 | ||
697 | return exceptions; | 697 | return exceptions; |
698 | } | 698 | } |
@@ -1127,7 +1127,7 @@ static u32 vfp_single_fdiv(int sd, int sn, s32 m, u32 fpscr) | |||
1127 | vsn_nan: | 1127 | vsn_nan: |
1128 | exceptions = vfp_propagate_nan(&vsd, &vsn, &vsm, fpscr); | 1128 | exceptions = vfp_propagate_nan(&vsd, &vsn, &vsm, fpscr); |
1129 | pack: | 1129 | pack: |
1130 | vfp_put_float(sd, vfp_single_pack(&vsd)); | 1130 | vfp_put_float(vfp_single_pack(&vsd), sd); |
1131 | return exceptions; | 1131 | return exceptions; |
1132 | 1132 | ||
1133 | vsm_nan: | 1133 | vsm_nan: |
@@ -1147,7 +1147,7 @@ static u32 vfp_single_fdiv(int sd, int sn, s32 m, u32 fpscr) | |||
1147 | goto pack; | 1147 | goto pack; |
1148 | 1148 | ||
1149 | invalid: | 1149 | invalid: |
1150 | vfp_put_float(sd, vfp_single_pack(&vfp_single_default_qnan)); | 1150 | vfp_put_float(vfp_single_pack(&vfp_single_default_qnan), sd); |
1151 | return FPSCR_IOC; | 1151 | return FPSCR_IOC; |
1152 | } | 1152 | } |
1153 | 1153 | ||