UPSTREAM: MIPS: math-emu: Fix BC1EQZ and BC1NEZ condition handling
Correct the treatment of branching conditions for BC1EQZ and BC1NEZ instructions in function isBranchInstr(). Previously, corresponding conditions were swapped, which in turn meant that, for these two instructions, function isBranchInstr() returned wrong value in its output parameter contpc. This change is actually an extension of the fix done by the commit 93583e178ebf ("MIPS: math-emu: Fix BC1{EQ,NE}Z emulation"). That commit dealt with a similar problem in function cop1Emulate(), while this commit deals with condition handling in function isBranchInstr(). The code styles of changes in these two commits are kept as consistent as possible. Signed-off-by: Douglas Leung <douglas.leung@imgtec.com> Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Reviewed-by: Paul Burton <paul.burton@imgtec.com> Cc: james.hogan@imgtec.com Cc: leonid.yegoshin@imgtec.com Cc: petar.jovanovic@imgtec.com Cc: goran.ferenc@imgtec.com Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/15489/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> (cherry picked from commit 8bcd84a4a37c88d8304ca3a64f0461a51487e239) Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
4e734c6f34
commit
da8a6c79d7
1 changed files with 6 additions and 4 deletions
|
@ -440,6 +440,8 @@ int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
|
|||
union mips_instruction insn = (union mips_instruction)dec_insn.insn;
|
||||
unsigned int fcr31;
|
||||
unsigned int bit = 0;
|
||||
unsigned int bit0;
|
||||
union fpureg *fpr;
|
||||
|
||||
switch (insn.i_format.opcode) {
|
||||
case spec_op:
|
||||
|
@ -707,14 +709,14 @@ int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
|
|||
((insn.i_format.rs == bc1eqz_op) ||
|
||||
(insn.i_format.rs == bc1nez_op))) {
|
||||
bit = 0;
|
||||
fpr = ¤t->thread.fpu.fpr[insn.i_format.rt];
|
||||
bit0 = get_fpr32(fpr, 0) & 0x1;
|
||||
switch (insn.i_format.rs) {
|
||||
case bc1eqz_op:
|
||||
if (get_fpr32(¤t->thread.fpu.fpr[insn.i_format.rt], 0) & 0x1)
|
||||
bit = 1;
|
||||
bit = bit0 == 0;
|
||||
break;
|
||||
case bc1nez_op:
|
||||
if (!(get_fpr32(¤t->thread.fpu.fpr[insn.i_format.rt], 0) & 0x1))
|
||||
bit = 1;
|
||||
bit = bit0 != 0;
|
||||
break;
|
||||
}
|
||||
if (bit)
|
||||
|
|
Loading…
Add table
Reference in a new issue