[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/35] target/ppc: Fix LQ, STQ register-pair order for big-endian
From: |
Cédric Le Goater |
Subject: |
[PULL 28/35] target/ppc: Fix LQ, STQ register-pair order for big-endian |
Date: |
Mon, 4 Sep 2023 11:06:23 +0200 |
From: Nicholas Piggin <npiggin@gmail.com>
LQ, STQ have the same register-pair ordering as LQARX/STQARX., which is
the even (lower) register contains the most significant bits. This is
not implemented correctly for big-endian.
do_ldst_quad() has variables low_addr_gpr and high_addr_gpr which is
confusing because they are low and high addresses, whereas LQARX/STQARX.
and most such things use the low and high values for lo/hi variables.
The conversion to native 128-bit memory access functions missed this
strangeness.
Fix this by changing the if condition, and change the variable names to
hi/lo to match convention.
Cc: qemu-stable@nongnu.org
Reported-by: Ivan Warren <ivan@vmfacility.fr>
Fixes: 57b38ffd0c6f ("target/ppc: Use tcg_gen_qemu_{ld,st}_i128 for LQARX, LQ,
STQ")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1836
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
target/ppc/translate/fixedpoint-impl.c.inc | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/target/ppc/translate/fixedpoint-impl.c.inc
b/target/ppc/translate/fixedpoint-impl.c.inc
index 4ce02fd3a479..7ff7e1ec46a9 100644
--- a/target/ppc/translate/fixedpoint-impl.c.inc
+++ b/target/ppc/translate/fixedpoint-impl.c.inc
@@ -71,7 +71,7 @@ static bool do_ldst_quad(DisasContext *ctx, arg_D *a, bool
store, bool prefixed)
{
#if defined(TARGET_PPC64)
TCGv ea;
- TCGv_i64 low_addr_gpr, high_addr_gpr;
+ TCGv_i64 lo, hi;
TCGv_i128 t16;
REQUIRE_INSNS_FLAGS(ctx, 64BX);
@@ -94,21 +94,21 @@ static bool do_ldst_quad(DisasContext *ctx, arg_D *a, bool
store, bool prefixed)
gen_set_access_type(ctx, ACCESS_INT);
ea = do_ea_calc(ctx, a->ra, tcg_constant_tl(a->si));
- if (prefixed || !ctx->le_mode) {
- low_addr_gpr = cpu_gpr[a->rt];
- high_addr_gpr = cpu_gpr[a->rt + 1];
+ if (ctx->le_mode && prefixed) {
+ lo = cpu_gpr[a->rt];
+ hi = cpu_gpr[a->rt + 1];
} else {
- low_addr_gpr = cpu_gpr[a->rt + 1];
- high_addr_gpr = cpu_gpr[a->rt];
+ lo = cpu_gpr[a->rt + 1];
+ hi = cpu_gpr[a->rt];
}
t16 = tcg_temp_new_i128();
if (store) {
- tcg_gen_concat_i64_i128(t16, low_addr_gpr, high_addr_gpr);
+ tcg_gen_concat_i64_i128(t16, lo, hi);
tcg_gen_qemu_st_i128(t16, ea, ctx->mem_idx, DEF_MEMOP(MO_128));
} else {
tcg_gen_qemu_ld_i128(t16, ea, ctx->mem_idx, DEF_MEMOP(MO_128));
- tcg_gen_extr_i128_i64(low_addr_gpr, high_addr_gpr, t16);
+ tcg_gen_extr_i128_i64(lo, hi, t16);
}
#else
qemu_build_not_reached();
--
2.41.0
- [PULL 18/35] target/ppc: Migrate DECR SPR, (continued)
- [PULL 18/35] target/ppc: Migrate DECR SPR, Cédric Le Goater, 2023/09/04
- [PULL 19/35] hw/ppc: Reset timebase facilities on machine reset, Cédric Le Goater, 2023/09/04
- [PULL 20/35] hw/ppc: Read time only once to perform decrementer write, Cédric Le Goater, 2023/09/04
- [PULL 21/35] target/ppc: Fix CPU reservation migration for record-replay, Cédric Le Goater, 2023/09/04
- [PULL 23/35] spapr: Fix machine reset deadlock from replay-record, Cédric Le Goater, 2023/09/04
- [PULL 25/35] tests/avocado: boot ppc64 pseries replay-record test to Linux VFS mount, Cédric Le Goater, 2023/09/04
- [PULL 24/35] spapr: Fix record-replay machine reset consuming too many events, Cédric Le Goater, 2023/09/04
- [PULL 22/35] target/ppc: Fix timebase reset with record-replay, Cédric Le Goater, 2023/09/04
- [PULL 27/35] tests/avocado: ppc64 reverse debugging tests for pseries and powernv, Cédric Le Goater, 2023/09/04
- [PULL 26/35] tests/avocado: reverse-debugging cope with re-executing breakpoints, Cédric Le Goater, 2023/09/04
- [PULL 28/35] target/ppc: Fix LQ, STQ register-pair order for big-endian,
Cédric Le Goater <=
- [PULL 29/35] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr, Cédric Le Goater, 2023/09/04
- [PULL 30/35] hw/ppc/e500: fix broken snapshot replay, Cédric Le Goater, 2023/09/04
- [PULL 32/35] ppc/xive: Use address_space routines to access the machine RAM, Cédric Le Goater, 2023/09/04
- [PULL 31/35] target/ppc: Fix the order of kvm_enable judgment about kvmppc_set_interrupt(), Cédric Le Goater, 2023/09/04
- [PULL 33/35] ppc/xive: Introduce a new XiveRouter end_notify() handler, Cédric Le Goater, 2023/09/04
- [PULL 35/35] ppc/xive: Add support for the PC MMIOs, Cédric Le Goater, 2023/09/04
- [PULL 34/35] ppc/xive: Handle END triggers between chips with MMIOs, Cédric Le Goater, 2023/09/04
- Re: [PULL 00/35] ppc queue, Cédric Le Goater, 2023/09/06