]> git.proxmox.com Git - mirror_ubuntu-zesty-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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 19 Jul 2017 07:58:23 +0000 (09:58 +0200)
commit0bd89be0bec42f2ee16347f69cd2c25a04232f5d
tree28039a67b6f01c40ebbc100954c7597cb49da821
parent2fbefc57d7d90cb325e7ef5cd9741a7d9bf9903d
MIPS: Fix bnezc/jialc return address calculation

BugLink: http://bugs.launchpad.net/bugs/1702104
commit 1a73d9310e093fc3adffba4d0a67b9fab2ee3f63 upstream.

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: 28d6f93d201d ("MIPS: Emulate the new MIPS R6 BNEZC and JIALC instructions")
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16178/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
arch/mips/kernel/branch.c