diff options
author | Markos Chandras <markos.chandras@imgtec.com> | 2014-11-26 05:10:18 -0500 |
---|---|---|
committer | Markos Chandras <markos.chandras@imgtec.com> | 2015-02-17 10:37:32 -0500 |
commit | c8a34581ec09a5ee11dd833d6c5cf41fdbef706f (patch) | |
tree | ae78d1cc82562dfa92bcad4bcc7848343af21dc7 /arch/mips/math-emu | |
parent | 319824eabc3f1c1aab67f408d66f384fbb996ee2 (diff) |
MIPS: Emulate the BC1{EQ,NE}Z FPU instructions
MIPS R6 introduced the following two branch instructions for COP1:
BC1EQZ: Branch if Cop1 (FPR) Register Bit 0 is Equal to Zero
BC1NEZ: Branch if Cop1 (FPR) Register Bit 0 is Not Equal to Zero
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Diffstat (limited to 'arch/mips/math-emu')
-rw-r--r-- | arch/mips/math-emu/cp1emu.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index 7bbaefe0434d..798204e492fc 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -602,6 +602,33 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, | |||
602 | #endif | 602 | #endif |
603 | case cop0_op: | 603 | case cop0_op: |
604 | case cop1_op: | 604 | case cop1_op: |
605 | /* Need to check for R6 bc1nez and bc1eqz branches */ | ||
606 | if (cpu_has_mips_r6 && | ||
607 | ((insn.i_format.rs == bc1eqz_op) || | ||
608 | (insn.i_format.rs == bc1nez_op))) { | ||
609 | bit = 0; | ||
610 | switch (insn.i_format.rs) { | ||
611 | case bc1eqz_op: | ||
612 | if (get_fpr32(¤t->thread.fpu.fpr[insn.i_format.rt], 0) & 0x1) | ||
613 | bit = 1; | ||
614 | break; | ||
615 | case bc1nez_op: | ||
616 | if (!(get_fpr32(¤t->thread.fpu.fpr[insn.i_format.rt], 0) & 0x1)) | ||
617 | bit = 1; | ||
618 | break; | ||
619 | } | ||
620 | if (bit) | ||
621 | *contpc = regs->cp0_epc + | ||
622 | dec_insn.pc_inc + | ||
623 | (insn.i_format.simmediate << 2); | ||
624 | else | ||
625 | *contpc = regs->cp0_epc + | ||
626 | dec_insn.pc_inc + | ||
627 | dec_insn.next_pc_inc; | ||
628 | |||
629 | return 1; | ||
630 | } | ||
631 | /* R2/R6 compatible cop1 instruction. Fall through */ | ||
605 | case cop2_op: | 632 | case cop2_op: |
606 | case cop1x_op: | 633 | case cop1x_op: |
607 | if (insn.i_format.rs == bc_op) { | 634 | if (insn.i_format.rs == bc_op) { |