]> 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)
committerNicholas Piggin <npiggin@gmail.com>
Sun, 3 Nov 2024 23:07:29 +0000 (09:07 +1000)
commitc9b8a13a8841e0e23901e57e24ea98eeef16cf91
tree54baaf3351e4e85ba64063502ff567dead664144
parent92ec7805190313c9e628f8fc4eb4f932c15247bd
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>
target/ppc/translate.c