[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>
This commit is contained in:
Daniel Jacobowitz 2006-08-30 15:06:39 +01:00 committed by Russell King
parent dc709bd190
commit 0355b3e039
4 changed files with 27 additions and 33 deletions

View File

@ -156,7 +156,7 @@ struct vfp_single {
}; };
extern s32 vfp_get_float(unsigned int reg); extern s32 vfp_get_float(unsigned int reg);
extern void vfp_put_float(unsigned int reg, s32 val); extern void vfp_put_float(s32 val, unsigned int reg);
/* /*
* VFP_SINGLE_MANTISSA_BITS - number of bits in the mantissa * VFP_SINGLE_MANTISSA_BITS - number of bits in the mantissa
@ -267,7 +267,7 @@ struct vfp_double {
*/ */
#define VFP_REG_ZERO 16 #define VFP_REG_ZERO 16
extern u64 vfp_get_double(unsigned int reg); extern u64 vfp_get_double(unsigned int reg);
extern void vfp_put_double(unsigned int reg, u64 val); extern void vfp_put_double(u64 val, unsigned int reg);
#define VFP_DOUBLE_MANTISSA_BITS (52) #define VFP_DOUBLE_MANTISSA_BITS (52)
#define VFP_DOUBLE_EXPONENT_BITS (11) #define VFP_DOUBLE_EXPONENT_BITS (11)
@ -341,12 +341,6 @@ static inline int vfp_double_type(struct vfp_double *s)
u32 vfp_double_normaliseround(int dd, struct vfp_double *vd, u32 fpscr, u32 exceptions, const char *func); u32 vfp_double_normaliseround(int dd, struct vfp_double *vd, u32 fpscr, u32 exceptions, const char *func);
/*
* System registers
*/
extern u32 vfp_get_sys(unsigned int reg);
extern void vfp_put_sys(unsigned int reg, u32 val);
u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand); u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand);
/* /*

View File

@ -195,7 +195,7 @@ u32 vfp_double_normaliseround(int dd, struct vfp_double *vd, u32 fpscr, u32 exce
s64 d = vfp_double_pack(vd); s64 d = vfp_double_pack(vd);
pr_debug("VFP: %s: d(d%d)=%016llx exceptions=%08x\n", func, pr_debug("VFP: %s: d(d%d)=%016llx exceptions=%08x\n", func,
dd, d, exceptions); dd, d, exceptions);
vfp_put_double(dd, d); vfp_put_double(d, dd);
} }
return exceptions; return exceptions;
} }
@ -250,19 +250,19 @@ vfp_propagate_nan(struct vfp_double *vdd, struct vfp_double *vdn,
*/ */
static u32 vfp_double_fabs(int dd, int unused, int dm, u32 fpscr) static u32 vfp_double_fabs(int dd, int unused, int dm, u32 fpscr)
{ {
vfp_put_double(dd, vfp_double_packed_abs(vfp_get_double(dm))); vfp_put_double(vfp_double_packed_abs(vfp_get_double(dm)), dd);
return 0; return 0;
} }
static u32 vfp_double_fcpy(int dd, int unused, int dm, u32 fpscr) static u32 vfp_double_fcpy(int dd, int unused, int dm, u32 fpscr)
{ {
vfp_put_double(dd, vfp_get_double(dm)); vfp_put_double(vfp_get_double(dm), dd);
return 0; return 0;
} }
static u32 vfp_double_fneg(int dd, int unused, int dm, u32 fpscr) static u32 vfp_double_fneg(int dd, int unused, int dm, u32 fpscr)
{ {
vfp_put_double(dd, vfp_double_packed_negate(vfp_get_double(dm))); vfp_put_double(vfp_double_packed_negate(vfp_get_double(dm)), dd);
return 0; return 0;
} }
@ -287,7 +287,7 @@ static u32 vfp_double_fsqrt(int dd, int unused, int dm, u32 fpscr)
vdp = &vfp_double_default_qnan; vdp = &vfp_double_default_qnan;
ret = FPSCR_IOC; ret = FPSCR_IOC;
} }
vfp_put_double(dd, vfp_double_pack(vdp)); vfp_put_double(vfp_double_pack(vdp), dd);
return ret; return ret;
} }
@ -476,7 +476,7 @@ static u32 vfp_double_fcvts(int sd, int unused, int dm, u32 fpscr)
return vfp_single_normaliseround(sd, &vsd, fpscr, exceptions, "fcvts"); return vfp_single_normaliseround(sd, &vsd, fpscr, exceptions, "fcvts");
pack_nan: pack_nan:
vfp_put_float(sd, vfp_single_pack(&vsd)); vfp_put_float(vfp_single_pack(&vsd), sd);
return exceptions; return exceptions;
} }
@ -573,7 +573,7 @@ static u32 vfp_double_ftoui(int sd, int unused, int dm, u32 fpscr)
pr_debug("VFP: ftoui: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); pr_debug("VFP: ftoui: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions);
vfp_put_float(sd, d); vfp_put_float(d, sd);
return exceptions; return exceptions;
} }
@ -648,7 +648,7 @@ static u32 vfp_double_ftosi(int sd, int unused, int dm, u32 fpscr)
pr_debug("VFP: ftosi: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); pr_debug("VFP: ftosi: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions);
vfp_put_float(sd, (s32)d); vfp_put_float((s32)d, sd);
return exceptions; return exceptions;
} }
@ -1084,7 +1084,7 @@ static u32 vfp_double_fdiv(int dd, int dn, int dm, u32 fpscr)
vdn_nan: vdn_nan:
exceptions = vfp_propagate_nan(&vdd, &vdn, &vdm, fpscr); exceptions = vfp_propagate_nan(&vdd, &vdn, &vdm, fpscr);
pack: pack:
vfp_put_double(dd, vfp_double_pack(&vdd)); vfp_put_double(vfp_double_pack(&vdd), dd);
return exceptions; return exceptions;
vdm_nan: vdm_nan:
@ -1104,7 +1104,7 @@ static u32 vfp_double_fdiv(int dd, int dn, int dm, u32 fpscr)
goto pack; goto pack;
invalid: invalid:
vfp_put_double(dd, vfp_double_pack(&vfp_double_default_qnan)); vfp_put_double(vfp_double_pack(&vfp_double_default_qnan), dd);
return FPSCR_IOC; return FPSCR_IOC;
} }

View File

@ -178,12 +178,12 @@ vfp_get_float:
.globl vfp_put_float .globl vfp_put_float
vfp_put_float: vfp_put_float:
add pc, pc, r0, lsl #3 add pc, pc, r1, lsl #3
mov r0, r0 mov r0, r0
.irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
mcr p10, 0, r1, c\dr, c0, 0 @ fmsr r0, s0 mcr p10, 0, r0, c\dr, c0, 0 @ fmsr r0, s0
mov pc, lr mov pc, lr
mcr p10, 0, r1, c\dr, c0, 4 @ fmsr r0, s1 mcr p10, 0, r0, c\dr, c0, 4 @ fmsr r0, s1
mov pc, lr mov pc, lr
.endr .endr
@ -203,9 +203,9 @@ vfp_get_double:
.globl vfp_put_double .globl vfp_put_double
vfp_put_double: vfp_put_double:
add pc, pc, r0, lsl #3 add pc, pc, r2, lsl #3
mov r0, r0 mov r0, r0
.irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
fmdrr d\dr, r1, r2 fmdrr d\dr, r0, r1
mov pc, lr mov pc, lr
.endr .endr

View File

@ -200,7 +200,7 @@ u32 vfp_single_normaliseround(int sd, struct vfp_single *vs, u32 fpscr, u32 exce
s32 d = vfp_single_pack(vs); s32 d = vfp_single_pack(vs);
pr_debug("VFP: %s: d(s%d)=%08x exceptions=%08x\n", func, pr_debug("VFP: %s: d(s%d)=%08x exceptions=%08x\n", func,
sd, d, exceptions); sd, d, exceptions);
vfp_put_float(sd, d); vfp_put_float(d, sd);
} }
return exceptions; return exceptions;
@ -257,19 +257,19 @@ vfp_propagate_nan(struct vfp_single *vsd, struct vfp_single *vsn,
*/ */
static u32 vfp_single_fabs(int sd, int unused, s32 m, u32 fpscr) static u32 vfp_single_fabs(int sd, int unused, s32 m, u32 fpscr)
{ {
vfp_put_float(sd, vfp_single_packed_abs(m)); vfp_put_float(vfp_single_packed_abs(m), sd);
return 0; return 0;
} }
static u32 vfp_single_fcpy(int sd, int unused, s32 m, u32 fpscr) static u32 vfp_single_fcpy(int sd, int unused, s32 m, u32 fpscr)
{ {
vfp_put_float(sd, m); vfp_put_float(m, sd);
return 0; return 0;
} }
static u32 vfp_single_fneg(int sd, int unused, s32 m, u32 fpscr) static u32 vfp_single_fneg(int sd, int unused, s32 m, u32 fpscr)
{ {
vfp_put_float(sd, vfp_single_packed_negate(m)); vfp_put_float(vfp_single_packed_negate(m), sd);
return 0; return 0;
} }
@ -333,7 +333,7 @@ static u32 vfp_single_fsqrt(int sd, int unused, s32 m, u32 fpscr)
vsp = &vfp_single_default_qnan; vsp = &vfp_single_default_qnan;
ret = FPSCR_IOC; ret = FPSCR_IOC;
} }
vfp_put_float(sd, vfp_single_pack(vsp)); vfp_put_float(vfp_single_pack(vsp), sd);
return ret; return ret;
} }
@ -517,7 +517,7 @@ static u32 vfp_single_fcvtd(int dd, int unused, s32 m, u32 fpscr)
return vfp_double_normaliseround(dd, &vdd, fpscr, exceptions, "fcvtd"); return vfp_double_normaliseround(dd, &vdd, fpscr, exceptions, "fcvtd");
pack_nan: pack_nan:
vfp_put_double(dd, vfp_double_pack(&vdd)); vfp_put_double(vfp_double_pack(&vdd), dd);
return exceptions; return exceptions;
} }
@ -613,7 +613,7 @@ static u32 vfp_single_ftoui(int sd, int unused, s32 m, u32 fpscr)
pr_debug("VFP: ftoui: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); pr_debug("VFP: ftoui: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions);
vfp_put_float(sd, d); vfp_put_float(d, sd);
return exceptions; return exceptions;
} }
@ -692,7 +692,7 @@ static u32 vfp_single_ftosi(int sd, int unused, s32 m, u32 fpscr)
pr_debug("VFP: ftosi: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); pr_debug("VFP: ftosi: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions);
vfp_put_float(sd, (s32)d); vfp_put_float((s32)d, sd);
return exceptions; return exceptions;
} }
@ -1127,7 +1127,7 @@ static u32 vfp_single_fdiv(int sd, int sn, s32 m, u32 fpscr)
vsn_nan: vsn_nan:
exceptions = vfp_propagate_nan(&vsd, &vsn, &vsm, fpscr); exceptions = vfp_propagate_nan(&vsd, &vsn, &vsm, fpscr);
pack: pack:
vfp_put_float(sd, vfp_single_pack(&vsd)); vfp_put_float(vfp_single_pack(&vsd), sd);
return exceptions; return exceptions;
vsm_nan: vsm_nan:
@ -1147,7 +1147,7 @@ static u32 vfp_single_fdiv(int sd, int sn, s32 m, u32 fpscr)
goto pack; goto pack;
invalid: invalid:
vfp_put_float(sd, vfp_single_pack(&vfp_single_default_qnan)); vfp_put_float(vfp_single_pack(&vfp_single_default_qnan), sd);
return FPSCR_IOC; return FPSCR_IOC;
} }