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: 832756 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp870397wra; Fri, 4 Oct 2024 09:35:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUZzGjrqFzzyV2aABUXH2og0n6ON1/Y5ffHTNb7Smf30Vi6lTRy4gf3kplECJmkCiqbqOcohg==@linaro.org X-Google-Smtp-Source: AGHT+IEZr3MTKRZrn+YMc6zc8CA/7ddHSZWyymHeYQ7dLzV2kdW2M72QklmLc40k/JuE54YqEX1y X-Received: by 2002:a05:6402:4314:b0:5c7:1f13:9352 with SMTP id 4fb4d7f45d1cf-5c8d2ed3439mr2761798a12.34.1728059757912; Fri, 04 Oct 2024 09:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059757; cv=none; d=google.com; s=arc-20240605; b=bwBWTIYIX7RQ2Swp3PHlhpAJC5KJEhdlxlwC7OjdfzV+FjZUMQEFtkhoR8VCjKBEVs aeBSB5dKoujoiZYl37LljYQCi1fA+VgLQobHE9pFNe7gISlBnw+YQBY4804U2sN5AqTS rEbW2mA9Gzu/1pHU3jsvuT3eonszQeg0ONy2IU62ChjEo7cghDx3YHy8ZFynUlYgOZ3g dX0o2UgNNcXWhJ+MpVzZOYx26OXKCTiH9tJmnM8O8hgYVm/rOlXNXaEnfa+6qWMnhs8F 5cW8wjVtZp86jRDzcA8W8YVsKTGSI9cJTLwX7IlX2A0M4rc3S7iZUk5kSuQRwbwvPRK6 B84Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dOkCKWbC4XaUTj+zlW7/8n4oz5mVQsEd+mLoNBOmOog=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=Dpf/tGBLxwx6j+1EQvOPWbXKeKXJ5MO3oKB99QF10t5amH/vZCIhVEqLTFVu+hNn/J fXDGXzWkGCz0VmiBONvdyYBdQnzl2NYDyFoJIVeoNOs4zxy3mF/xCDbGKPm1V/5vHIjl 8sa3oi+Bzo88Rgw7BhGhfRhWrpNj04ahwo7dsc3dtiRZ57RoOtSvZvXcmZyFBwx76Oya pTnqS0bb3hV8y77eZL8/3YHFVilAKDPKizRGK/ummd5A99co8X9VgpgG6uGgvtW1Tzoi RRWGZfnifn+yx/boYjdaJ6BUZXFjEK8SOzs+80dcUHx0JbN0LVbg96G2Vvg0pUgufOhN 9ZBg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J6M9ww9S; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5c8e05f0fe8si51129a12.445.2024.10.04.09.35.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:35:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J6M9ww9S; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swlGt-0007SL-8W; Fri, 04 Oct 2024 12:35:15 -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 1swlGH-0006La-2q for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:34:37 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlGD-00068c-L1 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:34:36 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-53988c54ec8so2779778e87.0 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=c6CNDdfY31yPWLqwgueZVZkwqp2GYWiqeSHAJlJMmS9dM2Cyxu0s5fZiAdbSwuzitE kJtKNOEGzcUdQxToJpCkDEbsb7nzx2oo/nkrBNCWENnyOABMT68X6gUEDVmaKYRt2+Am oEN6k4TQ5/9DSenM9M1jHVfOUfGC6z3WSlFRdS5uHCgQDXiR5hBNPiyv2JTJMr8VwYke xX+eVYJBSIpYATO9NziHKs4lD3QYw+Y7XjYLRCnQ2IxY5prX4OkCH+JxB4eZY3/vmWuA HSGEfxDAgbsAQZ0ONUVodjdgRdJ5Bt2HcKsajBPNAuWQYIPIbUtcWjkhgmLV2RJ3LSLx tLlg== X-Gm-Message-State: AOJu0Ywk45vt7ZG2ix92kV7Vh4q2/oJK0B56lgAXliybbqTcmmkAWYOw MiDzWWoRpk87MV/vRGbwXtTEE2cgetYMSSL16oRq4aDLCDm85A4iIjzUj1VMt2ngCd0CWOw5WHd TPkpXtw== 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::130; envelope-from=philmd@linaro.org; helo=mail-lf1-x130.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@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-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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;