summaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/fpu_emulator.h
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-01-22 05:20:46 +0000
committerRalf Baechle <ralf@linux-mips.org>2016-01-24 01:35:46 +0100
commit733b8bc183f491e8263009edf8ef184fb44a6882 (patch)
tree66645e3de66dd678e42db66113be76c21a0c766a /arch/mips/include/asm/fpu_emulator.h
parenta87265cfedce49fa362030ae3e6ef047e08bc12c (diff)
downloadlinux-733b8bc183f491e8263009edf8ef184fb44a6882.tar.gz
linux-733b8bc183f491e8263009edf8ef184fb44a6882.tar.bz2
linux-733b8bc183f491e8263009edf8ef184fb44a6882.zip
MIPS: math-emu: Make microMIPS branch delay slot emulation work
Complement commit 102cedc32a6e ("MIPS: microMIPS: Floating point support.") which introduced microMIPS FPU emulation, but did not adjust the encoding of the BREAK instruction used to terminate the branch delay slot emulation frame. Consequently the execution of any such frame is indeterminate and, depending on CPU configuration, will result in random code execution or an offending program being terminated with SIGILL. This is because the regular MIPS BREAK instruction is encoded with the 0 major and the 0xd minor opcode, however in the microMIPS instruction set this major/minor opcode pair denotes an encoding reserved for the DSP ASE. Instead the microMIPS BREAK instruction is encoded with the 0 major and the 0x7 minor opcode. Use the correct BREAK encoding for microMIPS FPU emulation then. Signed-off-by: Maciej W. Rozycki <macro@imgtec.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/12174/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include/asm/fpu_emulator.h')
-rw-r--r--arch/mips/include/asm/fpu_emulator.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/mips/include/asm/fpu_emulator.h b/arch/mips/include/asm/fpu_emulator.h
index 2f021cdfba4f..3225c3c0724b 100644
--- a/arch/mips/include/asm/fpu_emulator.h
+++ b/arch/mips/include/asm/fpu_emulator.h
@@ -79,7 +79,7 @@ int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
/*
* Break instruction with special math emu break code set
*/
-#define BREAK_MATH (0x0000000d | (BRK_MEMU << 16))
+#define BREAK_MATH(micromips) (((micromips) ? 0x7 : 0xd) | (BRK_MEMU << 16))
#define SIGNALLING_NAN 0x7ff800007ff80000LL