]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: Fix bnezc/jialc return address calculation
authorPaul Burton <paul.burton@imgtec.com>
Fri, 2 Jun 2017 18:35:01 +0000 (11:35 -0700)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 15 Jun 2017 09:47:42 +0000 (11:47 +0200)
commitd0f294ee4c18a84f1893d635e5b96e88cf1a7188
tree82140dccc098d00836472543a6a645fe92d0f804
parent2c48d153605573f4786f06429fc2fee564396510
MIPS: Fix bnezc/jialc return address calculation

The code handling the pop76 opcode (ie. bnezc & jialc instructions) in
__compute_return_epc_for_insn() needs to set the value of $31 in the
jialc case, which is encoded with rs = 0. However its check to
differentiate bnezc (rs != 0) from jialc (rs = 0) was unfortunately
backwards, meaning that if we emulate a bnezc instruction we clobber $31
& if we emulate a jialc instruction it actually behaves like a jic
instruction.

Fix this by inverting the check of rs to match the way the instructions
are actually encoded.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Fixes: 856f55cb2b6f ("MIPS: Emulate the new MIPS R6 BNEZC and JIALC instructions")
Cc: stable <stable@vger.kernel.org> # v4.0+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16178/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/branch.c