]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/ppc: Set ctx->opcode for decode_insn32()
authorIlya Leoshkevich <iii@linux.ibm.com>
Mon, 12 Aug 2024 08:53:08 +0000 (10:53 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Sun, 10 Nov 2024 08:09:27 +0000 (11:09 +0300)
commit6cfa03eaec0e1b46768644b6509de1a6dd872114
tree60a39cb759bde98f1d289fb001dee5dab4415243
parent1eb81dfac96be1b47b9efbcaec7e2dd08c3e0a2e
target/ppc: Set ctx->opcode for decode_insn32()

divdu (without a dot) sometimes updates cr0, even though it shouldn't.
The reason is that gen_op_arith_divd() checks Rc(ctx->opcode), which is
not initialized. This field is initialized only for instructions that
go through decode_legacy(), and not decodetree.

There already was a similar issue fixed in commit 86e6202a57b1
("target/ppc: Make divw[u] handler method decodetree compatible.").

It's not immediately clear what else may access the uninitialized
ctx->opcode, so instead of playing whack-a-mole and changing the check
to compute_rc0, simply initialize ctx->opcode.

Cc: qemu-stable@nongnu.org
Fixes: 99082815f17f ("target/ppc: Add infrastructure for prefixed insns")
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
(cherry picked from commit c9b8a13a8841e0e23901e57e24ea98eeef16cf91)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
target/ppc/translate.c