[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-9.1.2 37/58] target/ppc: Set ctx->opcode for decode_insn32()
From: |
Michael Tokarev |
Subject: |
[Stable-9.1.2 37/58] target/ppc: Set ctx->opcode for decode_insn32() |
Date: |
Sat, 9 Nov 2024 15:08:38 +0300 |
From: Ilya Leoshkevich <iii@linux.ibm.com>
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>
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 71513ba964..02c810e884 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -6426,8 +6426,6 @@ static bool decode_legacy(PowerPCCPU *cpu, DisasContext
*ctx, uint32_t insn)
opc_handler_t **table, *handler;
uint32_t inval;
- ctx->opcode = insn;
-
LOG_DISAS("translate opcode %08x (%02x %02x %02x %02x) (%s)\n",
insn, opc1(insn), opc2(insn), opc3(insn), opc4(insn),
ctx->le_mode ? "little" : "big");
@@ -6561,6 +6559,7 @@ static void ppc_tr_translate_insn(DisasContextBase
*dcbase, CPUState *cs)
ctx->base.pc_next = pc += 4;
if (!is_prefix_insn(ctx, insn)) {
+ ctx->opcode = insn;
ok = (decode_insn32(ctx, insn) ||
decode_legacy(cpu, ctx, insn));
} else if ((pc & 63) == 0) {
--
2.39.5
- [Stable-9.1.2 20/58] net: Check if nc is NULL in qemu_get_vnet_hdr_len(), (continued)
- [Stable-9.1.2 20/58] net: Check if nc is NULL in qemu_get_vnet_hdr_len(), Michael Tokarev, 2024/11/09
- [Stable-9.1.2 23/58] net/tap-win32: Fix gcc 14 format truncation errors, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 22/58] net: fix build when libbpf is disabled, but libxdp is enabled, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 33/58] hw/intc/riscv_aplic: Check and update pending when write sourcecfg, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 35/58] target/riscv/kvm: clarify how 'riscv-aia' default works, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 25/58] hw/sd/omap_mmc: Don't use sd_cmd_type_t, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 26/58] target/arm: Fix arithmetic underflow in SETM instruction, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 27/58] target/arm: Store FPSR cumulative exception bits in env->vfp.fpsr, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 28/58] stubs: avoid duplicate symbols in libqemuutil.a, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 36/58] target/riscv: Fix vcompress with rvv_ta_all_1s, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 37/58] target/ppc: Set ctx->opcode for decode_insn32(),
Michael Tokarev <=
- [Stable-9.1.2 29/58] target/riscv/csr.c: Fix an access to VXSAT, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 32/58] target/riscv: Set vtype.vill on CPU reset, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 34/58] target/riscv/kvm: set 'aia_mode' to default in error path, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 38/58] target/ppc: Make divd[u] handler method decodetree compatible, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 40/58] ppc/pnv: Fix LPC POWER8 register sanity check, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 42/58] target/ppc: Fix HFSCR facility checks, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 43/58] ppc/pnv: ADU fix possible buffer overrun with invalid size, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 39/58] ppc/pnv: Fix LPC serirq routing calculation, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 44/58] hw/ssi/pnv_spi: Match _xfer_buffer_free() with _xfer_buffer_new(), Michael Tokarev, 2024/11/09
- [Stable-9.1.2 41/58] target/ppc: Fix mtDPDES targeting SMT siblings, Michael Tokarev, 2024/11/09