OSDN Git Service

MIPS: r2-on-r6-emu: Fix BLEZL and BGTZL identification
authorLeonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Mon, 13 Mar 2017 15:36:35 +0000 (16:36 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 10 Apr 2017 09:56:08 +0000 (11:56 +0200)
commit5bba7aa4958e271c3ffceb70d47d3206524cf489
treee3fcc8af6ce480f9e11ccdeeec69c5fae959d3d6
parent17c99d9421695a0e0de18bf1e7091d859e20ec1d
MIPS: r2-on-r6-emu: Fix BLEZL and BGTZL identification

Fix the problem of inaccurate identification of instructions BLEZL and
BGTZL in R2 emulation code by making sure all necessary encoding
specifications are met.

Previously, certain R6 instructions could be identified as BLEZL or
BGTZL. R2 emulation routine didn't take into account that both BLEZL
and BGTZL instructions require their rt field (bits 20 to 16 of
instruction encoding) to be 0, and that, at same time, if the value in
that field is not 0, the encoding may represent a legitimate MIPS R6
instruction.

This means that a problem could occur after emulation optimization,
when emulation routine tried to pipeline emulation, picked up a next
candidate, and subsequently misrecognized an R6 instruction as BLEZL
or BGTZL.

It should be said that for single pass strategy, the problem does not
happen because CPU doesn't trap on branch-compacts which share opcode
space with BLEZL/BGTZL (but have rt field != 0, of course).

Signed-off-by: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtech.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtech.com>
Reported-by: Douglas Leung <douglas.leung@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Cc: james.hogan@imgtec.com
Cc: petar.jovanovic@imgtec.com
Cc: goran.ferenc@imgtec.com
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15456/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/mips-r2-to-r6-emul.c