Skip to content

Commit c909ca7

Browse files
Markos Chandrasralfbaechle
authored andcommitted
MIPS: math-emu: Emulate missing BC1{EQ,NE}Z instructions
Commit c8a3458 ("MIPS: Emulate the BC1{EQ,NE}Z FPU instructions") added support for emulating the new R6 BC1{EQ,NE}Z branches but it missed the case where the instruction that caused the exception was not on a DS. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Fixes: c8a3458 ("MIPS: Emulate the BC1{EQ,NE}Z FPU instructions") Cc: <stable@vger.kernel.org> # 4.0+ Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/10738/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent e8f80cc commit c909ca7

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

arch/mips/math-emu/cp1emu.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,24 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
11811181
}
11821182
break;
11831183

1184+
case bc1eqz_op:
1185+
case bc1nez_op:
1186+
if (!cpu_has_mips_r6 || delay_slot(xcp))
1187+
return SIGILL;
1188+
1189+
cond = likely = 0;
1190+
switch (MIPSInst_RS(ir)) {
1191+
case bc1eqz_op:
1192+
if (get_fpr32(&current->thread.fpu.fpr[MIPSInst_RT(ir)], 0) & 0x1)
1193+
cond = 1;
1194+
break;
1195+
case bc1nez_op:
1196+
if (!(get_fpr32(&current->thread.fpu.fpr[MIPSInst_RT(ir)], 0) & 0x1))
1197+
cond = 1;
1198+
break;
1199+
}
1200+
goto branch_common;
1201+
11841202
case bc_op:
11851203
if (delay_slot(xcp))
11861204
return SIGILL;
@@ -1207,7 +1225,7 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
12071225
case bct_op:
12081226
break;
12091227
}
1210-
1228+
branch_common:
12111229
set_delay_slot(xcp);
12121230
if (cond) {
12131231
/*

0 commit comments

Comments
 (0)