[PATCH RFC 54/67] MIPS: kernel: branch: Add new MIPS R6 B{L,G}TZ{AL,}C emulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



MIPS R6 added the following four instructions which share the
BGTZ and BGTZL opcode:

BLTZALC: Compact branch-and-link if GPR rt is < to zero
BGEZALC: Compact branch-and-link if GPR rt is > to zero
BGTZL: Compact branch if GPR rt is < to zero
BGEZL: Compact branch if GPR rt is > to zero

Signed-off-by: Markos Chandras <markos.chandras@xxxxxxxxxx>
---
 arch/mips/kernel/branch.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index 7bc2df026b51..ca102557fa3c 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -648,6 +648,19 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
 			ret = -SIGILL;
 			break;
 		}
+		/* bgtzalc, bltzalc, bgtzc, bltzc */
+		if (cpu_has_mips_r6) {
+			if (insn.i_format.rt) {
+				if (insn.i_format.opcode == blez_op)
+					if (insn.i_format.rs ==
+					    insn.i_format.rt ||
+					    !insn.i_format.rs)
+						regs->regs[31] = epc + 4;
+				regs->cp0_epc += 8;
+				break;
+			}
+		}
+
 		/* rt field assumed to be zero */
 		if ((long)regs->regs[insn.i_format.rs] > 0) {
 			epc = epc + 4 + (insn.i_format.simmediate << 2);
-- 
2.2.0






[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux