[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.1.1 21/34] target/ppc: Fix LQ, STQ register-pair order for big
From: |
Michael Tokarev |
Subject: |
[Stable-8.1.1 21/34] target/ppc: Fix LQ, STQ register-pair order for big-endian |
Date: |
Sat, 9 Sep 2023 13:27:14 +0300 |
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>
(cherry picked from commit 718209358f2e4f231cbacf974c3299c4fe7beb83)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/target/ppc/translate/fixedpoint-impl.c.inc
b/target/ppc/translate/fixedpoint-impl.c.inc
index f47f1a50e8..b423c09c26 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.39.2
- [Stable-8.1.1 12/34] softmmu: Use async_run_on_cpu in tcg_commit, (continued)
- [Stable-8.1.1 12/34] softmmu: Use async_run_on_cpu in tcg_commit, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 13/34] block-migration: Ensure we don't crash during migration cleanup, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 14/34] target/arm: properly document FEAT_CRC32, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 15/34] linux-user: Adjust brk for load_bias, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 16/34] target/i386: raise FERR interrupt with iothread locked, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 17/34] ui/dbus: Properly dispose touch/mouse dbus objects, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 18/34] ppc/vof: Fix missed fields in VOF cleanup, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 19/34] hw/ppc/e500: fix broken snapshot replay, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 20/34] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 22/34] hw/ide/core: set ERR_STAT in unsupported command completion, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 21/34] target/ppc: Fix LQ, STQ register-pair order for big-endian,
Michael Tokarev <=
- [Stable-8.1.1 23/34] hw/ide/ahci: write D2H FIS when processing NCQ command, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 24/34] hw/ide/ahci: simplify and document PxCI handling, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 26/34] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 25/34] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 28/34] hw/ide/ahci: fix broken SError handling, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 27/34] hw/ide/ahci: fix ahci_write_fis_sdb(), Michael Tokarev, 2023/09/09
- [Stable-8.1.1 29/34] hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 30/34] hw/i2c/aspeed: Fix TXBUF transmission start position error, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 31/34] qemu-options.hx: Rephrase the descriptions of the -hd* and -cdrom options, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 32/34] docs tests: Fix use of migrate_set_parameter, Michael Tokarev, 2023/09/09