Skip to content

Commit

Permalink
Get rid of SINGLE_ONLY_FPU. Linux does not support half FPU other than
Browse files Browse the repository at this point in the history
by emulation of a full FPU.
    
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Ralf Baechle committed Oct 29, 2005
1 parent 3fccc01 commit 4b724ef
Showing 1 changed file with 8 additions and 62 deletions.
70 changes: 8 additions & 62 deletions arch/mips/math-emu/cp1emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx)
emul:
fpuemustats.emulated++;
switch (MIPSInst_OPCODE(ir)) {
#ifndef SINGLE_ONLY_FPU
case ldc1_op:{
u64 __user *va = (u64 __user *) (xcp->regs[MIPSInst_RS(ir)] +
MIPSInst_SIMM(ir));
Expand Down Expand Up @@ -284,7 +283,6 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx)
}
break;
}
#endif

case lwc1_op:{
u32 __user *va = (u32 __user *) (xcp->regs[MIPSInst_RS(ir)] +
Expand All @@ -296,12 +294,6 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx)
fpuemustats.errors++;
return SIGBUS;
}
#ifdef SINGLE_ONLY_FPU
if (MIPSInst_RT(ir) & 1) {
/* illegal register in single-float mode */
return SIGILL;
}
#endif
SITOREG(val, MIPSInst_RT(ir));
break;
}
Expand All @@ -312,12 +304,6 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx)
u32 val;

fpuemustats.stores++;
#ifdef SINGLE_ONLY_FPU
if (MIPSInst_RT(ir) & 1) {
/* illegal register in single-float mode */
return SIGILL;
}
#endif
SIFROMREG(val, MIPSInst_RT(ir));
if (put_user(val, va)) {
fpuemustats.errors++;
Expand All @@ -329,7 +315,7 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx)
case cop1_op:
switch (MIPSInst_RS(ir)) {

#if defined(__mips64) && !defined(SINGLE_ONLY_FPU)
#if defined(__mips64)
case dmfc_op:
/* copregister fs -> gpr[rt] */
if (MIPSInst_RT(ir) != 0) {
Expand All @@ -346,12 +332,6 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx)

case mfc_op:
/* copregister rd -> gpr[rt] */
#ifdef SINGLE_ONLY_FPU
if (MIPSInst_RD(ir) & 1) {
/* illegal register in single-float mode */
return SIGILL;
}
#endif
if (MIPSInst_RT(ir) != 0) {
SIFROMREG(xcp->regs[MIPSInst_RT(ir)],
MIPSInst_RD(ir));
Expand All @@ -360,12 +340,6 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx)

case mtc_op:
/* copregister rd <- rt */
#ifdef SINGLE_ONLY_FPU
if (MIPSInst_RD(ir) & 1) {
/* illegal register in single-float mode */
return SIGILL;
}
#endif
SITOREG(xcp->regs[MIPSInst_RT(ir)], MIPSInst_RD(ir));
break;

Expand Down Expand Up @@ -467,7 +441,7 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx)
switch (MIPSInst_OPCODE(ir)) {
case lwc1_op:
case swc1_op:
#if (__mips >= 2 || defined(__mips64)) && !defined(SINGLE_ONLY_FPU)
#if (__mips >= 2 || defined(__mips64))
case ldc1_op:
case sdc1_op:
#endif
Expand Down Expand Up @@ -646,14 +620,6 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
fpuemustats.errors++;
return SIGBUS;
}
#ifdef SINGLE_ONLY_FPU
if (MIPSInst_FD(ir) & 1) {
/* illegal register in single-float
* mode
*/
return SIGILL;
}
#endif
SITOREG(val, MIPSInst_FD(ir));
break;

Expand All @@ -662,14 +628,6 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
xcp->regs[MIPSInst_FT(ir)]);

fpuemustats.stores++;
#ifdef SINGLE_ONLY_FPU
if (MIPSInst_FS(ir) & 1) {
/* illegal register in single-float
* mode
*/
return SIGILL;
}
#endif

SIFROMREG(val, MIPSInst_FS(ir));
if (put_user(val, va)) {
Expand Down Expand Up @@ -723,7 +681,6 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
break;
}

#ifndef SINGLE_ONLY_FPU
case d_fmt:{ /* 1 */
ieee754dp(*handler) (ieee754dp, ieee754dp, ieee754dp);
ieee754dp fd, fr, fs, ft;
Expand Down Expand Up @@ -781,7 +738,6 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
}
break;
}
#endif

case 0x7: /* 7 */
if (MIPSInst_FUNC(ir) != pfetch_op) {
Expand Down Expand Up @@ -921,17 +877,13 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
case fcvts_op:
return SIGILL; /* not defined */
case fcvtd_op:{
#ifdef SINGLE_ONLY_FPU
return SIGILL; /* not defined */
#else
ieee754sp fs;

SPFROMREG(fs, MIPSInst_FS(ir));
rv.d = ieee754dp_fsp(fs);
rfmt = d_fmt;
goto copcsr;
}
#endif
case fcvtw_op:{
ieee754sp fs;

Expand All @@ -958,7 +910,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
}
#endif /* __mips >= 2 */

#if defined(__mips64) && !defined(SINGLE_ONLY_FPU)
#if defined(__mips64)
case fcvtl_op:{
ieee754sp fs;

Expand All @@ -982,7 +934,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
rfmt = l_fmt;
goto copcsr;
}
#endif /* defined(__mips64) && !fpu(single) */
#endif /* defined(__mips64) */

default:
if (MIPSInst_FUNC(ir) >= fcmp_op) {
Expand All @@ -1009,7 +961,6 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
break;
}

#ifndef SINGLE_ONLY_FPU
case d_fmt:{
union {
ieee754dp(*b) (ieee754dp, ieee754dp);
Expand Down Expand Up @@ -1133,7 +1084,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
}
#endif

#if defined(__mips64) && !defined(SINGLE_ONLY_FPU)
#if defined(__mips64)
case fcvtl_op:{
ieee754dp fs;

Expand All @@ -1157,7 +1108,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
rfmt = l_fmt;
goto copcsr;
}
#endif /* __mips >= 3 && !fpu(single) */
#endif /* __mips >= 3 */

default:
if (MIPSInst_FUNC(ir) >= fcmp_op) {
Expand Down Expand Up @@ -1185,7 +1136,6 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
}
break;
}
#endif /* ifndef SINGLE_ONLY_FPU */

case w_fmt:{
ieee754sp fs;
Expand All @@ -1197,21 +1147,19 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
rv.s = ieee754sp_fint(fs.bits);
rfmt = s_fmt;
goto copcsr;
#ifndef SINGLE_ONLY_FPU
case fcvtd_op:
/* convert word to double precision real */
SPFROMREG(fs, MIPSInst_FS(ir));
rv.d = ieee754dp_fint(fs.bits);
rfmt = d_fmt;
goto copcsr;
#endif
default:
return SIGILL;
}
break;
}

#if defined(__mips64) && !defined(SINGLE_ONLY_FPU)
#if defined(__mips64)
case l_fmt:{
switch (MIPSInst_FUNC(ir)) {
case fcvts_op:
Expand Down Expand Up @@ -1264,18 +1212,16 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
ctx->fcr31 &= ~cond;
break;
}
#ifndef SINGLE_ONLY_FPU
case d_fmt:
DPTOREG(rv.d, MIPSInst_FD(ir));
break;
#endif
case s_fmt:
SPTOREG(rv.s, MIPSInst_FD(ir));
break;
case w_fmt:
SITOREG(rv.w, MIPSInst_FD(ir));
break;
#if defined(__mips64) && !defined(SINGLE_ONLY_FPU)
#if defined(__mips64)
case l_fmt:
DITOREG(rv.l, MIPSInst_FD(ir));
break;
Expand Down

0 comments on commit 4b724ef

Please sign in to comment.