From patchwork Fri Oct 4 16:30:28 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: 832753 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp869614wra; Fri, 4 Oct 2024 09:34:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVGXAh1xNIITszD+J4grTD4SROMmMGsMa24/+1QkwkEESnbSY+GHs/Dy1HcQLSK7NZ88dj/9Q==@linaro.org X-Google-Smtp-Source: AGHT+IGvWbZsru/uS1qIX5bPf6HcA9/SDVfEOBKVplQa64Xha+BcgmfPVm9WAeqlTRX0YGRsl77x X-Received: by 2002:a05:622a:598c:b0:45b:16f5:6c16 with SMTP id d75a77b69052e-45d9ba62e5dmr58896161cf.24.1728059658069; Fri, 04 Oct 2024 09:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059658; cv=none; d=google.com; s=arc-20240605; b=DxEoYJ7IzcNMkJHOVgDf9jROnGOctY3zyHRN9tsks0TrNlG4h5KtcOFcirHaSjrSom Uxswhc5g9RWo7LoheCKPnIEI6AW3jXvQcpeLab3EA/JSqa41ye8GuWtTl5Yx+n0QxZrG HwpxW5Mv481lNNDXJEJlA0EXSDwWlS+4imyctVCbuHut5306GqfQ+GY8GC2Z8K2NPp7n x9gGFHeZlnn1NiKd9QBzyphvf2/yVscju5vwz+hX2PLTdAyezYGE69UlRBtwj6Cb+V5H rZa4JCx3eg1ZNyzwrm86E5n8Szh/K92g/VNXrGGuNB+lmctWsP5Tv+0wrZA1Em1r93Vm lVBg== 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=hLzg4uMG2cx+IKbaUwzfii1q1L/0Wc5xbNn8QzHBma0=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=JymuZSUwyUFTfknWdqAbKiOEWiPOh0aEeYIWpP08Lt+NmxWKaIoYYVRd+d1H2mRCkW Z0w5K3Q2Oit86STbEvNT4mfGO/C+Vi0fw9YbwiDPHYE1nMAfghh/HR1Tz0N2SYQJLa5o nhvvjvpffa2UUxJOzgGT5uEZ3ackAhH6pWNkcuew0piU5Yj1S3Bfhx9Legpd38ocPcRA FMxNJa5+jI125Qgb3IMzc1leNwqq00rXJ7nF1sa48ufKGiLnPACZ0MO0qyhhEIDmV+Q9 fokpanFY3pvxY7PPTiCMrOhWteWrkWp/EHqVsmYVlYQ3NolO5AEaPKhOOcOUiMkTaDNO TrIw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZGrzTCf0; 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 d75a77b69052e-45da75e22d7si1255911cf.372.2024.10.04.09.34.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:34:18 -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=ZGrzTCf0; 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 1swlFl-0001hr-Up; Fri, 04 Oct 2024 12:34:06 -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 1swlFX-0000Q2-3f for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:33:51 -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 1swlFU-0005yj-Ph for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:33:50 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-5399041167cso4063653e87.0 for ; Fri, 04 Oct 2024 09:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059627; x=1728664427; 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=hLzg4uMG2cx+IKbaUwzfii1q1L/0Wc5xbNn8QzHBma0=; b=ZGrzTCf0aCI/SK37IHwhcqfSdUL0BqiYgZlmmGh9E5PRuKKQtMsCFhpfEPhnJKOZpM vqxW/IMXXxRX+SJjfAvBdyT1ahHT+jgYymKp1oh8BtS7SfuUy0XMCWjGBULu+CG1Hhge PDEwk6NO8dZnWz7xQIc2KsgOXAxCfDPvWL9fIVvEoFp7DuXZ9ki0FhNvTppASATzKJCq cx0PWWffM29TZ10u9jJ+ZOWgMR1VD/ezvd86tZHdPwUZ5PSWQvtNICCQgLW4EM+U2Ys7 gu45omNUfAzy0hvL/4Lgw3qyMf4MfMhq0sNqcYrW2EV8c6cZGEDHwf5iRcBgP2Lh+K3N 8HTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059627; x=1728664427; 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=hLzg4uMG2cx+IKbaUwzfii1q1L/0Wc5xbNn8QzHBma0=; b=hzyT9Dox2rNDs/86IFgbuKDb16Jlq8UrqDK0aVT+7r44dQ0bjCLRG5pDdaXnjROOZT kL/H25iZd4vk4zHodQhII8uQWKomO/j3ibYlRr1kDnFLw1lF+stzSfY3VNE63nm2qAHv yNr1AxQAc9lDocxle7fZ6ivZ+bNOUQsojkyl2s67WDo4Ew/wx0otzdIVYEy1JvJPqTpz PREp++uHnP2bYg5bRC1CarbbcpJacLw7Wgf3cBrdsljSWkTNpunt6Bc37kSN/yu+nIr+ +xXhEnX16rcuy8rpc/HYVqSR6ncb7CbdbOiZj3Pv2bg/Oxh6LBzwPWRiTEYnVhavJptG Pchw== X-Gm-Message-State: AOJu0Yw2QCSJoiBAXZka+7BJzsvlICd9CTUtk9r3JnQcJ1MsMIHC/VIA yifvJQhvSeI8FkHozMibtXu04X6hVIMQtka1BlbsXhV64MVGJa0f8HaKu0evSNp48yl4lwW3fd8 1qBj5lQ== X-Received: by 2002:a05:6512:3b98:b0:539:9ee4:baab with SMTP id 2adb3069b0e04-539ab87dcbfmr3297739e87.30.1728059626757; Fri, 04 Oct 2024 09:33:46 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539afec8430sm2064e87.98.2024.10.04.09.33.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:33:44 -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 12/25] target/loongarch: Use explicit little-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:28 -0300 Message-ID: <20241004163042.85922-13-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 LoongArch 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/loongarch/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/loongarch/gdbstub.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c index 3a03cf9cba9..dafa4feb75d 100644 --- a/target/loongarch/gdbstub.c +++ b/target/loongarch/gdbstub.c @@ -67,10 +67,10 @@ int loongarch_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) int length = 0; if (is_la64(env)) { - tmp = ldq_p(mem_buf); + tmp = ldq_le_p(mem_buf); read_length = 8; } else { - tmp = ldl_p(mem_buf); + tmp = ldl_le_p(mem_buf); read_length = 4; } @@ -106,13 +106,13 @@ static int loongarch_gdb_set_fpu(CPUState *cs, uint8_t *mem_buf, int n) int length = 0; if (0 <= n && n < 32) { - env->fpr[n].vreg.D(0) = ldq_p(mem_buf); + env->fpr[n].vreg.D(0) = ldq_le_p(mem_buf); length = 8; } else if (32 <= n && n < 40) { env->cf[n - 32] = ldub_p(mem_buf); length = 1; } else if (n == 40) { - env->fcsr0 = ldl_p(mem_buf); + env->fcsr0 = ldl_le_p(mem_buf); length = 4; } return length;