diff options
author | Markos Chandras <markos.chandras@imgtec.com> | 2014-11-26 09:08:52 -0500 |
---|---|---|
committer | Markos Chandras <markos.chandras@imgtec.com> | 2015-02-17 10:37:34 -0500 |
commit | c893ce38b265d5787d03850b36221f595b224538 (patch) | |
tree | 9ebc726517a4eb3aee5c3a07f0f531f0704fc97a | |
parent | 8467ca0122e20f3f8e73d34907b8b30461af5d4e (diff) |
MIPS: Emulate the new MIPS R6 BOVC, BEQC and BEQZALC instructions
MIPS R6 uses the <R6 ADDI opcode for the new BOVC, BEQC and
BEQZALC instructions.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
-rw-r--r-- | arch/mips/include/uapi/asm/inst.h | 2 | ||||
-rw-r--r-- | arch/mips/kernel/branch.c | 11 | ||||
-rw-r--r-- | arch/mips/math-emu/cp1emu.c | 9 |
3 files changed, 21 insertions, 1 deletions
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h index 9ce5e34b9c64..782af0f83421 100644 --- a/arch/mips/include/uapi/asm/inst.h +++ b/arch/mips/include/uapi/asm/inst.h | |||
@@ -21,7 +21,7 @@ | |||
21 | enum major_op { | 21 | enum major_op { |
22 | spec_op, bcond_op, j_op, jal_op, | 22 | spec_op, bcond_op, j_op, jal_op, |
23 | beq_op, bne_op, blez_op, bgtz_op, | 23 | beq_op, bne_op, blez_op, bgtz_op, |
24 | addi_op, addiu_op, slti_op, sltiu_op, | 24 | addi_op, cbcond0_op = addi_op, addiu_op, slti_op, sltiu_op, |
25 | andi_op, ori_op, xori_op, lui_op, | 25 | andi_op, ori_op, xori_op, lui_op, |
26 | cop0_op, cop1_op, cop2_op, cop1x_op, | 26 | cop0_op, cop1_op, cop2_op, cop1x_op, |
27 | beql_op, bnel_op, blezl_op, bgtzl_op, | 27 | beql_op, bnel_op, blezl_op, bgtzl_op, |
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c index 1a0a30e16684..80a073ced200 100644 --- a/arch/mips/kernel/branch.c +++ b/arch/mips/kernel/branch.c | |||
@@ -790,6 +790,17 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, | |||
790 | regs->cp0_epc += 8; | 790 | regs->cp0_epc += 8; |
791 | break; | 791 | break; |
792 | #endif | 792 | #endif |
793 | case cbcond0_op: | ||
794 | /* Only valid for MIPS R6 */ | ||
795 | if (!cpu_has_mips_r6) { | ||
796 | ret = -SIGILL; | ||
797 | break; | ||
798 | } | ||
799 | /* Compact branches: bovc, beqc, beqzalc */ | ||
800 | if (insn.i_format.rt && !insn.i_format.rs) | ||
801 | regs->regs[31] = epc + 4; | ||
802 | regs->cp0_epc += 8; | ||
803 | break; | ||
793 | } | 804 | } |
794 | 805 | ||
795 | return ret; | 806 | return ret; |
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index 7f373a2858b5..c115d969664b 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -623,6 +623,15 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, | |||
623 | dec_insn.pc_inc + | 623 | dec_insn.pc_inc + |
624 | dec_insn.next_pc_inc; | 624 | dec_insn.next_pc_inc; |
625 | return 1; | 625 | return 1; |
626 | case cbcond0_op: | ||
627 | if (!cpu_has_mips_r6) | ||
628 | break; | ||
629 | if (insn.i_format.rt && !insn.i_format.rs) | ||
630 | regs->regs[31] = regs->cp0_epc + 4; | ||
631 | *contpc = regs->cp0_epc + dec_insn.pc_inc + | ||
632 | dec_insn.next_pc_inc; | ||
633 | |||
634 | return 1; | ||
626 | #ifdef CONFIG_CPU_CAVIUM_OCTEON | 635 | #ifdef CONFIG_CPU_CAVIUM_OCTEON |
627 | case lwc2_op: /* This is bbit0 on Octeon */ | 636 | case lwc2_op: /* This is bbit0 on Octeon */ |
628 | if ((regs->regs[insn.i_format.rs] & (1ull<<insn.i_format.rt)) == 0) | 637 | if ((regs->regs[insn.i_format.rs] & (1ull<<insn.i_format.rt)) == 0) |