From patchwork Fri Oct 4 16:30:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1992926 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=J6M9ww9S; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XKvVt1qtjz1xt7 for ; Sat, 5 Oct 2024 02:43:18 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swlGk-00073t-Ob; Fri, 04 Oct 2024 12:35:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swlGF-00063K-1J for qemu-ppc@nongnu.org; Fri, 04 Oct 2024 12:34:35 -0400 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlGD-00068V-64 for qemu-ppc@nongnu.org; Fri, 04 Oct 2024 12:34:34 -0400 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-5398ec2f3c3so3069269e87.1 for ; Fri, 04 Oct 2024 09:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059671; x=1728664471; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dOkCKWbC4XaUTj+zlW7/8n4oz5mVQsEd+mLoNBOmOog=; b=J6M9ww9Sx0QfpjWC9+bTOJMJPHFCi3bNw3zSUdIE2/UvH6pm5kYomiUBu/Db2LHeik N18JPj+5RgZoDfsuRoU+BLHGn6A0vOPmUpfHCRynRP+sMC0mHUn9Yq3CYVQhTZyrWDGf jOHUVM0efRzOygf2lk2OJCVxDSzkii0F/KfUu3MnxLnTrYpPa7wafLLA/u8JV9GAkuMJ Dwrj++aLcP8Fp5I8n12ziiAXP7Z6DMXH1nixNTvI0w0s+rF/bjH+z9DdOjzs2UHHEks4 NL8/TtlMIWrZUtYOYO1oenWy8mNyDf63NTEYYzGV23/H6FsojoNBUSKP6RaEzZqBlnyC 9f5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059671; x=1728664471; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dOkCKWbC4XaUTj+zlW7/8n4oz5mVQsEd+mLoNBOmOog=; b=MmDTLGUvaiXJndkrXsNlyh73VOss2IXejZCOFeqlXRFOB9k5GARFokCe6cU9dDF5D/ PnMzWTUiNQiJ9EO9bj1IOsNJeKaiCJ3b3mixapsZoAK1bOMjmNPnlWmYpG6ctfVj6yJw ON9QMmxR8LMnVPzkB6j2E/SegYY9z1ByhHKlv6z2xXfqOXwb0L5g6ozYjVdvYn5DEGNo QVahWZJQn49WjkGHsPIUbXZtm+x0zkHQM/TLJHAlWKWsllFL+ZCLJp/1YCZy58JJrfSJ gVyHULX4ReTuJtvIJDgL4Stqf9ZTYO/CXA1iODXyVSuh2R1T+mgHENaFpQAiIpOIc0xp j3wQ== X-Forwarded-Encrypted: i=1; AJvYcCUqICvJgd7JCvQFPckLGGLZp/+7W6cgT/HMQS04Bqtge49kf/cG9Tub8l3AbvAJ0HNVEWcZ3A09RA==@nongnu.org X-Gm-Message-State: AOJu0YxdMVEYvL0JYiWcdOq77EV82tPBaGzjHK0vvoUwBwh6+nNk/DIZ W7d/iNawDms9qWaUotaM5durr9+TJK1r6mb11ZmhoPLcVK6QS4e5IP2JgUgsVJg= X-Google-Smtp-Source: AGHT+IFypIXsz1g/PCzFyL9iJ3D4FqeWw3/EK9y7qPIrO561yhedYQKflkwOGJ1omPJhZt9CtBuwfQ== X-Received: by 2002:a05:6512:1382:b0:52e:9cc7:4461 with SMTP id 2adb3069b0e04-539ab86253bmr2275489e87.5.1728059671349; Fri, 04 Oct 2024 09:34:31 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539aff1d322sm1096e87.144.2024.10.04.09.34.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:34:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, Thomas Huth , Richard Henderson , Pierrick Bouvier , qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 15/25] target/rx: Use explicit little-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:31 -0300 Message-ID: <20241004163042.85922-16-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004163042.85922-1-philmd@linaro.org> References: <20241004163042.85922-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=philmd@linaro.org; helo=mail-lf1-x12d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-ppc@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org The RX architecture uses little endianness. Directly use the little-endian LD/ST API. Mechanical change using: $ end=le; \ for acc in uw w l q tul; do \ sed -i -e "s/ld${acc}_p(/ld${acc}_${end}_p(/" \ -e "s/st${acc}_p(/st${acc}_${end}_p(/" \ $(git grep -wlE '(ld|st)t?u?[wlq]_p' target/rx/); \ done Signed-off-by: Philippe Mathieu-Daudé --- target/rx/cpu.c | 2 +- target/rx/gdbstub.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 36d2a6f1890..458b8ee072d 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -86,7 +86,7 @@ static void rx_cpu_reset_hold(Object *obj, ResetType type) resetvec = rom_ptr(0xfffffffc, 4); if (resetvec) { /* In the case of kernel, it is ignored because it is not set. */ - env->pc = ldl_p(resetvec); + env->pc = ldl_le_p(resetvec); } rx_cpu_unpack_psw(env, 0, 1); env->regs[0] = env->isp = env->usp = 0; diff --git a/target/rx/gdbstub.c b/target/rx/gdbstub.c index f222bf003be..30074c9da7b 100644 --- a/target/rx/gdbstub.c +++ b/target/rx/gdbstub.c @@ -56,7 +56,7 @@ int rx_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) uint32_t psw; switch (n) { case 0 ... 15: - env->regs[n] = ldl_p(mem_buf); + env->regs[n] = ldl_le_p(mem_buf); if (n == 0) { if (env->psw_u) { env->usp = env->regs[0]; @@ -66,38 +66,38 @@ int rx_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) } break; case 16: - env->usp = ldl_p(mem_buf); + env->usp = ldl_le_p(mem_buf); if (env->psw_u) { - env->regs[0] = ldl_p(mem_buf); + env->regs[0] = ldl_le_p(mem_buf); } break; case 17: - env->isp = ldl_p(mem_buf); + env->isp = ldl_le_p(mem_buf); if (!env->psw_u) { - env->regs[0] = ldl_p(mem_buf); + env->regs[0] = ldl_le_p(mem_buf); } break; case 18: - psw = ldl_p(mem_buf); + psw = ldl_le_p(mem_buf); rx_cpu_unpack_psw(env, psw, 1); break; case 19: - env->pc = ldl_p(mem_buf); + env->pc = ldl_le_p(mem_buf); break; case 20: - env->intb = ldl_p(mem_buf); + env->intb = ldl_le_p(mem_buf); break; case 21: - env->bpsw = ldl_p(mem_buf); + env->bpsw = ldl_le_p(mem_buf); break; case 22: - env->bpc = ldl_p(mem_buf); + env->bpc = ldl_le_p(mem_buf); break; case 23: - env->fintv = ldl_p(mem_buf); + env->fintv = ldl_le_p(mem_buf); break; case 24: - env->fpsw = ldl_p(mem_buf); + env->fpsw = ldl_le_p(mem_buf); break; case 25: return 8;