Skip to contentSkip to conversation

Patch "MIPS: math-emu: Emulate missing BC1{EQ,NE}Z instructions" has been added to the 4.2-stable tree

PATCH [email protected] 1 participant 1 message Sep 23, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

MIPS: math-emu: Emulate missing BC1{EQ,NE}Z instructions

to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mips-math-emu-emulate-missing-bc1-eq-ne-z-instructions.patch
and it can be found in the queue-4.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From c909ca718e8f50cf484ef06a8dd935e738e8e53d Mon Sep 17 00:00:00 2001

From: Markos Chandras <[email protected]>
Date: Fri, 17 Jul 2015 10:38:32 +0100
Subject: MIPS: math-emu: Emulate missing BC1{EQ,NE}Z instructions

From: Markos Chandras <[email protected]>

commit c909ca718e8f50cf484ef06a8dd935e738e8e53d upstream.

Commit c8a34581ec09 ("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.

Fixes c8a34581ec09 ("MIPS: Emulate the BC1{EQ,NE}Z FPU instructions")

Patchwork: https://patchwork.linux-mips.org/patch/10738/

---
 arch/mips/math-emu/cp1emu.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
arch/mips/math-emu/cp1emu.c +19 -1
@@ -1181,6 +1181,24 @@ emul:
 			}
 			break;
 
+		case bc1eqz_op:
+		case bc1nez_op:
+			if (!cpu_has_mips_r6 || delay_slot(xcp))
+				return SIGILL;
+
+			cond = likely = 0;
+			switch (MIPSInst_RS(ir)) {
+			case bc1eqz_op:
+				if (get_fpr32(&current->thread.fpu.fpr[MIPSInst_RT(ir)], 0) & 0x1)
+				    cond = 1;
+				break;
+			case bc1nez_op:
+				if (!(get_fpr32(&current->thread.fpu.fpr[MIPSInst_RT(ir)], 0) & 0x1))
+				    cond = 1;
+				break;
+			}
+			goto branch_common;
+
 		case bc_op:
 			if (delay_slot(xcp))
 				return SIGILL;
@@ -1207,7 +1225,7 @@ emul:
 			case bct_op:
 				break;
 			}
-
+branch_common:
 			set_delay_slot(xcp);
 			if (cond) {
 				/*

Patches currently in stable-queue which might be from [email protected] are

queue-4.2/mips-math-emu-allow-m-f-t-hc-emulation-on-mips-r6.patch queue-4.2/mips-cps-use-32b-accesses-to-gcrs.patch queue-4.2/mips-math-emu-emulate-missing-bc1-eq-ne-z-instructions.patch