]> 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>
Tue, 5 Nov 2024 15:22:57 +0000 (18:22 +0300)
commit563d60e921597b0e829b2764646d43d7c445783f
tree7ae8469140dd1e6e45251d5ffe335aa175b74d62
parent56478d5a5eafd7b419a69729f487d97c14696ec0
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