From patchwork Fri Oct 4 16:30:17 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: 832744 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp868731wra; Fri, 4 Oct 2024 09:32:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXCmcPVHvdu/a2h/KoMuo/euB3hcNscYPo/BXpSCvc2InroJ/PnXWJwPS2nAuI2/zoUxG1YXg==@linaro.org X-Google-Smtp-Source: AGHT+IFBeeVszXnr9vO5TfeShlBNev7wreOzTYlqG6NtqzW/MbzObm+gh0oV+k21hl6APivDdBxl X-Received: by 2002:a05:6122:318b:b0:4fc:eda5:6369 with SMTP id 71dfb90a1353d-50c8618590amr2430527e0c.3.1728059558910; Fri, 04 Oct 2024 09:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059558; cv=none; d=google.com; s=arc-20240605; b=g+cXY22u66c0k5r7ACgui/i6rABs8tJIgc8ofY9hVg6oAlITi9+EG2/MWUnCVwUAt5 bXA2I5tKC2xfUbwpXhsuVhjo7141jV3QpvB59GRaEGhPoZHsOKK/Fbzw8WQhugGAKj42 2GBi1VmzPo4SCUKSyMcX2mW0wBhRN8pE4QSdljCmGO3LaWTTJLOp5JOLHfEhEZLvEtA+ YBhUg3YoPEg2wKMj1lLU1tYk/7DbXVLd8WUmfw4tlR8eVrQ4l5WJie1mo97982HeJNKH 2nuLqp+xEFmuWP5lZm2YnNBYnRt7pvjuKZjjRU8VrTuwtOPRfVnrFdnS367ca1mj9nN3 LgYg== 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=HIUgZUCWAt295BVKONLExnXwYaPBthL2sBqrxui45VA=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=RHoKSyW3k9+MQbcWKrUovGx1G7ceofbXeW+ibKzz761d/oD93nCdOP1UN7gP0N3NFI iQaglDju8vDbmZK3cOq08Bn71mKFwPUFhC5eNP8/lS8yoCxJyErEJBmxYvkadWYE0pYa SEvtoN+RpUNdQLQsiIQDIhsjMih4f2z2Ckx1eA6pO9VA1CeOFKdrcI9ftJKZl6vd94Lu blVoGsIBspGe6/O9Jjx9LmjfElLELKlJttn9ApUAapKODJoTapR2kJAscmpfOgVPboCh MIvuAMpd9HV7plP/zd3SzGeJqMHPMz6yKJTr4/C4xbsaPd3/6W9Vv9yj4V3bXDFHPT5u ysYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qq1/z5Ot"; 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 71dfb90a1353d-50c9ad76616si17365e0c.87.2024.10.04.09.32.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:32:38 -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="qq1/z5Ot"; 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 1swlD2-00048y-8x; Fri, 04 Oct 2024 12:31:16 -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 1swlCz-00046l-GF for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:31:15 -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 1swlCw-0005Xz-VS for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:31:13 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-53993c115cfso3064432e87.2 for ; Fri, 04 Oct 2024 09:31:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059469; x=1728664269; 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=HIUgZUCWAt295BVKONLExnXwYaPBthL2sBqrxui45VA=; b=qq1/z5OtvKGnEznaw0x37LTPR2GJqXXhuk3wPvRo1alVfjT89UjcYNvSLYX1IBHoRn GPYjH+2d4LDwE63m+ZQfsfF+ZYOaDufXfzZa8UjcdHq9VnQYS6LFRlmhrOnEfDhmd117 eZKxl4ZzEUc1O3pvycSzhFKlXrPOW7hmjgIvgsavCzMYbBtpO9bOgjzmAJuyZe8gb9tV MUhBu6rn1XdkzGlN9fclu3mR8SlbBGgUPq/fPbrVk6dvWYfKJzKeo+TskIvML2WKBgOL YoCai0yJVz3KELofV7ENyRNg78JncpVb3g4EL5M7rY0mtXkp4bu3C9Q86YFJjqOaVf9X yq1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059469; x=1728664269; 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=HIUgZUCWAt295BVKONLExnXwYaPBthL2sBqrxui45VA=; b=smOx3wLPVDX1ZPGADeHl92fnt0ehmh8LXYTAJZAOOwqMvBYNPmhXgA+yTjLrBgM/kO UXJvjq4m07GGIv0PHpMLMvqI4SA/DdFTixXQFmhYHgKuV8PuC/54YmPXCjxYZiufjKzm 01TjbVc1zQXQtEBqZAV8OexsG9bqbqzgH33MzXqveTz3Xd3Htj+Y1wH7SNP3rGhvyaGC y3fWEwWJm8nRx/29qCltPifjJdj+3wOjQEtXi687kl3kBGSF//2ECPJWlC7lbglgJ1pc sj8SYrvir4H4pDSnfgiIIRguhMjrykUcATVg5UapHNxHovzqTTR77wIiguL5+8UjRPRP QTPw== X-Gm-Message-State: AOJu0YwKDaiQ+59dU/kyfkkJCVuh/UsOZBimbY5DLdrurpY7Fv5psagS uE/cZRiLKfeKehOmSt54kP24HUj5xrCZ3ONmiGdG3ohk+btSbBiUkJ3OFc00dgJ1AB26t0ePMSR pxO7N4A== X-Received: by 2002:a05:6512:31cc:b0:539:a3cd:97cb with SMTP id 2adb3069b0e04-539ab9de441mr2264190e87.43.1728059468759; Fri, 04 Oct 2024 09:31:08 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539afec1157sm1716e87.3.2024.10.04.09.31.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:31:08 -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 01/25] gdbstub/helpers: Have ldtul_p() definition use ldn_p() Date: Fri, 4 Oct 2024 13:30:17 -0300 Message-ID: <20241004163042.85922-2-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 Use ldn_p(TARGET_LONG_SIZE) instead of ldl_p() / ldq_p(). Signed-off-by: Philippe Mathieu-Daudé --- include/gdbstub/helpers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h index 26140ef1ac0..fd83e366a51 100644 --- a/include/gdbstub/helpers.h +++ b/include/gdbstub/helpers.h @@ -94,10 +94,10 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len) #if TARGET_LONG_BITS == 64 #define gdb_get_regl(buf, val) gdb_get_reg64(buf, val) -#define ldtul_p(addr) ldq_p(addr) #else #define gdb_get_regl(buf, val) gdb_get_reg32(buf, val) -#define ldtul_p(addr) ldl_p(addr) #endif +#define ldtul_p(addr) ldn_p(addr, TARGET_LONG_SIZE) + #endif /* _GDBSTUB_HELPERS_H_ */ From patchwork Fri Oct 4 16:30:18 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: 832741 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp868472wra; Fri, 4 Oct 2024 09:32:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVqiEIzBL3eoovPm8dPZOKJoTQwvuqqccfODJNoDbd5srP1uPKLmjv6h8DpUV6C6mxzNCEE0g==@linaro.org X-Google-Smtp-Source: AGHT+IGgr5ddicdiUBMsMLIN56tlWhcNsrqKfPGWnd4jwnkXwKolX4zmmIGFtQ1FK9B7ywPBgEv4 X-Received: by 2002:a05:6902:72d:b0:e22:5ede:3f29 with SMTP id 3f1490d57ef6-e28936c7b32mr2422227276.2.1728059533082; Fri, 04 Oct 2024 09:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059533; cv=none; d=google.com; s=arc-20240605; b=d9EkBTWRal4x+x8jc09buod/FzydxFFMSGjHwASVLb8AjlngJ0er6bAZKiZiNR/NhN BA9L70A5YLu+lf0FBdD6w/6dW9LmRh13tZkHsvZCfkVgO8ylYgPb+mYn98JZT4cnIePt UBEhduh/T8+xBJ+YnBfCHLiEFjO+hbwDUZZoa1Sldm1khdKVSVleBJish7ycA9vuuZck G4IOLH6m1aXrkK8tDEdP1dtv9O3p5NbBLjbNrMDMIXXda0LM18wP2W3xJ7mtKNEPs0fw FqlFqUTmOzW/rAGjhXJtra3G1mBcH3EPzFLqphy4NpRB07f9KyCEVnNyYixLTycj1d/0 lvDw== 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=oAoM1TIG4dq1VUGRtKg0GSKBpc95w16YyE/RovaDYeo=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=UyHLXlPgCsWKl70Q2zpT0VWwDYjnA9lwxcBVVm3n9+b53WtnGQ6K94dJRP6GA4yhuo jy6vi4obO15i3/VTHRPliPH1x/nl4QT0be+b50GfcSUdHE3MlgbTU7XPCWYojd0RF6CF jHqDzt4lZyFnL78xPKGPkSd1kjPk8Dxex4QScgUXuTrStFJh0nzVeo4Bpy1ac3Dxanse 3/+ddq9GQNPXSOKITWUrTG8i/faIMv+bgUf6yMGv3vYmkZq6TOHCOCkuQbyslgfdsTLp fFNi10dynIhFpMgPTnoX9RpI7DJDQ7J1UWt1IfDz2bi01YoLTWyM51N8qwc0ouW/jbXK pmAQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=czLUMgmZ; 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 6a1803df08f44-6cba475a7dbsi1474276d6.258.2024.10.04.09.32.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:32:13 -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=czLUMgmZ; 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 1swlDJ-0004Fb-3d; Fri, 04 Oct 2024 12:31:35 -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 1swlDD-0004CT-AS for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:31:28 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlDA-0005ZR-La for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:31:27 -0400 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-539908f238fso2742510e87.2 for ; Fri, 04 Oct 2024 09:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059483; x=1728664283; 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=oAoM1TIG4dq1VUGRtKg0GSKBpc95w16YyE/RovaDYeo=; b=czLUMgmZg/WkeTEEMbGyhaKZYmhPUsGqIccstZ9kB0xk5mcfGu0povwpqMqZNC/8pa PQDvP2CiiYVdPCDJmX6xjCiKCpiy7fyqXaNot1yELmXR/sX5xv5vFQWrZ1UKZkG/Tt6K gPBqIRal3rAXeq0DhSRlMnlGRvNeVYBBhExcjtbJr0sLwhoJDOfZ5Fk7AxI1V23AgZJc O5+VtNs6yQqV+LFvdkmmZwEYRFE9/+Hhu8MbR+8Dmb8XO1zkDy9yo4vlgbV9UXJQyPXZ InxsWje2AmrttMi2mb5jgDJ+D6nzApmg0zjKS14RzCi3n4eWN5tIRyskAhvou/pRSlg2 cYKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059483; x=1728664283; 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=oAoM1TIG4dq1VUGRtKg0GSKBpc95w16YyE/RovaDYeo=; b=GJ+H76jbs/OxLqaRWEwxgevvDGeNvikDsNqLUafHeXaBo+mdM9GcSm20fhKek1EKsL AQkI6pXOYvmV+zgdte5HM7BkbjsV+O7gQ7wSf6Ob5+uHTNVoEY4+59X2XrjSrN63/KUa fGzNA8X8hFGBlK6ZFaFnbDx75OLoST1Q1KZ8l0LQSb8PDHiK9r4JPjTWPp02ZiDQPZBK NHRdM07iwbPe5sfSFPXCSVShCAvoFUMd1iUGRBm8FN25tbwtXHAdmIX3n7Kt9w/fIIAU uA2CMD8VgNg7068LlgzlPH5bVwY5NVa9cJDliLUMcaqP/YZbYtyD++jcLxflUcV7XIwe M9fA== X-Gm-Message-State: AOJu0Yw0yTy52N00BucUXQ1PLvkHs2JdUwluzu1MCjqztG9jTVt3Us+J TPMPH0hEh0fvldp+Nk3W3S5u8p4YHfeQy+3lPOfHHaUJinUgSnONRWG6QEN0E+GidHrudPmoB6t Wo8svpQ== X-Received: by 2002:a05:6512:4007:b0:530:d088:233f with SMTP id 2adb3069b0e04-539ab9eadeamr2111073e87.40.1728059482649; Fri, 04 Oct 2024 09:31:22 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539aff23456sm408e87.228.2024.10.04.09.31.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:31:22 -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 02/25] target/hexagon: Replace ldtul_p() -> ldl_p() Date: Fri, 4 Oct 2024 13:30:18 -0300 Message-ID: <20241004163042.85922-3-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::129; envelope-from=philmd@linaro.org; helo=mail-lf1-x129.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 Hexagon target is only built for 64-bit. Using ldtul_p() is pointless, replace by ldl_p(). Mechanical change doing: $ sed -i -e 's/ldtul_p/ldl_p/' \ $(git grep -wl ldtul_p target/hexagon/) Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/hexagon/gdbstub.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c index 94e1db8ef8d..557b3029785 100644 --- a/target/hexagon/gdbstub.c +++ b/target/hexagon/gdbstub.c @@ -52,7 +52,7 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) CPUHexagonState *env = cpu_env(cs); if (n == HEX_REG_P3_0_ALIASED) { - uint32_t p3_0 = ldtul_p(mem_buf); + uint32_t p3_0 = ldl_p(mem_buf); for (int i = 0; i < NUM_PREGS; i++) { env->pred[i] = extract32(p3_0, i * 8, 8); } @@ -60,14 +60,14 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) } if (n < TOTAL_PER_THREAD_REGS) { - env->gpr[n] = ldtul_p(mem_buf); + env->gpr[n] = ldl_p(mem_buf); return sizeof(target_ulong); } n -= TOTAL_PER_THREAD_REGS; if (n < NUM_PREGS) { - env->pred[n] = ldtul_p(mem_buf) & 0xff; + env->pred[n] = ldl_p(mem_buf) & 0xff; return sizeof(uint8_t); } @@ -117,7 +117,7 @@ static int gdb_put_vreg(CPUHexagonState *env, uint8_t *mem_buf, int n) { int i; for (i = 0; i < ARRAY_SIZE(env->VRegs[n].uw); i++) { - env->VRegs[n].uw[i] = ldtul_p(mem_buf); + env->VRegs[n].uw[i] = ldl_p(mem_buf); mem_buf += 4; } return MAX_VEC_SIZE_BYTES; @@ -127,7 +127,7 @@ static int gdb_put_qreg(CPUHexagonState *env, uint8_t *mem_buf, int n) { int i; for (i = 0; i < ARRAY_SIZE(env->QRegs[n].uw); i++) { - env->QRegs[n].uw[i] = ldtul_p(mem_buf); + env->QRegs[n].uw[i] = ldl_p(mem_buf); mem_buf += 4; } return MAX_VEC_SIZE_BYTES / 8; From patchwork Fri Oct 4 16:30:19 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: 832742 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp868515wra; Fri, 4 Oct 2024 09:32:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUcrcc7uEiMHfUjFsJL6LWjmj0AG+MIKZdZxYOFPEcFR32z/VXTHxIVjGYG4qxeJOtcghLRrg==@linaro.org X-Google-Smtp-Source: AGHT+IH521KqwbqRiAvdO/p2Diw/DmaYOWquvC7PUvfKEQEhEd9tw9OT66+cNSOXZLGgj653rGhN X-Received: by 2002:a05:6214:2f13:b0:6cb:52b3:c112 with SMTP id 6a1803df08f44-6cb9a33090dmr46682586d6.11.1728059535911; Fri, 04 Oct 2024 09:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059535; cv=none; d=google.com; s=arc-20240605; b=iG2eDjuVZUrouTnEuWaI4u/x0/4qXkqgrNRRwW16oA9PVhvWe5aq2dvUOIHdAf3fsQ hfPmnzCjd1/DzwalBxh86eI61BvO33KiFE/r9E5WYnttnCdByVY7nZhN3qbcq75pkn1I W+oAw3j6ytAUmqIUc6CyQkxtHa5eManb/+7JUxXpWw8KQX/MYVx3gTvY8BmJejymWbkN 81OPAtPkOyZ/hQ2HBh1scf6nfASoO3j8wbSgW16TO6zg2K0PvovZHTWpOCeHJxk/6W/U uajJMogyXHw0MgJspW+/ueJPrVKXpPKlzndzlB0L24TRydu8Eqm+9MFIVvA6AjHqa8Vl 3q5g== 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=srr/+wHoyELt07jjPH89qrlEvr/MIKBSh1HnIzun2fE=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=b3aBF5qfjJxykjSx6NLUCTtXgfbW1ZgntM+lju239E+tIxtHrRGmccxaywBIg7Uq8U kz0lk6fRw3Pc059NGeTLMDNSHIsN+rwCv19bYhQ+EQnATAI56NTjAdy1aKv62mQyWOia 7f3VYOMkSntqfAtL7tVk1xOD1TH97SkX5+QkoksZFXfNWEk0h47taDh3IAumBKkGxCLN 6NpAK+xdMqQb+PiwW7I1ELGlzlBbnowR8xGj5tNPXMG5K02EissOhRfq0Y0DnmIQNuIq 5vKcxtPAufrGW+BN+UJnrerTYvIUvPY8ERpwsg2CCzobRxad7S56W/W/eFVoAWnj5VE7 3kSQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XfIB3/HO"; 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 6a1803df08f44-6cba46d771bsi1563706d6.61.2024.10.04.09.32.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:32:15 -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="XfIB3/HO"; 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 1swlDU-0004OC-Q3; Fri, 04 Oct 2024 12:31:44 -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 1swlDS-0004LT-Sh for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:31:43 -0400 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlDQ-0005ah-N5 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:31:42 -0400 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-53997328633so3374293e87.3 for ; Fri, 04 Oct 2024 09:31:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059498; x=1728664298; 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=srr/+wHoyELt07jjPH89qrlEvr/MIKBSh1HnIzun2fE=; b=XfIB3/HOKogcZq/TTpn2mwWX7F3m1ILil+ggf0zuHBOhtsbB58weTeg2+BCeA4CpDI v4IqQ1JwEjcz8AZn9F7p9N9MsdFLxsoYl03jpmK4l8NKrlvVlZTlw29/bS1elNxS7xt+ lKMQpVt4UkBVN0NNEsutz8heacF41JMu1jO80rNp8i9vtsfwsi4Ui1JDQws/VD+qpROZ KdvFHRbR6VC6bZLjv4QmulQqNwQp319QMYZ8p94FLg3uEelK9mykpwM21c80ui7oB2FH GPWPbld4zDy+DZjF32ua90RYZJCTf6biCdu1uuzzIi56O0iqD8cEHkYSqPrZTminKBeF 00SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059498; x=1728664298; 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=srr/+wHoyELt07jjPH89qrlEvr/MIKBSh1HnIzun2fE=; b=MaXfuEoPzgwbgbdrxKxV6vLRLURv+8u1UH+VOXoAYFO4mLSuChUttM14vif6kRuxHn vrEEcJkVf1y/pfZgXDGhsB/PM+kTKzFAIeO2qM20SRFxkD4TgOpl3RvUlSTyCWy+k+i5 4aaDEgpZirRtFlVEW2xlPT9yhmUC6yOuXvb1eZOBthJL4Ql/GNBA8SsKPqntBuIMhlpU hrP+SRN8QqOWXR+lydAQgTNY7bjGig6ezVEMO0jrSLd+8NzNmuw9BkBTPJp9/SkPyetm Vm1iVmcKhg5JymdQAaoENBZ7KCv32M2AgNEUjStAiMCXdOGYkGitHdGkfKy4pFHC7KfR siTQ== X-Gm-Message-State: AOJu0Yx8CnJDa1zdfnrRYPdTTulM5/+rK+qInEwrguD/jUOYGAPpagde vp6kGHxGAzAzKMl0fM51/iDlapOvVmiqaqxWZDRmsGpadO59F75Vv9vQxPpjipLjo/8ou/di5h3 uoFRzlg== X-Received: by 2002:a05:6512:e93:b0:539:947e:18a6 with SMTP id 2adb3069b0e04-539ab9cf223mr3337059e87.47.1728059498371; Fri, 04 Oct 2024 09:31:38 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539afec1034sm1885e87.13.2024.10.04.09.31.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:31:36 -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 03/25] target/alpha: Replace ldtul_p() -> ldq_p() Date: Fri, 4 Oct 2024 13:30:19 -0300 Message-ID: <20241004163042.85922-4-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::135; envelope-from=philmd@linaro.org; helo=mail-lf1-x135.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 Alpha target is only built for 64-bit. Using ldtul_p() is pointless, replace by ldq_p(). Mechanical change doing: $ sed -i -e 's/ldtul_p/ldq_p/' $(git grep -wl ldtul_p target/alpha/) Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/alpha/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/alpha/gdbstub.c b/target/alpha/gdbstub.c index 13694fd321e..bf5091c2a6e 100644 --- a/target/alpha/gdbstub.c +++ b/target/alpha/gdbstub.c @@ -59,7 +59,7 @@ int alpha_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) int alpha_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { CPUAlphaState *env = cpu_env(cs); - target_ulong tmp = ldtul_p(mem_buf); + target_ulong tmp = ldq_p(mem_buf); CPU_DoubleU d; switch (n) { From patchwork Fri Oct 4 16:30:20 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: 832747 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp869298wra; Fri, 4 Oct 2024 09:33:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU1A5+zsa+v/QoXR0eYAi/Yb3TnNmBc6MFNleEsbRfIBXe5faA+e78XE/j4a8sCMzxEUFiAeg==@linaro.org X-Google-Smtp-Source: AGHT+IF/GlWT2UC1ttGgFaIbFqJZfpG8SXnKsPGi489HtRqsS7Gx71okccn9LFuWdLnpb7ikmJJh X-Received: by 2002:a05:6102:dcd:b0:49c:92d:1041 with SMTP id ada2fe7eead31-4a4057848e5mr2399383137.14.1728059620997; Fri, 04 Oct 2024 09:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059620; cv=none; d=google.com; s=arc-20240605; b=j4YZC1c6TyVkkpmGtpZI56X/aq5cbY5cV3nj07Zg2XlMXOTupk6miPmUYl6//9Sa6x E+7lmU6jxtw6ckRkgBRH1UA8YGCXDy9sVg96uJ+/XEXRLkrA4zNoY6EktYrGk4at5hKD +BmZGC2qXS6ATo2HCzvyongy9EjLpQOpi8JpziPcWPQD0wyU5O9iTf37I5sAMwrsWNnH ImT/VgtT95QPj7w0vZSrP6puY5rMaZtfh2xqpCke7nCir9nVkN7njrQt0o96QFkGAWqO nS8XnDEinNhykt7cNFMKGF3DTh0n2g7WgK4MJ5gfbktEQFa6m8uIDgyXLQs5LI6kbd9b uQ4Q== 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=Ah2mpPOVGVx2cY8doZ+1TV8yPkrfA9ibyFMVLGjjZzw=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=FeoZKRVUu0hVPP8PZGfcz/6Y4m3lNSvXhqqCiLLfDxrMOIJER8QdenooOVBZPfBBkH 4cf7L3ZJwnxmKW/rMlFlBIlQCYbbCznuGjX9akMEMyaOkAWP91DHPBUIdD3TygowuBJf quX0aza5yjLyJJQthEqp4e/ac9PSDFcFv3b3B0So81fYsjCNuoQla/VBkvFnNr3Yckfb pRSIfuBmGGLU59/REgULGsWNZkZGYZ3a1fqgQlDn5INO7uGOAWW7OM/3fP6KTaDkhno4 h0Bc0YFjH7XMv7jdCFqDpKrHVvzNI9PNo3+WvaSMdD95tIAwnJVH36wwbuvlqCMUQCAY J8zA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v5TLkMKG; 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 ada2fe7eead31-4a412e8fe39si43500137.305.2024.10.04.09.33.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:33:40 -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=v5TLkMKG; 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 1swlDi-0004jN-Af; Fri, 04 Oct 2024 12:31:58 -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 1swlDh-0004ij-BK for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:31:57 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlDe-0005ej-Hm for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:31:56 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2fac47f0b1aso29892941fa.1 for ; Fri, 04 Oct 2024 09:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059512; x=1728664312; 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=Ah2mpPOVGVx2cY8doZ+1TV8yPkrfA9ibyFMVLGjjZzw=; b=v5TLkMKGGU3jeDF43StLz8TirJz0aBZKBok9P9hgKt3RubmDjJhFiCyfe5HHUDSXx9 H6S91S95yjS6H6JWc0VzH4k3UU1KdUyl0tqrZ+UoexJ/zDRx5Uxv82Rshe8o17CR6k/d Mh33ZCPJP6QU56TE2F5+o+Ci9HaQ793HxQ4P22zSNi6ZLpEK2UOEZSNO8YEpH2Go+b2V xHa4bv/3hQea4uWsE7jSVSEOaW3P89CfBpxuYcQWLp869MF0oVsoIm5LhSz4jWrUb9t7 TnwbM6PPMbZ4CCrIScPwjAFUJYp525J9TvrUhrqOZzg8zZCQf4Sjnmd6tw59Fel21UKs YrJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059512; x=1728664312; 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=Ah2mpPOVGVx2cY8doZ+1TV8yPkrfA9ibyFMVLGjjZzw=; b=KRwlDHi/1fM+KzS1Y0sQndpsOih3Yu8SjkkXa2FpvGPq8vDqMfnRCqtXYSbPekOAfX Mivd55gLH77hNVR3NcSVYcVqYaUJi1ALFBW5vsXoiXwkBRtzhk+MT5iIeczHhEGcW1s6 66ujUSFe9oRkIAFUVVCxyIr33PtrsIkoz8NAVJmxYaogPxvyWaxidIO+Fv8cpOXo2foK JUWSyy8kLsKLN1oAu2yO3TwP+zMgHjml2E9vNPQAH50VtcVQwW9gUSfhJEFndUwtBkMv PYoGNWguplZj1VhE2l3FmjxxLj4dODOcVoRDXth6qjbz8M06fq/iNLAsKRQLCBUTGJMU Ypgg== X-Gm-Message-State: AOJu0YysdSvivKW5SE88FfmzCNNMO1YQuopbA7CdbjfJ6pta3NJyMsmE MmcldFX1tQt6F9lLqXUWlVxZ97YYjTiTzNDfAZqVTNgTiyYacGT8N5JH1lmtujLrYIQwLwXogEt 6Y9Gt8A== X-Received: by 2002:a05:651c:154a:b0:2ef:2cdb:5053 with SMTP id 38308e7fff4ca-2faf3d8a8e9mr14915461fa.37.1728059512245; Fri, 04 Oct 2024 09:31:52 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9b3a945sm197011fa.127.2024.10.04.09.31.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:31:50 -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 04/25] target/s390x: Replace ldtul_p() -> ldq_p() Date: Fri, 4 Oct 2024 13:30:20 -0300 Message-ID: <20241004163042.85922-5-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::22d; envelope-from=philmd@linaro.org; helo=mail-lj1-x22d.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 S390X target is only built for 64-bit. Using ldtul_p() is pointless, replace by ldq_p(). Mechanical change doing: $ sed -i -e 's/ldtul_p/ldq_p/' $(git grep -wl ldtul_p target/s390x/) Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/s390x/gdbstub.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c index a9f4eb92adf..9ffec0bccbc 100644 --- a/target/s390x/gdbstub.c +++ b/target/s390x/gdbstub.c @@ -46,7 +46,7 @@ int s390_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { CPUS390XState *env = cpu_env(cs); - target_ulong tmpl = ldtul_p(mem_buf); + target_ulong tmpl = ldq_p(mem_buf); switch (n) { case S390_PSWM_REGNUM: @@ -126,7 +126,7 @@ static int cpu_write_fp_reg(CPUState *cs, uint8_t *mem_buf, int n) env->fpc = ldl_p(mem_buf); return 4; case S390_F0_REGNUM ... S390_F15_REGNUM: - *get_freg(env, n - S390_F0_REGNUM) = ldtul_p(mem_buf); + *get_freg(env, n - S390_F0_REGNUM) = ldq_p(mem_buf); return 8; default: return 0; @@ -167,11 +167,11 @@ static int cpu_write_vreg(CPUState *cs, uint8_t *mem_buf, int n) switch (n) { case S390_V0L_REGNUM ... S390_V15L_REGNUM: - env->vregs[n][1] = ldtul_p(mem_buf + 8); + env->vregs[n][1] = ldq_p(mem_buf + 8); return 8; case S390_V16_REGNUM ... S390_V31_REGNUM: - env->vregs[n][0] = ldtul_p(mem_buf); - env->vregs[n][1] = ldtul_p(mem_buf + 8); + env->vregs[n][0] = ldq_p(mem_buf); + env->vregs[n][1] = ldq_p(mem_buf + 8); return 16; default: return 0; @@ -203,7 +203,7 @@ static int cpu_write_c_reg(CPUState *cs, uint8_t *mem_buf, int n) switch (n) { case S390_C0_REGNUM ... S390_C15_REGNUM: - env->cregs[n] = ldtul_p(mem_buf); + env->cregs[n] = ldq_p(mem_buf); if (tcg_enabled()) { tlb_flush(env_cpu(env)); } @@ -246,19 +246,19 @@ static int cpu_write_virt_reg(CPUState *cs, uint8_t *mem_buf, int n) switch (n) { case S390_VIRT_CKC_REGNUM: - env->ckc = ldtul_p(mem_buf); + env->ckc = ldq_p(mem_buf); cpu_synchronize_post_init(cs); return 8; case S390_VIRT_CPUTM_REGNUM: - env->cputm = ldtul_p(mem_buf); + env->cputm = ldq_p(mem_buf); cpu_synchronize_post_init(cs); return 8; case S390_VIRT_BEA_REGNUM: - env->gbea = ldtul_p(mem_buf); + env->gbea = ldq_p(mem_buf); cpu_synchronize_post_init(cs); return 8; case S390_VIRT_PREFIX_REGNUM: - env->psa = ldtul_p(mem_buf); + env->psa = ldq_p(mem_buf); cpu_synchronize_post_init(cs); return 8; default: @@ -298,19 +298,19 @@ static int cpu_write_virt_kvm_reg(CPUState *cs, uint8_t *mem_buf, int n) switch (n) { case S390_VIRT_KVM_PP_REGNUM: - env->pp = ldtul_p(mem_buf); + env->pp = ldq_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 8; case S390_VIRT_KVM_PFT_REGNUM: - env->pfault_token = ldtul_p(mem_buf); + env->pfault_token = ldq_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 8; case S390_VIRT_KVM_PFS_REGNUM: - env->pfault_select = ldtul_p(mem_buf); + env->pfault_select = ldq_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 8; case S390_VIRT_KVM_PFC_REGNUM: - env->pfault_compare = ldtul_p(mem_buf); + env->pfault_compare = ldq_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 8; default: @@ -338,7 +338,7 @@ static int cpu_write_gs_reg(CPUState *cs, uint8_t *mem_buf, int n) S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; - env->gscb[n] = ldtul_p(mem_buf); + env->gscb[n] = ldq_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 8; } From patchwork Fri Oct 4 16:30:21 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: 832745 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp869041wra; Fri, 4 Oct 2024 09:33:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWdFBFZhAqpJn0J/pkxnRY3dJUDbDy3cdIoOsH/P6UNmTEwa2+SLzx5fB+dqMpeiezZXsPDxg==@linaro.org X-Google-Smtp-Source: AGHT+IFayoX8ZEZ/6k7e3p2yd/Jgr3kbGA20MRiOdkhmAFFhHPOUeyfIP5XW0Nu+/aFUiNerBBkb X-Received: by 2002:a05:6122:1823:b0:508:cb2f:836c with SMTP id 71dfb90a1353d-50c8557d2e1mr4117153e0c.10.1728059592341; Fri, 04 Oct 2024 09:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059592; cv=none; d=google.com; s=arc-20240605; b=lhUWDvyogWcsrcufqrDsglf23yRoifz6N3x8v7hGnSv6pe6sfjKkzozYltdTwlvouf qIGjtQ1s+cU0LBD8IlWDF7I7KuytyEACcRoiOPHg0xzYQfXlDvCeJiJ69ZQsQlVuYoXq rMGLCodP7RzlzQV2OG0Lq6pJz0h1nE0naLduF7xY3FkZXoTDJxu5DjRr6WtmUbZ4LtPc Jm4XT6e0j+Yw1ajSLFNnuAQWPncJ4z5iH54iPeU3sHDY1T/hpfJ8J1pIunh9XOvQ8lUP w8Bu0rcPjqx1cQQ7tNAb5fB3m5oDAqMqbfipK6+56ZcjtnuOImqLo395i283xbQ1LOwj geLg== 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=fKHjWYe4hWo3y6AeSVqqoaCH56JRUztKe8mH70Hqsj0=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=aQe0gE1M+5mAqkFBL3D3f7R876hM/FziZXMOG0kI11tVTdoV7hIzJjBjvCh8jzEO02 1iHWtE9PG0wNhA/xAIEzYBe9UAV2diOUdXs+6hLY85YPeybbd2q0NIG4AWJwu/cQgsWB mMruL5wKqU4xQ4hwlQr6mlS8T1/uGHdkdHXBG5SfggVPcf4fMbF6cDXDNstj7Me57bzO sXfpigudSyFFrA56I6eYFYkedH2Q2nndgPITeTswE3Yv1YpZPhU5S2Xv5IDWx7o9d5/n 7HbK4zzPeY4GwDv2SV33J6ByRDvyIThfe6WFmn8cXPDvFmEI/t4spISgy7hejOVX6s4J umOg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="i2/RIa90"; 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 71dfb90a1353d-50c9aecd876si8135e0c.266.2024.10.04.09.33.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:33:12 -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="i2/RIa90"; 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 1swlE2-0005Rw-Mf; Fri, 04 Oct 2024 12:32:20 -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 1swlDu-0005EP-63 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:32:10 -0400 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlDs-0005hP-JS for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:32:09 -0400 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2fadb636abaso25047121fa.3 for ; Fri, 04 Oct 2024 09:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059526; x=1728664326; 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=fKHjWYe4hWo3y6AeSVqqoaCH56JRUztKe8mH70Hqsj0=; b=i2/RIa90UJ5HcmJkX0mtWXoQsdZZq+tyvEEbeoQeXftOnapYbGJYFrXrBfgzGUdNqF V2w4YALqvYtZYMj2r0UdiRepdbFK/BBZMJ+x5ODzo/A7bnd3+o4GxdijTSvw+LbgANoy yF1shnSDd1VnqJTTeBFfLANaBjoFcImBiM7ZwWEUNBGenvw7Lhod4XeTT8bZ6+cBYimU 0FKqy2QBdiJJQNXx6VPAH8kiR36dxWCF+Hp9yJg3JWML+PMa8zmrkCnXvPzVuXt/ocBQ jtHtuUtUNnyYU3t41JOrYVWwni8bPuQDrwcxpeyvLtKm1WiZOP25ckxXDJfJdVxnuxcr Jm8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059526; x=1728664326; 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=fKHjWYe4hWo3y6AeSVqqoaCH56JRUztKe8mH70Hqsj0=; b=ngM2DSAUI1D8kM4TNVc3RHOdRcZ2j9ILjN45pdjb9+gSVgnE42ARvmJOtvATXrqfzM +rBIgw5tiZfB5xqXzTJoXDD/3CIcnzVZWeks9wvU6cGJn+dYpf9G+V0n+lE4ohHieFQS u5MweWmwfj9XKctU0bUFpczdqYSwK1o9uWm2RRo4rtGmWqqYKwdMi33HuAu4J+2zrVva rpW8K9Rea9GSYUKFbmD+1uOTFQeEloybayEVI9F4No6bYzfXt+hKkN8mTXzwmOZ2jhtp zI86IxLRfi4u26lRDWncEPISMtngidEQCuIjUL2Pllps4PKjXaSAYYWNLSeZzP+VH+kM XNOg== X-Gm-Message-State: AOJu0YyTXlbJ0HOhtMKf0/HBUU7hIGhPRjY5j90MHrUorBMZtGD2Ibee 1I+LN/n60ZVoGQwI7x+vw+uoahiPb4Zar3EGrKkbfhKmpe8iMvGa8CxbtyhBvaiSrk+xyYmArw1 eh5Uqsw== X-Received: by 2002:a05:6512:b90:b0:539:936c:983e with SMTP id 2adb3069b0e04-539ab9ed416mr2061219e87.53.1728059526340; Fri, 04 Oct 2024 09:32:06 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539aff2838esm425e87.270.2024.10.04.09.32.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:32:04 -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 05/25] gdbstub/helpers: Introduce ldtul_$endian_p() helpers Date: Fri, 4 Oct 2024 13:30:21 -0300 Message-ID: <20241004163042.85922-6-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::229; envelope-from=philmd@linaro.org; helo=mail-lj1-x229.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 Introduce ldtul_le_p() and ldtul_be_p() to use directly in place of ldtul_p() when a target endianness is fixed. Signed-off-by: Philippe Mathieu-Daudé --- include/gdbstub/helpers.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h index fd83e366a51..e783d166865 100644 --- a/include/gdbstub/helpers.h +++ b/include/gdbstub/helpers.h @@ -99,5 +99,7 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len) #endif #define ldtul_p(addr) ldn_p(addr, TARGET_LONG_SIZE) +#define ldtul_le_p(addr) ldn_le_p(addr, TARGET_LONG_SIZE) +#define ldtul_be_p(addr) ldn_be_p(addr, TARGET_LONG_SIZE) #endif /* _GDBSTUB_HELPERS_H_ */ From patchwork Fri Oct 4 16:30:22 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: 832748 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp869482wra; Fri, 4 Oct 2024 09:34:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVpmUMlTz9NiNihumCF3KWefwFiuVtxAs2dKicTsaVw7W1xjMOI/NN8P+5qidn743l+52Q6Fw==@linaro.org X-Google-Smtp-Source: AGHT+IHHWWbet9u4wpxlP06LJaZP2QTEEVFJJAzFrqkmLe+WIvpOE9E7eoA6T7/sXU6I4FFG7Bek X-Received: by 2002:a05:6214:4611:b0:6cb:20b6:f39a with SMTP id 6a1803df08f44-6cb9a2f53e5mr43101496d6.13.1728059642144; Fri, 04 Oct 2024 09:34:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059642; cv=none; d=google.com; s=arc-20240605; b=LuNvxByeiAbzMbfubTF0HzVYQKEDRuTkT/JDSddeQZDUH0lZRfIgHHx0jv2aUmM8Kp 0sgZhadZROuV+qtY3LB1FkxtgzYuH521BlWYax6bb1kL94WAKQou2bsi8R1+YY9ulfr2 0X5UgXQ7cmncD7lfHa9qpOlYBrdtT+P3Nan5qECx+JN7nZZrTQaGlTHbk8Gmxcg6HpGz rJsHzJmqH8ubolJrU25dDrpzAPXVvmhISq5wLn4rH2saGJ/Edl6AIT5mV09LmbjqiQ6H S/NpHOyZOFrzC1A/oa0UTF/jE8wWKolPCe5YnKGOODAuE/LG74gDixFCmkrRsFgQV2Dm 69gg== 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=QzpcifQjg9M7Tjl4Y4YKKldff3x1a+0LoVxsWg9JdC4=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=N3msmh5bNUslsWVgR/kCt0oZs3Z7e6QDZni63cQ2SdGAZvEz2ER0RdVSIVepf8uSJ0 0VSpzbrxZCsOE/KAUeb0yuyAbnytLqQPaX2GUjuZZCIPZ67tUI+OmOQkdAyJB4LuwXm8 ddJ64LfoPpvZ1+HrCYO2RYHx/exXv3zn+qmZUvlDargCwjZ69BOEXEAnk/8D11FWGS2w j7V3udxhrk4CtmUU8UfKTv6mK+UGuPMkRswa+lWq59cbtmhnAPOCCn8c06e8nU2vYdwM /nT60Ft3R0N2s0/iyPsLs2runO4V6N19iHInlVYuXasfSUGAhbCfb9pyoJC97ZUYXeVw ExMQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R32ISY0a; 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 6a1803df08f44-6cba4773612si1444706d6.391.2024.10.04.09.34.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:34:02 -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=R32ISY0a; 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 1swlEM-0005uh-Bw; Fri, 04 Oct 2024 12:32:38 -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 1swlEC-0005gG-NG for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:32:34 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlE9-0005kj-W8 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:32:28 -0400 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2fac63abf63so25047911fa.1 for ; Fri, 04 Oct 2024 09:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059542; x=1728664342; 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=QzpcifQjg9M7Tjl4Y4YKKldff3x1a+0LoVxsWg9JdC4=; b=R32ISY0a9VYrEpZe/73+yuht4TWKcVQ7NYJ0QKDbfHpJy/297pFRbhFfsnUiQqfSRD zvJSqDNyZXKBY8r3bctqFslhmxxdTl9bGT86tuxrNEQv3xLf01zrCPXiuwhuYoZcfqUi bTwefUDxfRFb69kEkedgLRBkQ6SD2wq38giNCNM0mxftTDKSc6GNpTvJIw7GgEWld6mZ oJadFK2DW10/T0UH8CAAsBFsnVWmgBKUvcVVHwyt6dDNaitvqqTISDaK3ONmbwTsb/9s /Ka9ns2ZL67E00Cu9WWGlPOPO7zJezWbeK48ZY8FNjipG3WKtxPoO6ZuLK+lclL8Daw0 WdZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059542; x=1728664342; 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=QzpcifQjg9M7Tjl4Y4YKKldff3x1a+0LoVxsWg9JdC4=; b=v0WtcJmZTd/niV5nINO2K/IzJyzeYI2j2CpPKLwpiL3JoDNDoXaI0hNLiDqn3rZYXx ybZobGzrxGgMqoCPkYcIn9bWTcFYRzUhBdNy/rXrMmAlO2vO+AjVj7zEURYYTMm+Nrt4 BNAHG7SkXpg4UE+PEqkYr+KIhV8cG4ssV1RCfT1Qfl5QasQdrdTkOHJNv+i+9YxejrzR iD9Ei2UdZwLKsvsZi/d4ei0eCHWayrNXar4F+6KI6Bk0esZnh0GnzA23NjNjWdVvTknu blluSa3XrzYkXYMFgzrsA2yWYuLqwOWuHaDFos4bPsfwio1JEHKi/2204hWvD2wDFSn7 xL3w== X-Gm-Message-State: AOJu0Yw9caXwOxctpnRTxCuw6x+j3tJRgZq7D+Uu/Q7qt7geu7nZsyty 65wO350KT8bcXNAfL5DaJgDzF425XiFgPNmjZgG56bH9nAjNJJkXGJJPDC2FiWSfb71s1zfnZlk GtEming== X-Received: by 2002:a2e:a543:0:b0:2fa:d177:13e6 with SMTP id 38308e7fff4ca-2faf3c416f8mr18290571fa.21.1728059542529; Fri, 04 Oct 2024 09:32:22 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9b3374bsm195171fa.117.2024.10.04.09.32.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:32:21 -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 06/25] target/alpha: Use explicit little-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:22 -0300 Message-ID: <20241004163042.85922-7-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::22b; envelope-from=philmd@linaro.org; helo=mail-lj1-x22b.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 Alpha 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/alpha/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/alpha/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/alpha/gdbstub.c b/target/alpha/gdbstub.c index bf5091c2a6e..1a7e2dd9202 100644 --- a/target/alpha/gdbstub.c +++ b/target/alpha/gdbstub.c @@ -59,7 +59,7 @@ int alpha_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) int alpha_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { CPUAlphaState *env = cpu_env(cs); - target_ulong tmp = ldq_p(mem_buf); + target_ulong tmp = ldq_le_p(mem_buf); CPU_DoubleU d; switch (n) { From patchwork Fri Oct 4 16:30:23 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: 832746 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp869287wra; Fri, 4 Oct 2024 09:33:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWEIE+T78mpLeQlAMbllAW7peJYmDhSrAV/XBeP0Gjq0sKCxHa/6wqr+51SmuP1xkixd5qP/A==@linaro.org X-Google-Smtp-Source: AGHT+IECaLGhq7vy+PBHdd8w7UAlU3pDBzxRYFEKuMuN7En3hfWSDBXVcOnANLAr/Ky5gwfLdvQx X-Received: by 2002:a05:6102:b0d:b0:4a3:a0b1:b93 with SMTP id ada2fe7eead31-4a405764ec7mr4674351137.10.1728059619040; Fri, 04 Oct 2024 09:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059619; cv=none; d=google.com; s=arc-20240605; b=WYjCXVhVn5efS3h+LXVVbKiTYVWqUpOW7EjLVheqzWlavvCKg7REd9oO6eeqArNmUv WGbHYvCQIoZDgBa3G1zFBj91kXSGlb3wZJuh2obUffnS8UH+cHtFKe1hNs0FMb00DgwM +37vdNbNLXI08Cnf6tCU5I48+NcBIl7JnYjYLiWatFQ1A6muH68p6VJECXnyzsMecJbg hyazE4EW13J7cBJaQ0SjQP1Zt3ANGCpH4PMKqkBOIw9aj/kGz2QJEVPvEIe3F8LQFdsM EEa67kzuqyyCe8Nisfscm8Ngd+c6oL8bktIzozrvDwaYIQBfW0qBaGZDf2TJm1s8C9WQ bVYg== 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=nZpimvVQnGecchp1DSJAwynwQ1iesRuTNy8I2ClNlvc=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=H4xWosmET/KLrN4yN+nrdpVM5AAi9QVAVDfaJAJ54UKP3FTpXpHlukD28wtprdnAWE 3sjuv1Z7YPUhGYLZQA6ORy2T4g5TKtJ67Yh/sTrLaeMdp0UG39O7Scah7Ubzar1U4yGI Zhrym9jg6zOLKverzWb7234KPXSH4Z9RmhHefviA+2sgLBsHvZvJHQHz3YVC/jv4zzZP fX/Qt6xxv4rN/+LAX1Pz71OyVtYTWTlk27n1YVNK9Rzlt5RpC6iMO9IzIkgj9zJHF+JI xFbg/FQoL5/DWmJGArIh83aD8hHwXjQf7y1PlqXacDUoudppytmlZ6KPgA+pwlr/AOy+ /uHQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wr03iigy; 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 ada2fe7eead31-4a412e8f6b3si44630137.281.2024.10.04.09.33.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:33:39 -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=Wr03iigy; 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 1swlEj-0006hc-9p; Fri, 04 Oct 2024 12:33:01 -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 1swlEQ-0006GF-5n for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:32:44 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlEN-0005mV-FM for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:32:41 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2fac3f1287bso27652161fa.1 for ; Fri, 04 Oct 2024 09:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059557; x=1728664357; 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=nZpimvVQnGecchp1DSJAwynwQ1iesRuTNy8I2ClNlvc=; b=Wr03iigyfvI5hDMkTCBshimDW281wdofMt9QlGJ0rkY0WHGDSwZAXhcv/ZO66XSCW4 NrFq7vGOVDLQ1y+BjyF84sM7SN6p4tY00kEFAhmLcZ9rF0nMS4V3yE9qwiMS8Snc+aQG 3liULDInWpE5EzlI0oW9vu+lrZ/OyqLNl2ci/wafSl9dAVggVOCg0SBqw3heigfTzUXI PP+td8nZj9MdVQMh5sMgZaEUAJqk8QZLQfxxdoC9XVfiReRVLqhkZg16YBed6h4QYVPz QzupXQBwyrZRLu7y/7Vm8iZ0ETHMQusZEQGPRh4lXdqaMCSfil1icpZ6rBsZxE8Xnw1a 8K6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059557; x=1728664357; 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=nZpimvVQnGecchp1DSJAwynwQ1iesRuTNy8I2ClNlvc=; b=jplUEOR+JP69kcdfXEGFP0moSOL3L5pGx4tFABYc6wdjH6tXLSFynWCPlYhRTx3cTU OBJ7kK5wVq6liNMs7TzeJUOHmV+QCKPodlQq+8m6WcCKwt480x7M5WifKuOq8mLRH3mb 6oJJMWPkWo28Nry8Byt9FsT/AoOQvycM+lIXncs1xpse5eQXHryw/eisxpxrMq+huHrp jXAMIycY7werQ0H55is3fQInl441R/fZSxL0deQWl+L4mbBkIZI0mgkdQKpqJCh/nW15 wpKWU3BZB8bRWIjkqAmsYDI7GtqJON6sz5aJMrOHDHQNlUq2qx2K/W7UdPhHkNnTAOiH 39cA== X-Gm-Message-State: AOJu0Yw4nSEc85EVCn+kTHgXNO6ETzi+iQAJmwKLCgKZX6xnFQccCO0l XXrhH4o/e/m5kfSrrASM6ZLEn29pK/+sK99Ivx+H0FnEocxw/N2uopokHamDHPTxDFq6juSb0Op FljQP7A== X-Received: by 2002:a2e:a58a:0:b0:2f7:64b9:ff90 with SMTP id 38308e7fff4ca-2faf3c017d0mr17237501fa.9.1728059557389; Fri, 04 Oct 2024 09:32:37 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9b3ac99sm189601fa.130.2024.10.04.09.32.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:32:35 -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 07/25] target/hexagon: Use explicit little-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:23 -0300 Message-ID: <20241004163042.85922-8-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::22d; envelope-from=philmd@linaro.org; helo=mail-lj1-x22d.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 Hexagon 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/hexagon/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/hexagon/gdbstub.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c index 557b3029785..12d6b3bbcbb 100644 --- a/target/hexagon/gdbstub.c +++ b/target/hexagon/gdbstub.c @@ -52,7 +52,7 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) CPUHexagonState *env = cpu_env(cs); if (n == HEX_REG_P3_0_ALIASED) { - uint32_t p3_0 = ldl_p(mem_buf); + uint32_t p3_0 = ldl_le_p(mem_buf); for (int i = 0; i < NUM_PREGS; i++) { env->pred[i] = extract32(p3_0, i * 8, 8); } @@ -60,14 +60,14 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) } if (n < TOTAL_PER_THREAD_REGS) { - env->gpr[n] = ldl_p(mem_buf); + env->gpr[n] = ldl_le_p(mem_buf); return sizeof(target_ulong); } n -= TOTAL_PER_THREAD_REGS; if (n < NUM_PREGS) { - env->pred[n] = ldl_p(mem_buf) & 0xff; + env->pred[n] = ldl_le_p(mem_buf) & 0xff; return sizeof(uint8_t); } @@ -117,7 +117,7 @@ static int gdb_put_vreg(CPUHexagonState *env, uint8_t *mem_buf, int n) { int i; for (i = 0; i < ARRAY_SIZE(env->VRegs[n].uw); i++) { - env->VRegs[n].uw[i] = ldl_p(mem_buf); + env->VRegs[n].uw[i] = ldl_le_p(mem_buf); mem_buf += 4; } return MAX_VEC_SIZE_BYTES; @@ -127,7 +127,7 @@ static int gdb_put_qreg(CPUHexagonState *env, uint8_t *mem_buf, int n) { int i; for (i = 0; i < ARRAY_SIZE(env->QRegs[n].uw); i++) { - env->QRegs[n].uw[i] = ldl_p(mem_buf); + env->QRegs[n].uw[i] = ldl_le_p(mem_buf); mem_buf += 4; } return MAX_VEC_SIZE_BYTES / 8; From patchwork Fri Oct 4 16:30:24 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: 832752 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp869597wra; Fri, 4 Oct 2024 09:34:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUmPeiOwYbN/Cdyz7PTpu/93viVJsIfYOdDb1lJi/zKXQSvcyvQkt5Cu+/vj/kkzuakFoBMYg==@linaro.org X-Google-Smtp-Source: AGHT+IGmjjzbyANxWpReKYqUI/DbQ0LyI/zOXvFebzA6EoB6cwSx5ArD4n1qxyRxwUWOqLBO3kxB X-Received: by 2002:a05:6870:332a:b0:27d:10f5:347 with SMTP id 586e51a60fabf-287c1dade13mr2345044fac.15.1728059656670; Fri, 04 Oct 2024 09:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059656; cv=none; d=google.com; s=arc-20240605; b=Xen4WSeiXcEw9Ec8asfOByGptp2l2js7yAKAPUB0WAiGGbajci2FjBtImu+qH3FUJZ EYi7ycujxYV4NSaF3QkGgRLJA1llUYxcsuKjMlTkGbHmFdPZsMg8bkcpCqMvkki9AfTC 91oPModi4OyKaFlAczfJYYgazRP4QaD3wdbOKFssjfSjTNdsOl8MmCXqIi0QMkl12e0z BHGfliCguQeXqLVCoaVUY2Y0TD7w3qCO2IB4uNKI7uGZoQNyrDFi7jFFnKYlM2xMojOg RTzlLOC/nkd/Jh5LFYz/IQIJZhCOjRjEMzrRkzh/f3UhgPXj5vHtktx/dU/XQ+Dm3Ilz IX0A== 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=jZ9Y3dHzcheJ9MIl5G4LIQKrlHzrSEJ4E+LpPuujorA=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=b9tWTUQV3gntOVovcblNx3fJu78mZn47N/jsYvRH6sHGknstLY0ZEub+GPQaOgnW5T AgTNkcKY2HUHE2LTf2pDDIr6FI7vcu/4MJMYvMZA6Fy/8NRNzy7HYSHhdT05HDSqRVCr ljiFEX1mdVaLVw4OdZCSvSKEhLKRAgfSLKIx1U3h3jwI+YYwfjVmHISBAieEjgiKQuiy jbZAmy9ZSFe6aT5UTJnAyvrf6Gy2Xcn5YdduvmEHf1RnaR20moCkJ/mPqB8OwE2GE7PP HsqCJ3Hxu/1gBT+hqdzpqeumh2gPPXSpiwBWDtxuVi1O27JnnTjYnuPNaJh37GfUFIrA RCVQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KyU2KUAQ; 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 a1e0cc1a2514c-84f5c7c4c82si104218241.52.2024.10.04.09.34.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:34:16 -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=KyU2KUAQ; 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 1swlEo-00073R-2Y; Fri, 04 Oct 2024 12:33: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 1swlEf-0006UG-I7 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:32:57 -0400 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlEb-0005ns-Co for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:32:57 -0400 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-53997328633so3376208e87.3 for ; Fri, 04 Oct 2024 09:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059570; x=1728664370; 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=jZ9Y3dHzcheJ9MIl5G4LIQKrlHzrSEJ4E+LpPuujorA=; b=KyU2KUAQ25rGA/7hl5DZJFVaMVukNyEetIlZ46G6/Qe+gtkicCP4LbHlZxiYR2wIFS IzfX9HyhwTjC6QnC5fqIzUhN5Swb36E5jez2XTE2LGEcMjXrGKEnpYYHeNoyIlbo4vgV 3AzngzeOwPYjRx+tp8jzGTK1AICOSrX8RIb3/OHDw2GOfWgdxcwoZnDLh3Kg8m5+/kIL e+/AnFK1psOXT34vChOohtJwQuiUVXCBA6WIZ+SgsqrdTYXr9uhBpR0/nRb8MqUPdUGM a93HufKtqS/J1PI/QGGEOGVdVbQneyyR14OzlvFlLbiLFAvM6pvfZkc1DCkVGgtw+yhY Uz7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059570; x=1728664370; 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=jZ9Y3dHzcheJ9MIl5G4LIQKrlHzrSEJ4E+LpPuujorA=; b=HU6hZfCuVmCIJ4gCUZJn+gd+c+oLq+tO47pMYvKIr3pD3MTwSijnBNUQUVWydcLUea LrrGbtwFjbYS1zIV64VemJFK2Iugy3Wnkv7EGuIykCG2+GicD6Prcsyv2IsiRfaV0avY ZTEQiL9QbZ05r9VJUdMCAj9inRtr4zSTXqBbtsq0AjpPQS9f1aTGTHIdCiPgsc2lllLH BAAYEwcR2b1m0ClDlHWE6hxlriQ73UeKE4o8bxyyDi5fcul8wK4VOYvFk7Ims/jF/LHx Mj4EZxzwxafx4WY3TgWLw7Z8gYepapDImSvfH53vx0PK1xi9SDgvGoMIROdA6qB3kASB Ir3A== X-Gm-Message-State: AOJu0YyD6Eg3lkD69W2UOliXpA01gJAU5iNWNGVwbh87hwVVGnNGSM6d DaJxxpevGuPbQVciiYSDfAX1LKalg7ZtBmlSt3J3t2ldY77apN5Z5Y3XrpqCV1korH4MWWPsTml ag6PD2A== X-Received: by 2002:a05:6512:ad2:b0:539:905c:15c5 with SMTP id 2adb3069b0e04-539ab87df0fmr3562367e87.35.1728059569747; Fri, 04 Oct 2024 09:32:49 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539afec1096sm2073e87.8.2024.10.04.09.32.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:32:49 -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 08/25] hw/i386: Use explicit little-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:24 -0300 Message-ID: <20241004163042.85922-9-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::12f; envelope-from=philmd@linaro.org; helo=mail-lf1-x12f.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 x86 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' hw/i386/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/i386/multiboot.c | 36 ++++++++++++++++++------------------ hw/i386/x86-common.c | 26 +++++++++++++------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c index 3332712ab35..ba4ead5270c 100644 --- a/hw/i386/multiboot.c +++ b/hw/i386/multiboot.c @@ -133,9 +133,9 @@ static void mb_add_mod(MultibootState *s, p = (char *)s->mb_buf + s->offset_mbinfo + MB_MOD_SIZE * s->mb_mods_count; - stl_p(p + MB_MOD_START, start); - stl_p(p + MB_MOD_END, end); - stl_p(p + MB_MOD_CMDLINE, cmdline_phys); + stl_le_p(p + MB_MOD_START, start); + stl_le_p(p + MB_MOD_END, end); + stl_le_p(p + MB_MOD_CMDLINE, cmdline_phys); mb_debug("mod%02d: "HWADDR_FMT_plx" - "HWADDR_FMT_plx, s->mb_mods_count, start, end); @@ -168,9 +168,9 @@ int load_multiboot(X86MachineState *x86ms, /* Ok, let's see if it is a multiboot image. The header is 12x32bit long, so the latest entry may be 8192 - 48. */ for (i = 0; i < (8192 - 48); i += 4) { - if (ldl_p(header+i) == 0x1BADB002) { - uint32_t checksum = ldl_p(header+i+8); - flags = ldl_p(header+i+4); + if (ldl_le_p(header+i) == 0x1BADB002) { + uint32_t checksum = ldl_le_p(header+i+8); + flags = ldl_le_p(header+i+4); checksum += flags; checksum += (uint32_t)0x1BADB002; if (!checksum) { @@ -223,11 +223,11 @@ int load_multiboot(X86MachineState *x86ms, mb_kernel_size, (size_t)mh_entry_addr); } else { /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */ - uint32_t mh_header_addr = ldl_p(header+i+12); - uint32_t mh_load_end_addr = ldl_p(header+i+20); - uint32_t mh_bss_end_addr = ldl_p(header+i+24); + uint32_t mh_header_addr = ldl_le_p(header+i+12); + uint32_t mh_load_end_addr = ldl_le_p(header+i+20); + uint32_t mh_bss_end_addr = ldl_le_p(header+i+24); - mh_load_addr = ldl_p(header+i+16); + mh_load_addr = ldl_le_p(header+i+16); if (mh_header_addr < mh_load_addr) { error_report("invalid load_addr address"); exit(1); @@ -239,7 +239,7 @@ int load_multiboot(X86MachineState *x86ms, uint32_t mb_kernel_text_offset = i - (mh_header_addr - mh_load_addr); uint32_t mb_load_size = 0; - mh_entry_addr = ldl_p(header+i+28); + mh_entry_addr = ldl_le_p(header+i+28); if (mh_load_end_addr) { if (mh_load_end_addr < mh_load_addr) { @@ -364,22 +364,22 @@ int load_multiboot(X86MachineState *x86ms, /* Commandline support */ kcmdline = g_strdup_printf("%s %s", kernel_filename, kernel_cmdline); - stl_p(bootinfo + MBI_CMDLINE, mb_add_cmdline(&mbs, kcmdline)); + stl_le_p(bootinfo + MBI_CMDLINE, mb_add_cmdline(&mbs, kcmdline)); - stl_p(bootinfo + MBI_BOOTLOADER, mb_add_bootloader(&mbs, bootloader_name)); + stl_le_p(bootinfo + MBI_BOOTLOADER, mb_add_bootloader(&mbs, bootloader_name)); - stl_p(bootinfo + MBI_MODS_ADDR, mbs.mb_buf_phys + mbs.offset_mbinfo); - stl_p(bootinfo + MBI_MODS_COUNT, mbs.mb_mods_count); /* mods_count */ + stl_le_p(bootinfo + MBI_MODS_ADDR, mbs.mb_buf_phys + mbs.offset_mbinfo); + stl_le_p(bootinfo + MBI_MODS_COUNT, mbs.mb_mods_count); /* mods_count */ /* the kernel is where we want it to be now */ - stl_p(bootinfo + MBI_FLAGS, MULTIBOOT_FLAGS_MEMORY + stl_le_p(bootinfo + MBI_FLAGS, MULTIBOOT_FLAGS_MEMORY | MULTIBOOT_FLAGS_BOOT_DEVICE | MULTIBOOT_FLAGS_CMDLINE | MULTIBOOT_FLAGS_MODULES | MULTIBOOT_FLAGS_MMAP | MULTIBOOT_FLAGS_BOOTLOADER); - stl_p(bootinfo + MBI_BOOT_DEVICE, 0x8000ffff); /* XXX: use the -boot switch? */ - stl_p(bootinfo + MBI_MMAP_ADDR, ADDR_E820_MAP); + stl_le_p(bootinfo + MBI_BOOT_DEVICE, 0x8000ffff); /* XXX: use the -boot switch? */ + stl_le_p(bootinfo + MBI_MMAP_ADDR, ADDR_E820_MAP); mb_debug("multiboot: entry_addr = %#x", mh_entry_addr); mb_debug(" mb_buf_phys = "HWADDR_FMT_plx, mbs.mb_buf_phys); diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c index 992ea1f25e9..b86c38212ea 100644 --- a/hw/i386/x86-common.c +++ b/hw/i386/x86-common.c @@ -586,7 +586,7 @@ static bool load_elfboot(const char *kernel_filename, uint64_t elf_low, elf_high; int kernel_size; - if (ldl_p(header) != 0x464c457f) { + if (ldl_le_p(header) != 0x464c457f) { return false; /* no elfboot */ } @@ -669,8 +669,8 @@ void x86_load_linux(X86MachineState *x86ms, * kernel protocol version. * Please see https://www.kernel.org/doc/Documentation/x86/boot.txt */ - if (ldl_p(header + 0x202) == 0x53726448) /* Magic signature "HdrS" */ { - protocol = lduw_p(header + 0x206); + if (ldl_le_p(header + 0x202) == 0x53726448) /* Magic signature "HdrS" */ { + protocol = lduw_le_p(header + 0x206); } else { /* * This could be a multiboot kernel. If it is, let's stop treating it @@ -762,7 +762,7 @@ void x86_load_linux(X86MachineState *x86ms, /* highest address for loading the initrd */ if (protocol >= 0x20c && - lduw_p(header + 0x236) & XLF_CAN_BE_LOADED_ABOVE_4G) { + lduw_le_p(header + 0x236) & XLF_CAN_BE_LOADED_ABOVE_4G) { /* * Linux has supported initrd up to 4 GB for a very long time (2007, * long before XLF_CAN_BE_LOADED_ABOVE_4G which was added in 2013), @@ -781,7 +781,7 @@ void x86_load_linux(X86MachineState *x86ms, */ initrd_max = UINT32_MAX; } else if (protocol >= 0x203) { - initrd_max = ldl_p(header + 0x22c); + initrd_max = ldl_le_p(header + 0x22c); } else { initrd_max = 0x37ffffff; } @@ -797,10 +797,10 @@ void x86_load_linux(X86MachineState *x86ms, sev_load_ctx.cmdline_size = strlen(kernel_cmdline) + 1; if (protocol >= 0x202) { - stl_p(header + 0x228, cmdline_addr); + stl_le_p(header + 0x228, cmdline_addr); } else { - stw_p(header + 0x20, 0xA33F); - stw_p(header + 0x22, cmdline_addr - real_addr); + stw_le_p(header + 0x20, 0xA33F); + stw_le_p(header + 0x22, cmdline_addr - real_addr); } /* handle vga= parameter */ @@ -824,7 +824,7 @@ void x86_load_linux(X86MachineState *x86ms, exit(1); } } - stw_p(header + 0x1fa, video_mode); + stw_le_p(header + 0x1fa, video_mode); } /* loader type */ @@ -839,7 +839,7 @@ void x86_load_linux(X86MachineState *x86ms, /* heap */ if (protocol >= 0x201) { header[0x211] |= 0x80; /* CAN_USE_HEAP */ - stw_p(header + 0x224, cmdline_addr - real_addr - 0x200); + stw_le_p(header + 0x224, cmdline_addr - real_addr - 0x200); } /* load initrd */ @@ -879,8 +879,8 @@ void x86_load_linux(X86MachineState *x86ms, sev_load_ctx.initrd_data = initrd_data; sev_load_ctx.initrd_size = initrd_size; - stl_p(header + 0x218, initrd_addr); - stl_p(header + 0x21c, initrd_size); + stl_le_p(header + 0x218, initrd_addr); + stl_le_p(header + 0x21c, initrd_size); } /* load kernel and setup */ @@ -926,7 +926,7 @@ void x86_load_linux(X86MachineState *x86ms, kernel_size = setup_data_offset + sizeof(struct setup_data) + dtb_size; kernel = g_realloc(kernel, kernel_size); - stq_p(header + 0x250, prot_addr + setup_data_offset); + stq_le_p(header + 0x250, prot_addr + setup_data_offset); setup_data = (struct setup_data *)(kernel + setup_data_offset); setup_data->next = 0; From patchwork Fri Oct 4 16:30:25 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: 832749 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp869491wra; Fri, 4 Oct 2024 09:34:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXkX6ZHbGQJzLhD5S9kv50RnUu0DuMaLEFhZ6MR5rvUI+YOicAnpOQptIKQ5dvFlX0+SXlIyQ==@linaro.org X-Google-Smtp-Source: AGHT+IGFOY1MfbvTfqHFHS4kGh5LRPRr7ngDHUcxBoPZRMP8zT0v0Tx2PpwDdoVncg+NlqUyXLgw X-Received: by 2002:a05:620a:25c7:b0:7ac:bb36:5c5d with SMTP id af79cd13be357-7ae6f44c622mr529510585a.31.1728059643328; Fri, 04 Oct 2024 09:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059643; cv=none; d=google.com; s=arc-20240605; b=UXMl22vvGmF5II8TgJgh6fYZjtIscGadB4GaNe7okumad8cdbpGsYfObZFgJchuoJd Pb6JqmyXhiEkEwan1fKJtgj44FTZwsgwSF63bCxkrcwogm9kEtzvXLamlCJhYEFUeqTr KBWra+wdb4TmyHolvz0QcLstoPmIHYXJkxUyvujQ5jH23Dynxd55XoI3JgBbcjD7/nyk voQOVl3n3eqjFSZHHx2Zy2KC3835gcthMT9dbuX4TkTzdk9pIjTQrV81nP+01SO2V1Zs bGtEPheC9aEA24bgDcLFt8XDuHgL18XqNfer+AGKQB0V6DRtMJdfgEMtpiiYf8bmzfwF HXnA== 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=2s/tzGPg/LmnPo+rxsPQADcqJffZEpvaXgXhuXN6AeQ=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=T4iARUj57ckNCCx81NnQTkUDXdXrqSZbQQiICJdLF8kwtXZAS4+fNHsfnEVE5RBF4R tkSz14+fWSOI+Tg2dDGCbF1N3cn1ABgK2dJoHrqBU1LC21ln6GBbQh4SfyZPkkDmn6iG DUFS/TGXU4i9oL7xgXVJ5J9NAFf3SMYahveMyL2+kZnDEfNvz1CUvmRjejNyRCoifxoB F8vNMLlSs65gAEk/QsVNL5cyEC5UkG55XzfWdPOscRnYjy+J0tziD4vtP+JFk0iMKyxZ gxnq6e0E++ovF8onNN38NThhXrtcrttZeLqLGc/pKlfamqUE5Zo2Nwyg0ir4BZeVfh3K vn3Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sAI8EQpC; 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-45da75e2651si1334301cf.376.2024.10.04.09.34.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:34:03 -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=sAI8EQpC; 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 1swlFJ-0007zW-Qw; Fri, 04 Oct 2024 12:33:38 -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 1swlEq-0007HL-K9 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:33:08 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlEn-0005pQ-OY for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:33:08 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5369f1c7cb8so2581146e87.1 for ; Fri, 04 Oct 2024 09:33:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059583; x=1728664383; 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=2s/tzGPg/LmnPo+rxsPQADcqJffZEpvaXgXhuXN6AeQ=; b=sAI8EQpCYesTCsw2GsCCQcrNrdCSx9ho3tzjWRFFR+Z9PfhiJZwNYB3qZrw6eJyY+E s2tVNL7nTS6yuzxKCK5TB7BJShNnDhTU4DOs3pZbRYicp/2KYbShxGJtjWjSIs9OlP+5 oGiEidj7NwcWp5RYo5bD8mR7ECWelg1f9hRmejNg16Mpwf840eFImEdkRbQk3sVWXt9E iUM61x/1UhF28HcF8IP7qMPnkG+4gcOv4i486Zzgh3ZZV0vw93mk5N+0mSXxxdSgAvDs FEUOTltjwd9dBo/H1M/nkwi8gd8UfnfvlKH2nmBPFR95MI/BEBmAaxr/GIq15edMji0U Vjww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059583; x=1728664383; 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=2s/tzGPg/LmnPo+rxsPQADcqJffZEpvaXgXhuXN6AeQ=; b=mvHZdHRmSixA4FM2p0K0juHZqhbwFsWlX+IRzL4VbP+M5WkBroSGDpYKVYWBpqJ76T JtU8eGLyqX7nlqvtOW9/sPllijSg8KuYXdyM51kDBolgQ4ec346LraFq2U5Xg0FtTRoT EZj8FBzfpZKSh3ZiKIe14mLzKmBLzOiAHwq5UBaufx1I5scX7EtoQEUusZ++4vAtZDB6 ZBnRLB56+DK8txsU+iTvCyY7njguz6vErPG95Lbxr6b0mPczgs1M1Z5okai13kBk8i5L a8fBkCuQaKgv3J/LscSxDIJ5RiOFEG+hItLClHfzUaaJIUmOBQ8GDAj23Ar9/mfVoZWO 8NaA== X-Gm-Message-State: AOJu0YwBbvFNwlTjUHeYEZeqW/eOXtcsZ7rSIP6JzpSlxEugLdfUmtsC 9frW8SdiLOm8BXyoqfPDTu+aTWFR2jETo85M5ye+5acgc3tx9IOSG5p0eowlFrtfmZCLZgtmZ+s +lfwvxQ== X-Received: by 2002:a05:6512:39c5:b0:535:6cbf:51a3 with SMTP id 2adb3069b0e04-539ab88a017mr2509555e87.25.1728059582806; Fri, 04 Oct 2024 09:33:02 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539afec8255sm1950e87.83.2024.10.04.09.32.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:33:01 -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 09/25] target/i386: Use explicit little-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:25 -0300 Message-ID: <20241004163042.85922-10-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::131; envelope-from=philmd@linaro.org; helo=mail-lf1-x131.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 x86 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/i386/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/i386/gdbstub.c | 30 +++++++++++++------------- target/i386/tcg/sysemu/excp_helper.c | 4 ++-- target/i386/xsave_helper.c | 32 ++++++++++++++-------------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c index 4acf485879e..28ccf06309d 100644 --- a/target/i386/gdbstub.c +++ b/target/i386/gdbstub.c @@ -89,10 +89,10 @@ static int gdb_read_reg_cs64(uint32_t hflags, GByteArray *buf, target_ulong val) static int gdb_write_reg_cs64(uint32_t hflags, uint8_t *buf, target_ulong *val) { if (hflags & HF_CS64_MASK) { - *val = ldq_p(buf); + *val = ldq_le_p(buf); return 8; } - *val = ldl_p(buf); + *val = ldl_le_p(buf); return 4; } @@ -221,7 +221,7 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) static int x86_cpu_gdb_load_seg(X86CPU *cpu, X86Seg sreg, uint8_t *mem_buf) { CPUX86State *env = &cpu->env; - uint16_t selector = ldl_p(mem_buf); + uint16_t selector = ldl_le_p(mem_buf); if (selector != env->segs[sreg].selector) { #if defined(CONFIG_USER_ONLY) @@ -262,15 +262,15 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) if (n < CPU_NB_REGS) { if (TARGET_LONG_BITS == 64) { if (env->hflags & HF_CS64_MASK) { - env->regs[gpr_map[n]] = ldtul_p(mem_buf); + env->regs[gpr_map[n]] = ldtul_le_p(mem_buf); } else if (n < CPU_NB_REGS32) { - env->regs[gpr_map[n]] = ldtul_p(mem_buf) & 0xffffffffUL; + env->regs[gpr_map[n]] = ldtul_le_p(mem_buf) & 0xffffffffUL; } return sizeof(target_ulong); } else if (n < CPU_NB_REGS32) { n = gpr_map32[n]; env->regs[n] &= ~0xffffffffUL; - env->regs[n] |= (uint32_t)ldl_p(mem_buf); + env->regs[n] |= (uint32_t)ldl_le_p(mem_buf); return 4; } } else if (n >= IDX_FP_REGS && n < IDX_FP_REGS + 8) { @@ -281,8 +281,8 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) } else if (n >= IDX_XMM_REGS && n < IDX_XMM_REGS + CPU_NB_REGS) { n -= IDX_XMM_REGS; if (n < CPU_NB_REGS32 || TARGET_LONG_BITS == 64) { - env->xmm_regs[n].ZMM_Q(0) = ldq_p(mem_buf); - env->xmm_regs[n].ZMM_Q(1) = ldq_p(mem_buf + 8); + env->xmm_regs[n].ZMM_Q(0) = ldq_le_p(mem_buf); + env->xmm_regs[n].ZMM_Q(1) = ldq_le_p(mem_buf + 8); return 16; } } else { @@ -290,18 +290,18 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) case IDX_IP_REG: if (TARGET_LONG_BITS == 64) { if (env->hflags & HF_CS64_MASK) { - env->eip = ldq_p(mem_buf); + env->eip = ldq_le_p(mem_buf); } else { - env->eip = ldq_p(mem_buf) & 0xffffffffUL; + env->eip = ldq_le_p(mem_buf) & 0xffffffffUL; } return 8; } else { env->eip &= ~0xffffffffUL; - env->eip |= (uint32_t)ldl_p(mem_buf); + env->eip |= (uint32_t)ldl_le_p(mem_buf); return 4; } case IDX_FLAGS_REG: - env->eflags = ldl_p(mem_buf); + env->eflags = ldl_le_p(mem_buf); return 4; case IDX_SEG_REGS: @@ -327,10 +327,10 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) return 4; case IDX_FP_REGS + 8: - cpu_set_fpuc(env, ldl_p(mem_buf)); + cpu_set_fpuc(env, ldl_le_p(mem_buf)); return 4; case IDX_FP_REGS + 9: - tmp = ldl_p(mem_buf); + tmp = ldl_le_p(mem_buf); env->fpstt = (tmp >> 11) & 7; env->fpus = tmp & ~0x3800; return 4; @@ -348,7 +348,7 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) return 4; case IDX_MXCSR_REG: - cpu_set_mxcsr(env, ldl_p(mem_buf)); + cpu_set_mxcsr(env, ldl_le_p(mem_buf)); return 4; case IDX_CTL_CR0_REG: diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c index 8fb05b1f531..de6765099f3 100644 --- a/target/i386/tcg/sysemu/excp_helper.c +++ b/target/i386/tcg/sysemu/excp_helper.c @@ -86,7 +86,7 @@ static bool ptw_translate(PTETranslate *inout, hwaddr addr, uint64_t ra) static inline uint32_t ptw_ldl(const PTETranslate *in, uint64_t ra) { if (likely(in->haddr)) { - return ldl_p(in->haddr); + return ldl_le_p(in->haddr); } return cpu_ldl_mmuidx_ra(in->env, in->gaddr, in->ptw_idx, ra); } @@ -94,7 +94,7 @@ static inline uint32_t ptw_ldl(const PTETranslate *in, uint64_t ra) static inline uint64_t ptw_ldq(const PTETranslate *in, uint64_t ra) { if (likely(in->haddr)) { - return ldq_p(in->haddr); + return ldq_le_p(in->haddr); } return cpu_ldq_mmuidx_ra(in->env, in->gaddr, in->ptw_idx, ra); } diff --git a/target/i386/xsave_helper.c b/target/i386/xsave_helper.c index 996e9f3bfef..fc10bfa6718 100644 --- a/target/i386/xsave_helper.c +++ b/target/i386/xsave_helper.c @@ -43,8 +43,8 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen) for (i = 0; i < CPU_NB_REGS; i++) { uint8_t *xmm = legacy->xmm_regs[i]; - stq_p(xmm, env->xmm_regs[i].ZMM_Q(0)); - stq_p(xmm + 8, env->xmm_regs[i].ZMM_Q(1)); + stq_le_p(xmm, env->xmm_regs[i].ZMM_Q(0)); + stq_le_p(xmm + 8, env->xmm_regs[i].ZMM_Q(1)); } header->xstate_bv = env->xstate_bv; @@ -58,8 +58,8 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen) for (i = 0; i < CPU_NB_REGS; i++) { uint8_t *ymmh = avx->ymmh[i]; - stq_p(ymmh, env->xmm_regs[i].ZMM_Q(2)); - stq_p(ymmh + 8, env->xmm_regs[i].ZMM_Q(3)); + stq_le_p(ymmh, env->xmm_regs[i].ZMM_Q(2)); + stq_le_p(ymmh + 8, env->xmm_regs[i].ZMM_Q(3)); } } @@ -101,10 +101,10 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen) for (i = 0; i < CPU_NB_REGS; i++) { uint8_t *zmmh = zmm_hi256->zmm_hi256[i]; - stq_p(zmmh, env->xmm_regs[i].ZMM_Q(4)); - stq_p(zmmh + 8, env->xmm_regs[i].ZMM_Q(5)); - stq_p(zmmh + 16, env->xmm_regs[i].ZMM_Q(6)); - stq_p(zmmh + 24, env->xmm_regs[i].ZMM_Q(7)); + stq_le_p(zmmh, env->xmm_regs[i].ZMM_Q(4)); + stq_le_p(zmmh + 8, env->xmm_regs[i].ZMM_Q(5)); + stq_le_p(zmmh + 16, env->xmm_regs[i].ZMM_Q(6)); + stq_le_p(zmmh + 24, env->xmm_regs[i].ZMM_Q(7)); } #ifdef TARGET_X86_64 @@ -177,8 +177,8 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const void *buf, uint32_t buflen) for (i = 0; i < CPU_NB_REGS; i++) { const uint8_t *xmm = legacy->xmm_regs[i]; - env->xmm_regs[i].ZMM_Q(0) = ldq_p(xmm); - env->xmm_regs[i].ZMM_Q(1) = ldq_p(xmm + 8); + env->xmm_regs[i].ZMM_Q(0) = ldq_le_p(xmm); + env->xmm_regs[i].ZMM_Q(1) = ldq_le_p(xmm + 8); } env->xstate_bv = header->xstate_bv; @@ -191,8 +191,8 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const void *buf, uint32_t buflen) for (i = 0; i < CPU_NB_REGS; i++) { const uint8_t *ymmh = avx->ymmh[i]; - env->xmm_regs[i].ZMM_Q(2) = ldq_p(ymmh); - env->xmm_regs[i].ZMM_Q(3) = ldq_p(ymmh + 8); + env->xmm_regs[i].ZMM_Q(2) = ldq_le_p(ymmh); + env->xmm_regs[i].ZMM_Q(3) = ldq_le_p(ymmh + 8); } } @@ -241,10 +241,10 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const void *buf, uint32_t buflen) for (i = 0; i < CPU_NB_REGS; i++) { const uint8_t *zmmh = zmm_hi256->zmm_hi256[i]; - env->xmm_regs[i].ZMM_Q(4) = ldq_p(zmmh); - env->xmm_regs[i].ZMM_Q(5) = ldq_p(zmmh + 8); - env->xmm_regs[i].ZMM_Q(6) = ldq_p(zmmh + 16); - env->xmm_regs[i].ZMM_Q(7) = ldq_p(zmmh + 24); + env->xmm_regs[i].ZMM_Q(4) = ldq_le_p(zmmh); + env->xmm_regs[i].ZMM_Q(5) = ldq_le_p(zmmh + 8); + env->xmm_regs[i].ZMM_Q(6) = ldq_le_p(zmmh + 16); + env->xmm_regs[i].ZMM_Q(7) = ldq_le_p(zmmh + 24); } #ifdef TARGET_X86_64 From patchwork Fri Oct 4 16:30:26 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: 832750 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp869509wra; Fri, 4 Oct 2024 09:34:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWFNxW2/kqFUcaKW65yjr5gw+NLKbF7YRoELD++ghsmo9BjQq6o1mCXAX7AYSvCRUufVFEK9Q==@linaro.org X-Google-Smtp-Source: AGHT+IH0eJq2awlDya06O+nnst8YOcjurmz8Q0RxqmVaL8iXQv3fRV1XNTGwKuE1005D3FJPWHGL X-Received: by 2002:a05:6102:6c6:b0:48f:e09e:ef60 with SMTP id ada2fe7eead31-4a40590677dmr3418082137.29.1728059645017; Fri, 04 Oct 2024 09:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059645; cv=none; d=google.com; s=arc-20240605; b=LFnVCEcDRgLXdkZQm83oDxjheWM9jESqFJrpKSihVGq3xmfD29pXd0WsGA8JWvRq/K BeAWws/2Mu109Lc5GbHWD4RmGAqsN1lWIIfYCJ1jfYr+0hyK2RKGKnPU524Msv9ajhHD 4AkUJvch9MRmqaAHwGjQA5MoMFV3KZGO4XaymJC+BbkdmyT/UEQelvR46bwn80OUc+iG wG6Ni7cTTkaAIQfp+QRTAr5OTmyW+YXM63knFNHkiFTsMGuKFiglBC0FpiaOUFR74Jh+ UG6g1lzzU8nHqr0POdo1BaRV9Ngfp9Su3Ge8jTG+7GQXpNrSXEMnQHqYY603kvbyRq0Y XiAQ== 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=Sos7CbirHso2UkebMmuBOYVoWuS2tFtvh+AVgSe77UQ=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=TWz9ALpEdn4SZdC4w6uMfkj050v4LiZho7ddMkcZtFVf8GMAFAtzv7BEEawvxGSQxc u+s+wOyE79CkhN9phQbhXEjbnGjhOdK1jYjOU56Cw2XTe9FGy9JuEnAI0VJcO303m0W2 MabOwcCJ77I3/SQ903I6u/7MsNLFdXxvTL9LcvqhWMRzSJL7+oj0ZpfTEK9oD8FQnXoi TVOHdgYoIFKYBUy+k8j6OOI7VHfARWqKzkbkTvGqaB/rpH17s82Zf/acga5BWQlZR9no KTWP7SfZYd/3Z7LjuJcOqZLH9yAz2SDK/4wpodpo/rX3hq6+uyx/ZGW0ZwGxaIeHlqnU 5TMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FSX6BOSJ; 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 ada2fe7eead31-4a412f19270si55699137.743.2024.10.04.09.34.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:34:05 -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=FSX6BOSJ; 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 1swlFX-0000Dg-Ov; Fri, 04 Oct 2024 12:33:55 -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 1swlF1-0007pc-O2 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:33:23 -0400 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlEz-0005rj-Jm for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:33:19 -0400 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2fad5024b8dso28325471fa.1 for ; Fri, 04 Oct 2024 09:33:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059595; x=1728664395; 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=Sos7CbirHso2UkebMmuBOYVoWuS2tFtvh+AVgSe77UQ=; b=FSX6BOSJB9wZcloMRiCyaAT97UBbQi1NKzy9WJdy9whe6In7PtuKCv1qdeb4TH87Ig X2NrfrL0fXFcwNYyOxPBR1fxFvmkVmPo9Wr5eRKlA+ckacRSCVoO22gn9jVCK5ZH6CcM 2JF2RJMhFD0BBo3WXwX4f1ylheyk8SjXQ6On1ygaR2/lTw5QoqO6LcR0ghvwGH8UkBop wdZvYYQCbRf7s7+RvZ8krEKvCInILR89VxXt2X5otiTowTsBYh44mzoUH13DdCpYNzck X/O9bFAqBXFWNvSmFLqABPoncYLPlsHCPi5DtOW1pkHafP84W1hWrXA9if0mZTLo6piN KaRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059595; x=1728664395; 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=Sos7CbirHso2UkebMmuBOYVoWuS2tFtvh+AVgSe77UQ=; b=FBFhfKMEEGRqDjLF6qE9gPhAuB3grGwoyV5ujSYnIP/hvVybCa/xLQ9PJp92lGGOch uZB+n+NQT+hEmY+AAdx9lY5dSqUbdXSRWsMQxCgSAbbcq4NEyIkIZwLpozVzduTbp62y UD+P67TQSG5HWDl2PZn5V4zu94Qj6aU3Q19YTBbFZa3r6rPWvvPUchFUVMfGJtFSivrY jLq4HDCvbl0DvOU1oYPSLby7b3kB5/vHElVvdzXuCIta9zST/3Rp1BYT0dd4oeX3Bqmc GBMwxLpYOfks8bqBOv/8jeMJI3x80CifjcLE9xtoQTDaFpsVkTrryuEEl3WHDXBcqdz/ ng6w== X-Gm-Message-State: AOJu0Yyih1Qsb1xUGd1RmgJEXve5s3dXc70kEK3ZUrL3LriCZFClN2mv 9gXaL0UV2+GZzPT1BiReS70Xy8T0q+c1WhJsmlYGUpawCw0hL5QaQv77MjCveoqSKuljENAGnXB aldrNwQ== X-Received: by 2002:a05:651c:1986:b0:2fa:c5b0:39a3 with SMTP id 38308e7fff4ca-2faf3c13677mr18816021fa.14.1728059595277; Fri, 04 Oct 2024 09:33:15 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9ac461fsm207201fa.47.2024.10.04.09.33.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:33:14 -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 10/25] target/avr: Use explicit little-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:26 -0300 Message-ID: <20241004163042.85922-11-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::236; envelope-from=philmd@linaro.org; helo=mail-lj1-x236.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 AVR 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/avr/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/avr/gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/avr/gdbstub.c b/target/avr/gdbstub.c index d6d3c1479b3..aea71282a58 100644 --- a/target/avr/gdbstub.c +++ b/target/avr/gdbstub.c @@ -69,13 +69,13 @@ int avr_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) /* SP */ if (n == 33) { - env->sp = lduw_p(mem_buf); + env->sp = lduw_le_p(mem_buf); return 2; } /* PC */ if (n == 34) { - env->pc_w = ldl_p(mem_buf) / 2; + env->pc_w = ldl_le_p(mem_buf) / 2; return 4; } From patchwork Fri Oct 4 16:30:27 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: 832751 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp869591wra; Fri, 4 Oct 2024 09:34:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXd5EoXpnRMofDxO0vxDot9qfpyQj4EEQGbdrQ5sUgbRnGRdTBd4IVjApysBvW95ni6Er7Zhg==@linaro.org X-Google-Smtp-Source: AGHT+IE9cCfSFzZiZuxxBxP3DzFBKtUlrZg2DVP8bKSTNEpSQJY/61bdhchG2DcXIJ6GrAviRTz5 X-Received: by 2002:a05:6102:3912:b0:4a3:b744:7bfa with SMTP id ada2fe7eead31-4a4058f71f7mr2237365137.26.1728059656173; Fri, 04 Oct 2024 09:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059656; cv=none; d=google.com; s=arc-20240605; b=fswvpEVxaEm8Ql43PCTgFHWHmKSdwxqO0ppkefvMzdmKT3pW6TLVBHizdIdLBYsqQq pgUutrd+nJ+96zrlCWoHZ1g+3HEvCzijAtRNXWG4uAYkcIWgn6jKCznkIOOGATN6XzHR KUPfLjQ4Wa85OePmFxQK8uYKQ9oc6bPDnwkEZMkxWyc2KZk1KKkausMRAFcAuxN+hehh gy2edfWYSN+2TXhBPhM70lyWoFQHADwHdNBVch0MTtd0x8IhK2MUKECChh/+CakT4nV7 eGmrNssovUt2sE0SFK185YCzf22v0zHCThe09P3M8JAC0WUG0gYUeXJZNOXcLBtLokKH sEcQ== 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=A2b2LwHBDDNlQ4lpraog9QbauHHDsoDaj9FTLQzChw4=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=jUZinYMOy5T9l1mISRClRJQlD55Ot4yNS41XBA0bzDjgrEcuNeU0VlLVpJG0rP/r/x tSBCLuBH6X4mFnObOt+GzU/8gNxWpJxqMvWh5i2eGV2COJAiSebHIT9nKVFIzj0DlaL4 RI8Dn/aNtCehS37PdosWzSONhalgl5Wsr3RCAEJ+R4fqx+LNdwNVW/apaziqBKCRzH/+ UkcFppy5j4yVnskcKa5/YkrFVqM5FWVruvQK0AiU06ewwsflUWah3wDbLhaqrSqzD6wh /oZPpw7GIOpAU2Sf4nUS5Ox7I1WlLIpuWngtRsHeggyNwwgQHkw3+XfVy78MN/aJzXl1 Upww==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SUWGMhS8; 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 ada2fe7eead31-4a412ef79f4si46663137.723.2024.10.04.09.34.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:34:16 -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=SUWGMhS8; 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 1swlFd-0000iO-U7; Fri, 04 Oct 2024 12:33:58 -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 1swlFK-00084J-3b for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:33:38 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlFH-0005un-Uq for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:33:37 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5399651d21aso2263894e87.3 for ; Fri, 04 Oct 2024 09:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059613; x=1728664413; 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=A2b2LwHBDDNlQ4lpraog9QbauHHDsoDaj9FTLQzChw4=; b=SUWGMhS8Rb1Z8N6M5Ui0gGXejRg6XVT7CurNAYKpuy+W/qKzQKmt8s04pFlA21fb99 9C5YvEm7CU2XWbBI569KpEPOohBPZM/TRHDNVkIwGYO9dq9Cjwgclt5bLko8f2B8prkM D5fNDzTUC2EM4xDnFQO/b2WjYG8T5OLKEokukRLXj0h22AQFr6TAFvZUFJHqxjdn+Cfm 2oSGpX1M0uRKOYyJ8c9Lb7FwRsormh4gKd/47kKgiBv+Cpx3WpLTEH73HAm53oRLt7RT 58PPFhsHAFpq9LCCJdTohWN73WyHlyPVGsrygEnX+J6jVdcB6ovwA12LUa4qaNj/9qRv rUsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059613; x=1728664413; 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=A2b2LwHBDDNlQ4lpraog9QbauHHDsoDaj9FTLQzChw4=; b=v9xTIGrSYvKslgheDuwVU/R7H7M2WefUo/75FugOvjePdG4unR4WQWwYlT9KpnbrfU WTMjox/97+CyDECwmpJjf8jtWePwTMNwJ5asmG1DWD2HBAQLEdciEe10iZ4NcLkOeuOg Gf0KtQwDCJpyZlj3bp1palqlTO7z+gZZS9WzwNEad2nG8LjmwVS/4/D9DaIpcapfPVqf 3QV5RMDf5uloV/rUtPyJN6onsfMVDhhqNYWZ/qHnU+edx8Ug4EwrtF7MhLHCKRoKsF3Y jefMga4bFuByu+iT/EEevfOuZRgb96D943W6ei8179FYio7nIawzkR/yGAYCKaA25+OO PP2A== X-Gm-Message-State: AOJu0YyXOJ5lZ3Cw26ZzXyxFlkVV+YqW3svYDrOQwDKQhDvCUC/CmQMp rPBI2Kg3jFFRiQ26uzyEB6gJJLUhgf0qieB421u5lk5ZrysikEkgRcP9hyRZtvJ34U8I2D/fw3d N23e/LA== X-Received: by 2002:a05:6512:692:b0:533:c9d:a01b with SMTP id 2adb3069b0e04-539ab88a4a7mr2428184e87.29.1728059612608; Fri, 04 Oct 2024 09:33:32 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539aff234d7sm718e87.188.2024.10.04.09.33.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:33:32 -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 11/25] linux-user/i386: Use explicit little-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:27 -0300 Message-ID: <20241004163042.85922-12-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::12c; envelope-from=philmd@linaro.org; helo=mail-lf1-x12c.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 x86 architecture uses little endianness. Directly use the little-endian LD/ST API. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- linux-user/i386/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index cb90711834f..0f11dba831f 100644 --- a/linux-user/i386/signal.c +++ b/linux-user/i386/signal.c @@ -754,8 +754,8 @@ static bool restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc) env->eip = tswapl(sc->rip); #endif - cpu_x86_load_seg(env, R_CS, lduw_p(&sc->cs) | 3); - cpu_x86_load_seg(env, R_SS, lduw_p(&sc->ss) | 3); + cpu_x86_load_seg(env, R_CS, lduw_le_p(&sc->cs) | 3); + cpu_x86_load_seg(env, R_SS, lduw_le_p(&sc->ss) | 3); tmpflags = tswapl(sc->eflags); env->eflags = (env->eflags & ~0x40DD5) | (tmpflags & 0x40DD5); 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; From patchwork Fri Oct 4 16:30:29 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: 832755 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp869729wra; Fri, 4 Oct 2024 09:34:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXScaSSE3d8cgM1+1ZS9X9kGKYiRUygs2hhDCbu5Ld3U9SaBjh66nrluvp3oE1/zvEj2AoiJw==@linaro.org X-Google-Smtp-Source: AGHT+IF9wjTl9VKq5yeCyI2Gvt41QZlzKtBgFIBfhL86gx/5q3+mPrrrQhsQnHW/YQ7eKvG4jEtR X-Received: by 2002:a17:906:6a19:b0:a8d:2671:4999 with SMTP id a640c23a62f3a-a991bd9a67cmr354134566b.39.1728059676001; Fri, 04 Oct 2024 09:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059675; cv=none; d=google.com; s=arc-20240605; b=Td9oR5RTc7gs4VmKqzv5sVQwBVihtaNbCbqmHX+pt7uiY2HuylYd4HkGCRJVztDPEi 2H3WKu/VkZOkrpWD+nbhuu+s7PCqFglaSDOSDz3TnVI6zXQJY2BMfIxyIMa8pnx5C55h g9NFIDDwuIMK6/PgBqj9P9FfjMXqVoH89l06C8DM7k+u4SHhitJtbzugDwyj2z/a0R09 u8pre34/bAQaoO3ihnLsDgOyP+xepAtjrav0v1+9+DjvMWkGuZ9FLxAftwSwndgKMera 6dpwGdow/UMjPhtupGFhV4WPfNlFYqwCroONDAWi4YZTfQn7XpCdnEPlH3CR8BuZ42IU sVMQ== 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=uKaUzar4CyW9b+VidODguwjQPRzdI1IQfcANAiFe0bI=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=KSyN7OuWVdhD/5bh9Wt/wFgzPIOayiYTPa32wcFnknLTVMLwv2Sern8f6yA4OfEnX9 RrXVkSgSTqBWBsOwJe1tbwXCL8hFzHgv479TpcXfy+TOI77/7gET9AqhkiTHAT+rReYa KU7LgB7X+tcR12mafgm8FLmt+jm0acfGUNP8CAe2avwmXvHraURIjxKJIfcJkmemDHmn 4c/YdnGVBDqFEIih/ItG5H5GdLRdVZkeCu+CXb2Oz08zbdJvlZxT3hNOcTzGtnsO9App BHNT4Dy7QYVcHMrg3f+m7zh6cIrus6f5if8D89xbqcaHGDomHZ7IrgV2cY8eAyqNxHyx ap+Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WupiJwVH; 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 a640c23a62f3a-a992e7f4cf0si12453666b.861.2024.10.04.09.34.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:34:35 -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=WupiJwVH; 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 1swlFt-0002Y5-IP; Fri, 04 Oct 2024 12:34:13 -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 1swlFo-0001vu-9d for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:34:08 -0400 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlFl-00061M-SK for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:34:08 -0400 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5398a26b64fso2386005e87.3 for ; Fri, 04 Oct 2024 09:34:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059643; x=1728664443; 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=uKaUzar4CyW9b+VidODguwjQPRzdI1IQfcANAiFe0bI=; b=WupiJwVHeCXB6aPmjNqYTZQbwDvic76JnBZYSNwJcF6NcAnh5iuWAJYBTnkXvvT1/u 1LKwvMKpx5NG+nkDD3hIT9ZhdNLM4Ynd5LkvF0VuIpzDmWGEBTmCvuCq89h+cWAGtSBu pl7dPt2xRYfNE3HfjbIbThhcWzicmn0U5rtFys5Tt5Sbpfuka87E3dCO/v19YoC9K0Rr WHX5RvUtRad2mIaM/U9VV7elCk05c5urP93tZezjGLuijrUVJX+aqF4T/n/EhmJ+LeWq TCYu6wA2z2ptkWwQQgntaXGr1/TFF989nVW438YvhK+nRfr0YhKKKWgOdy2I5rT5csx5 LKng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059643; x=1728664443; 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=uKaUzar4CyW9b+VidODguwjQPRzdI1IQfcANAiFe0bI=; b=K2OBCgWA2Qs6R/VxyGikl52Xs4yZIuilad0q4PVSgyiHu3gp0XKQlI6JYE8MStV3xw J4swRm/UG1ojC5edXaamaU7gGVZzzIldsf9nqpzFEQKOSYSfWCPPdBOiWd/+p/Ukqdi6 +px1nAxnwXS4qEpCGCZPg5lnh8874H7+oQ5KKqT670b1lx0xWrE+EKboGIf/QZXP0DEO IBCRdU/62qXLaY0aic+0ZQz+2eUqjMYbsNaFYH4nLJh1ozanfoYlhe0V5Qq4l5YIHREr ULEn+zE8uWOXl9H5tQFAjFV07AkYWpIL/xuLZaM2PvMdGVypU7gmUEQoXV92vJNOGL/q XF3g== X-Gm-Message-State: AOJu0YwwynnQ9XOpSJczXScnMZw4VY7R47kh6Wfa0o/KNJKiWLp0LkhE a9510h1QnC5d7RPor9Pcep5Se/JdqBebMQ8afuCvUK6FBVWi4cXfzCxPr04rWhzuJ2jzwwJS1DG nZia4zw== X-Received: by 2002:a05:6512:318e:b0:536:7cfb:6998 with SMTP id 2adb3069b0e04-539ab89e01bmr2589237e87.35.1728059642951; Fri, 04 Oct 2024 09:34:02 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539b0025812sm766e87.307.2024.10.04.09.33.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:34:01 -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 13/25] target/sh4: Use explicit little-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:29 -0300 Message-ID: <20241004163042.85922-14-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::134; envelope-from=philmd@linaro.org; helo=mail-lf1-x134.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 Since commit 73ceb12960e ("Remove the unused sh4eb target") we only build the SH4 architecture for 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/sh4/); \ done Signed-off-by: Philippe Mathieu-Daudé --- target/sh4/gdbstub.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/target/sh4/gdbstub.c b/target/sh4/gdbstub.c index 75926d4e049..194be1d5db3 100644 --- a/target/sh4/gdbstub.c +++ b/target/sh4/gdbstub.c @@ -80,59 +80,59 @@ int superh_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) switch (n) { case 0 ... 7: if ((env->sr & (1u << SR_MD)) && (env->sr & (1u << SR_RB))) { - env->gregs[n + 16] = ldl_p(mem_buf); + env->gregs[n + 16] = ldl_le_p(mem_buf); } else { - env->gregs[n] = ldl_p(mem_buf); + env->gregs[n] = ldl_le_p(mem_buf); } break; case 8 ... 15: - env->gregs[n] = ldl_p(mem_buf); + env->gregs[n] = ldl_le_p(mem_buf); break; case 16: - env->pc = ldl_p(mem_buf); + env->pc = ldl_le_p(mem_buf); break; case 17: - env->pr = ldl_p(mem_buf); + env->pr = ldl_le_p(mem_buf); break; case 18: - env->gbr = ldl_p(mem_buf); + env->gbr = ldl_le_p(mem_buf); break; case 19: - env->vbr = ldl_p(mem_buf); + env->vbr = ldl_le_p(mem_buf); break; case 20: - env->mach = ldl_p(mem_buf); + env->mach = ldl_le_p(mem_buf); break; case 21: - env->macl = ldl_p(mem_buf); + env->macl = ldl_le_p(mem_buf); break; case 22: - cpu_write_sr(env, ldl_p(mem_buf)); + cpu_write_sr(env, ldl_le_p(mem_buf)); break; case 23: - env->fpul = ldl_p(mem_buf); + env->fpul = ldl_le_p(mem_buf); break; case 24: - env->fpscr = ldl_p(mem_buf); + env->fpscr = ldl_le_p(mem_buf); break; case 25 ... 40: if (env->fpscr & FPSCR_FR) { - env->fregs[n - 9] = ldl_p(mem_buf); + env->fregs[n - 9] = ldl_le_p(mem_buf); } else { - env->fregs[n - 25] = ldl_p(mem_buf); + env->fregs[n - 25] = ldl_le_p(mem_buf); } break; case 41: - env->ssr = ldl_p(mem_buf); + env->ssr = ldl_le_p(mem_buf); break; case 42: - env->spc = ldl_p(mem_buf); + env->spc = ldl_le_p(mem_buf); break; case 43 ... 50: - env->gregs[n - 43] = ldl_p(mem_buf); + env->gregs[n - 43] = ldl_le_p(mem_buf); break; case 51 ... 58: - env->gregs[n - (51 - 16)] = ldl_p(mem_buf); + env->gregs[n - (51 - 16)] = ldl_le_p(mem_buf); break; default: return 0; From patchwork Fri Oct 4 16:30:30 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: 832754 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp869699wra; Fri, 4 Oct 2024 09:34:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWIyBDxnKCVgjQNrT3xoFTfFoRwFe50JLVRav5NqiUzs9T9pu8nRAq39ZW/4Gf1bOK3HsIUDA==@linaro.org X-Google-Smtp-Source: AGHT+IE5QvlqhTEmk54mgtStj2RmWZclPEmQGmhISnZN33so7kGkfV6Wgr3ArVLeQ6suhOT7PPKr X-Received: by 2002:a05:600c:4e86:b0:42f:5ca3:d784 with SMTP id 5b1f17b1804b1-42f85aae76dmr30175805e9.14.1728059672664; Fri, 04 Oct 2024 09:34:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059672; cv=none; d=google.com; s=arc-20240605; b=aT2tqeJm3pnkoAIZrukvjt1lARZCTXCiGfNoneRBVIZkKPojppUAd3ocnOGyuO0Wcj TKhz1uvgfYobeAFZqp1UmEOHmWVe3TiFitiZypVQTZkBzILc56MKyjxcTllS4dbO26K0 039qC3Ax284uph7zkf4pntTkAEu/hwSQ/ImKGJ+OrMbxykoMcj8J9SFwd+JLlAcMEa/W n6ROl1T//zjtcBvPrN1l8xI5G/DeYv0WXCxpwpSM9jTiKoa3a+QONT+ME7FUBH3MA3XO 7HdHKYcep8KMqVlcWswMrY9vl8N4ActVTTqo0AFJN/vCL9hWsNiV0j4GLUkI14od3YSv MvYw== 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=VXhl0xEMfTxY7A/pldYaZefOo2LKk36HnCJi2vt2Dc4=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=KLLyB0cIA/TWlWkgZAvIWZwFbTHdH+YjStaMXCOx8NkWE4uAmdf5+FvAVedIhwIn+M xTu1lJqLRL9+6NKBsJCn2x3pj2z2Y14dVzClr3UZkYWIIjYr4M0tSSccPPvQuUKEt2sI n6JY/F7ocs5j7Cxx9FJqlUr61HhKQzeLxQYHR9eFBDIoZqz5n3PaElqDnepO7/iqGIjV MU2hHxvo3CVR9ZV0cG0A2mEZxHwkv5fQX4jj+BDIg1bcDjLFW9yZRqhIk3MZZDhE3Xly uVERMhDENj9uvGpa8JBjt6pq2UrwYWJFETIHQDSgzNqTqGoqA83+zfrAWwAnmIZW+x7B qfxQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SzPpt6RH; 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 5b1f17b1804b1-42f89ed77dbsi681295e9.128.2024.10.04.09.34.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:34:32 -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=SzPpt6RH; 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 1swlG6-0004av-G1; Fri, 04 Oct 2024 12:34:26 -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 1swlG1-0003qJ-7O for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:34:21 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlFz-00065B-EM for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:34:20 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2fac47f0b1aso29919201fa.1 for ; Fri, 04 Oct 2024 09:34:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059657; x=1728664457; 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=VXhl0xEMfTxY7A/pldYaZefOo2LKk36HnCJi2vt2Dc4=; b=SzPpt6RHFygxgf0Zop5pieCHNBIXPTQOBvuzK2gY1SvfRXzASxyhtbOif9L2LlovnS +oVmthXPOnKG8fD+l1szHZVtIyWMioabCayNVKK3M+cgwOQhAmdo6QgBBelOJGk3pbkF XoFpMQDYDtWDhhqlKrThejqewClb61RXLZsHfKkKmOenr9AGFVC17lx5tBozbI+FJcdl 6bhH79IIi3Sy2ADUDStrpTL93tRoil+sTlNzOSYhHBqiQloGTW6yhKKTBBWqe4T/TjW+ RLMfzwRnYAllJkhA9qVBMvGXqKPNHWGRE7u23IBIyVLNx7wFArcdiUmPbnMhJF++CN/X 8LSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059657; x=1728664457; 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=VXhl0xEMfTxY7A/pldYaZefOo2LKk36HnCJi2vt2Dc4=; b=sW1i/eoj8bsk0HN/vFweaula7ctQKGa5a5lZGCsQRgRbNQGXFq3MKdv3xzqVWMsBW4 If0PzuqfqsE2Dwej8qVfy1bzYrn5lCYCKmv8WrzWMwz++ks/4fV1tRlZMphDIbTCOnbU vUOArOFGKnSkUQIzZvMWIFYsIGMpIJH3/TpiSvDQPXxiXNXGhX0RvTalvy5CbtCueNzC 9v/2h7Eo+A8jjS7S6zAJairVWFbAtPDXC+NEQuR0RSAmNUi4p/hAe9/lCY3GTrihnr8S WzTwbkh08csT8eYyrwxSntKw+mv40ivDFsgWHUutloZ/JlqvxmPT3ydmzebBcHYC5Q1q Q+Sg== X-Gm-Message-State: AOJu0Ywzm/S342Gr4ZFItLcIF5XZPmn/zDHWpzanaEP9XaOpCEXJkC2z F0k5ZG0ljpqsKJkHpPs+MmgDVgPwILenCxgrSlqvOgxGlzTS5ZJpIWQZwJPlSGWcAyY31qhhh7s yM/QTAA== X-Received: by 2002:a2e:a542:0:b0:2f7:51a2:96f2 with SMTP id 38308e7fff4ca-2faf3c011dbmr15140621fa.8.1728059657380; Fri, 04 Oct 2024 09:34:17 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9b339b0sm194261fa.124.2024.10.04.09.34.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:34:15 -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 14/25] target/tricore: Use explicit little-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:30 -0300 Message-ID: <20241004163042.85922-15-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::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.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-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 TriCore 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/tricore/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/tricore/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/tricore/gdbstub.c b/target/tricore/gdbstub.c index 29a70051ffe..0b73b1280e0 100644 --- a/target/tricore/gdbstub.c +++ b/target/tricore/gdbstub.c @@ -124,7 +124,7 @@ int tricore_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) CPUTriCoreState *env = cpu_env(cs); uint32_t tmp; - tmp = ldl_p(mem_buf); + tmp = ldl_le_p(mem_buf); if (n < 16) { /* data registers */ env->gpr_d[n] = tmp; 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; From patchwork Fri Oct 4 16:30:32 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: 832758 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp871603wra; Fri, 4 Oct 2024 09:38:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUnUR8h+HzwfAFdixub33JbQNpc/NpbQHtY1AyQuMhZG4qX8Cl99XEeCl7MpUBPB3a3sc6M+Q==@linaro.org X-Google-Smtp-Source: AGHT+IFFk2/WEFcSX5JKOiveRLTufDlbtC85HiN5h4Ln6rUtVCekoYtqo23ggV7ibmWCghxO/yZa X-Received: by 2002:a5d:4ed1:0:b0:371:82ec:206f with SMTP id ffacd0b85a97d-37d0e7384c9mr2097017f8f.16.1728059914926; Fri, 04 Oct 2024 09:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059914; cv=none; d=google.com; s=arc-20240605; b=NSFmZ7ku0d9xM/T2omEyCVJ/ash0OZuWCmOWAjIKtLzUgbhnM0mP39965wplR6tNtF ErIF5bsyw6A3KtfZ+YUP7cgnJfPix1+eQkolk+cv5+TOxwezfwEepblgsqfUit1wRUS0 eOE0DpLel8sCA6GgbicoFMEhqO8gm/s6E3fIn3OMZUl+o6gMXd6UVsxJqlBQVZwpJ2P9 qGjiYRcmXyh99l9BNQdC70HIJvg5kY2y80xBp4jVF5jlNVY6taqma2Y78dPXDepClGFe edicJCDaVGUBsPeQgcJsrVsyLfdX+Pg85HjORNyuK97f2zPRDehDYpVM3Htf+2hfkh5y BGYA== 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=F7K2UdhT0lmKAUQ5+UAlf+1d8SHSmOIhciQuHFY8P5Y=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=iX6gCOvJ2rVP1ATw5F5hRLjKatCrmi8rjZjkCZFtQytz/DIj+Ay9Z4eBTkmR1XiBlX sMiS+jE+KY78edWOrXgCUMitmU9smy18qLIyl9QGpjrEkWkZpp/ks3IAVpqDGxBmg0Zi YpPDaogzB6eC0JlSN/uBZO5nfF2oOrdSi6ELKhJ8cL83bq0B9/Ezw4CSVOpf8kn5uwEp Y45Z0zc8JfapivJcxG8RxtSy3115ffV5QeltIFdB1//RYXG7FQPYEdnGPxpnTdnxGnIB uzyjighjm3PMKzbjg2HreTvjkqSnwwVHL0ruC39VkC2SvKxiMR+AHJNglPmaXZnFpEOL p2yQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QPqeOSfc; 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 ffacd0b85a97d-37d169734dasi14350f8f.629.2024.10.04.09.38.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:38:34 -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=QPqeOSfc; 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 1swlIS-00026r-5L; Fri, 04 Oct 2024 12:36:54 -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 1swlGe-0006r4-C5 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:35:02 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlGa-0006Bu-52 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:34:57 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2fac9eaeafcso27611671fa.3 for ; Fri, 04 Oct 2024 09:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059694; x=1728664494; 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=F7K2UdhT0lmKAUQ5+UAlf+1d8SHSmOIhciQuHFY8P5Y=; b=QPqeOSfcwv1jDxwn/udV857brkXxg6kQbLWXWgDAtLnIoiVcy7g0YCDluulBamH93o C5X0PGpEbyVdxNO46soHEzkRFjRk2PC6eTXou3qEb0gOM13YskzGmUHOZzxjCZ+/0Z4T 2lTCGlMBUdVQbtm3nPABF7SesZ3FmDJ7wJisIpGo6U/27szjmzvHEeJZG5r6G+4XOHuM 3S9eJ6EdwietkEX8TROANuz45nKrIrsq368mQZvdGWMu8o9NjE4gQRsnN4HYRSeDxFi7 3sjJUuVk5QmxRa2BxFvsatDoVMz6OSElrStrHYDqREfRMnZvXCc1Ft6iWq/Xj57vxlid sYJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059694; x=1728664494; 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=F7K2UdhT0lmKAUQ5+UAlf+1d8SHSmOIhciQuHFY8P5Y=; b=LdOI7nHaoRxi4DKnNd9u1qiZ3XozQiUvmf/A9FOKEd0A74Ji57Ry0nHmdl7dPFemOM 6V6KpBcx9KV5EJvl2Jh6pwqOTVBWWju/3HTLPZWsxYEucYyY85WR0ct8oKntVB4k/NVo +DbHdziW4AWkGDjeiKAdG3TGYlhzia0ukUwtvL+ysmabXKh/HinGoPKMcdxX/Ka4j35L khs0pAXUwearoKlaSTviod6lDTvAw3EfXbnsR51qj2ogyNzmSjZzGADqcNTAcY4vbZHH KASbNsnpQE7jwbjubXfHFY+0VmmTAiYBlUx3efc1DBP0/tOo/bMLpi4UfSFEeMDB3RNe 9TZg== X-Gm-Message-State: AOJu0YzZLy3JEu4FSQtW7mVp0lsG7C/iG/HFWCMI49qgVrlZ3UJEcKT5 yM07i8YHEzVIl6txLmEy9B9fpqdxEKVJU+OlVNUBsi8U+TI78zN7h2VG3DMYAlyopy0RMWfmGTu p/XHm3Q== X-Received: by 2002:a05:6512:12c4:b0:539:964c:16d9 with SMTP id 2adb3069b0e04-539ab9e6f6bmr2435493e87.57.1728059694180; Fri, 04 Oct 2024 09:34:54 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539afec8276sm2366e87.86.2024.10.04.09.34.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:34:53 -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 16/25] target/riscv: Use explicit little-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:32 -0300 Message-ID: <20241004163042.85922-17-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::22d; envelope-from=philmd@linaro.org; helo=mail-lj1-x22d.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 Risc-V 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/riscv/); \ done Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/gdbstub.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index c07df972f1e..2e042f117f3 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -84,15 +84,15 @@ int riscv_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) switch (mcc->misa_mxl_max) { case MXL_RV32: - tmp = (int32_t)ldl_p(mem_buf); + tmp = (int32_t)ldl_le_p(mem_buf); length = 4; break; case MXL_RV64: case MXL_RV128: if (env->xl < MXL_RV64) { - tmp = (int32_t)ldq_p(mem_buf); + tmp = (int32_t)ldq_le_p(mem_buf); } else { - tmp = ldq_p(mem_buf); + tmp = ldq_le_p(mem_buf); } length = 8; break; @@ -130,7 +130,7 @@ static int riscv_gdb_set_fpu(CPUState *cs, uint8_t *mem_buf, int n) CPURISCVState *env = &cpu->env; if (n < 32) { - env->fpr[n] = ldq_p(mem_buf); /* always 64-bit */ + env->fpr[n] = ldq_le_p(mem_buf); /* always 64-bit */ return sizeof(uint64_t); } return 0; @@ -162,7 +162,7 @@ static int riscv_gdb_set_vector(CPUState *cs, uint8_t *mem_buf, int n) if (n < 32) { int i; for (i = 0; i < vlenb; i += 8) { - env->vreg[(n * vlenb + i) / 8] = ldq_p(mem_buf + i); + env->vreg[(n * vlenb + i) / 8] = ldq_le_p(mem_buf + i); } return vlenb; } @@ -193,7 +193,7 @@ static int riscv_gdb_set_csr(CPUState *cs, uint8_t *mem_buf, int n) CPURISCVState *env = &cpu->env; if (n < CSR_TABLE_SIZE) { - target_ulong val = ldtul_p(mem_buf); + target_ulong val = ldtul_le_p(mem_buf); int result; result = riscv_csrrw_debug(env, n, NULL, val, -1); @@ -226,7 +226,7 @@ static int riscv_gdb_set_virtual(CPUState *cs, uint8_t *mem_buf, int n) RISCVCPU *cpu = RISCV_CPU(cs); CPURISCVState *env = &cpu->env; - env->priv = ldtul_p(mem_buf) & 0x3; + env->priv = ldtul_le_p(mem_buf) & 0x3; if (env->priv == PRV_RESERVED) { env->priv = PRV_S; } From patchwork Fri Oct 4 16:30:33 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: 832765 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp873086wra; Fri, 4 Oct 2024 09:42:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUfiyPK92kXPHgVuhOuuoMxRUHIdsC/pZvNMlxps1x80RPFIFoJTn4I77LNb1i095mXlFRVMA==@linaro.org X-Google-Smtp-Source: AGHT+IF8TI5UAvPBhMwpVk2rT5Evc1wICUxAro8ZzGt0Dcbx3kTTiTsroPW0KUaIJhq4bMdBIkzl X-Received: by 2002:a17:907:961d:b0:a8d:3085:a7b1 with SMTP id a640c23a62f3a-a991bd989e0mr407694966b.38.1728060123120; Fri, 04 Oct 2024 09:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728060123; cv=none; d=google.com; s=arc-20240605; b=aNlY5HIrkbslM0GymcFKVnWsVchw5GwQz3dCG00EZeiiT1VrkKQqPhQZDfOthydMdW btEI3dL015jcnQj+BQFI3tYbqldUNCWVj0NFOlNmK9eag7sNZDiU6zQRjsZb4lEy5pmD tHmUoUbRyQKv3ngzPRvQTQBq0wacGYJLitME3j1EOIG2QfIwWYmmdd1PhymkzL+ZxD/Q ZX591jSLqL5SjE4204M25xqBxxvJatBNByhGin8Y4x6CPxbvsOngcr50QzpSeLCBEuic fs8BrQVfDlnFUOv+QsKOgtNFlIYU/EFz/kJTMhcWJ9pN8vSCkfHgKjz3R55jiMTF0Byt YFzA== 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=FMPHX1jqQUTWI4pf2r0FuqonzJoCTqpttYtMaDPMSzU=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=AicyOGAFrh2WOkfFfUYSptn5Y53H31yel23uHZGXNALQWLqTWoPUiNq+UgQPyyYYU3 FpFMB7sLN7S/9UNI/fKmk/jMRLaVV5tfkmYFEIGcKOScD0WklMsK6VWd4wQGSk+BQLzg R+HJ9R+6GcXNSDJFGGag3z0gkCgRHtm5sIWkd6xhaLu0MzXE6v1ztaYI8YKDoxPY485a gebsprtoTU9zGKogvzCnhY6IjwX0+IpdfdCxP2ub1Y1JFIRSEU/VSJBDGio1UlwpDooY DIvkb4YlCobQTsZ4Z4E6/aQkhd3Cyr5BmPXzf3J4HJ3PNv67joCei+TTlIWyk0ikX1D+ 1h/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qpnimFtK; 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 a640c23a62f3a-a992e5eab99si14858966b.251.2024.10.04.09.42.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:42:03 -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=qpnimFtK; 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 1swlJ2-0003fG-PC; Fri, 04 Oct 2024 12:37:29 -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 1swlGr-0007PB-TG for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:35:14 -0400 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlGo-0006P4-M8 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:35:13 -0400 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2facf40737eso28347201fa.0 for ; Fri, 04 Oct 2024 09:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059707; x=1728664507; 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=FMPHX1jqQUTWI4pf2r0FuqonzJoCTqpttYtMaDPMSzU=; b=qpnimFtK6rIxbKY9VVh/UCpMRuYEjoz4H1C7JOAP81QG0G9FcUSbKagjEey/fvKg03 +p06zPEI2eHHgLh9LR9RWxi1F0yO/2BcRm2KXGqyO3Irdp1yFLatTJwbG0L6fea8CN5y 5TvjxyBw6jkYx3CfbUzu9Qw7CtGewyQI5umFtbnB3F1JnDpk6/17xtmeplV+5G+k3Zkf XmJBAqqRg5Lc66H52GbsNjwDs2uq8V/ySkbypIE6ksvZLtQ7xiNKX5qGWVZdJBseShTS xorJa2JKR5GZFzIffzteIV+XRiccqkDMJCZj3MBIENxdIaY37YV/7KKYxfZ4lVhLVdlI ji+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059707; x=1728664507; 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=FMPHX1jqQUTWI4pf2r0FuqonzJoCTqpttYtMaDPMSzU=; b=Ngv5aJrV+HVabhHMddBbZa4zkJlRBPF9nvw+dMZHsiYbeCN4cWhzizMTffqbrfK8xT k5ebqBGzXUhvzBJRVECAugYOvM9YLIpNCBLLhgj2wzJ8tLPwsz9NpEqHkQO8eY2y9IjE +93BMNOYygcqOxi9tagrhoGyM5OwmtUUPDxN9TX3o4VZBkpilH/phcMuweRTq4EAUSMH 6+OFYHQjjg3j2+xhKWaxMaBsjxKBrckg3oR3tkbuocSUZvPWKZSDAxBh9Ngw5Vlg8eQH RzNmWcp7eCjyDJyHLEOdwsTHFPkxYjZazPwkcCIGeXhqi204BXhTimpJNSEvo3adqPmg /JvA== X-Gm-Message-State: AOJu0Yz3feTxC9SiRpOQ8lW7FN0nzrik8QmwFYl5o+BZ7D14/ZYspFVM yp2OfjkA51Io1BfUtJR34h4DEzua0YrPv5+Uwd4VKpHKbJzAP6gyUei6ZL301P8hJXlH5cu37QN 77RcGfg== X-Received: by 2002:a2e:3806:0:b0:2f3:b8dc:7d24 with SMTP id 38308e7fff4ca-2faf3c5f4f3mr16451211fa.17.1728059707174; Fri, 04 Oct 2024 09:35:07 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9b3b441sm195821fa.139.2024.10.04.09.35.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:35:06 -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 17/25] hw/m68k: Use explicit big-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:33 -0300 Message-ID: <20241004163042.85922-18-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::236; envelope-from=philmd@linaro.org; helo=mail-lj1-x236.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 M68K architecture uses big endianness. Directly use the big-endian LD/ST API. Mechanical change using: $ end=be; \ 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' hw/m68k/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Reviewed-by: Richard Henderson --- hw/m68k/bootinfo.h | 28 ++++++++++++++-------------- hw/m68k/mcf5208.c | 2 +- hw/m68k/next-cube.c | 2 +- hw/m68k/q800.c | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/hw/m68k/bootinfo.h b/hw/m68k/bootinfo.h index 70c1dc0e8c3..0b3e7c4ea01 100644 --- a/hw/m68k/bootinfo.h +++ b/hw/m68k/bootinfo.h @@ -14,39 +14,39 @@ #define BOOTINFO0(base, id) \ do { \ - stw_p(base, id); \ + stw_be_p(base, id); \ base += 2; \ - stw_p(base, sizeof(struct bi_record)); \ + stw_be_p(base, sizeof(struct bi_record)); \ base += 2; \ } while (0) #define BOOTINFO1(base, id, value) \ do { \ - stw_p(base, id); \ + stw_be_p(base, id); \ base += 2; \ - stw_p(base, sizeof(struct bi_record) + 4); \ + stw_be_p(base, sizeof(struct bi_record) + 4); \ base += 2; \ - stl_p(base, value); \ + stl_be_p(base, value); \ base += 4; \ } while (0) #define BOOTINFO2(base, id, value1, value2) \ do { \ - stw_p(base, id); \ + stw_be_p(base, id); \ base += 2; \ - stw_p(base, sizeof(struct bi_record) + 8); \ + stw_be_p(base, sizeof(struct bi_record) + 8); \ base += 2; \ - stl_p(base, value1); \ + stl_be_p(base, value1); \ base += 4; \ - stl_p(base, value2); \ + stl_be_p(base, value2); \ base += 4; \ } while (0) #define BOOTINFOSTR(base, id, string) \ do { \ - stw_p(base, id); \ + stw_be_p(base, id); \ base += 2; \ - stw_p(base, \ + stw_be_p(base, \ (sizeof(struct bi_record) + strlen(string) + \ 1 /* null termination */ + 3 /* padding */) & ~3); \ base += 2; \ @@ -59,13 +59,13 @@ #define BOOTINFODATA(base, id, data, len) \ do { \ - stw_p(base, id); \ + stw_be_p(base, id); \ base += 2; \ - stw_p(base, \ + stw_be_p(base, \ (sizeof(struct bi_record) + len + \ 2 /* length field */ + 3 /* padding */) & ~3); \ base += 2; \ - stw_p(base, len); \ + stw_be_p(base, len); \ base += 2; \ for (unsigned i_ = 0; i_ < len; ++i_) { \ stb_p(base++, data[i_]); \ diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index b6677ad6bc3..e37cd50d189 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -359,7 +359,7 @@ static void mcf5208evb_init(MachineState *machine) /* Initial PC is always at offset 4 in firmware binaries */ ptr = rom_ptr(0x4, 4); assert(ptr != NULL); - env->pc = ldl_p(ptr); + env->pc = ldl_be_p(ptr); } /* Load kernel. */ diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 9b78767ea8e..9832213e7ec 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -1036,7 +1036,7 @@ static void next_cube_init(MachineState *machine) /* Initial PC is always at offset 4 in firmware binaries */ ptr = rom_ptr(0x01000004, 4); g_assert(ptr != NULL); - env->pc = ldl_p(ptr); + env->pc = ldl_be_p(ptr); if (env->pc >= 0x01020000) { error_report("'%s' does not seem to be a valid firmware image.", bios_name); diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index fa7683bf76f..556604e1dcf 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -684,9 +684,9 @@ static void q800_machine_init(MachineState *machine) ptr = rom_ptr(MACROM_ADDR, bios_size); assert(ptr != NULL); - stl_phys(cs->as, 0, ldl_p(ptr)); /* reset initial SP */ + stl_phys(cs->as, 0, ldl_be_p(ptr)); /* reset initial SP */ stl_phys(cs->as, 4, - MACROM_ADDR + ldl_p(ptr + 4)); /* reset initial PC */ + MACROM_ADDR + ldl_be_p(ptr + 4)); /* reset initial PC */ } } } From patchwork Fri Oct 4 16:30:34 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: 832763 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp872918wra; Fri, 4 Oct 2024 09:41:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVCkPtVnIQibYYnqN6cF5FoPYQkrOX+q84Gkm/qZCbtgwtjxyCr5K5ueKnkjhB6ezA7CpVYUg==@linaro.org X-Google-Smtp-Source: AGHT+IFVBTGPEzXz2PtIsEWZ9s6dDKFK+7s8h8LiIHiFu/nNC6O0aDFQNafIY5Rzhy+WoFFH3ic4 X-Received: by 2002:adf:b35b:0:b0:37c:f997:5b94 with SMTP id ffacd0b85a97d-37d049ea426mr4805092f8f.12.1728060101468; Fri, 04 Oct 2024 09:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728060101; cv=none; d=google.com; s=arc-20240605; b=ATALQrks6v7nCCaHcZ1bEf4yTGoJaetrGDUCN3SoSvAeoTLhpfuxbuGchsvGbV28RX 19AvKb4/nWMH8RJJurqhVInPmT8VVxj4Cu4Wp1gv3kSBJ/tZiNTwONKxGcQHTuEfjLAB roL6f09JBDEILJu14uD458/yQkuPW+aQ/7HKl4BKX1xjGpot7kmdPHcRfCEahNKIMN8O WpNIGRads/MLzGuiPr3rhLPmQ1tQK2p/uqQUu4UKWj9Sf0fvArGphEqrF1K95ZSqa5bZ /Bqm33DW2v3nrhnlA28AoVbS8G5++d00K048hMpKxoVptzak1pLlxbk6bbR9YwNAc7Vo ViHg== 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=0hTPF2P0wkzOAl3QcmMS55AC0dIObjOQe3WnAgnhe+k=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=OK4E54w1Sqkq8Fps4Nt8VojC3pKQ5NmPOUlL5cpfSUxAnL82whA1XcEXKVvxjbnL5N 3qHt/tkVEXPCnLQFA7YraX71HLzaGiv3MR4hWLnikZiMRRxnJ529SParRdCDwoXxnPyD wvUfFYyOc8iDePvByLCh1eYObXmM/Wnz6tm5pulULPoqzO7M4GA8GA/XpSqp/PxyEFpX tWNHVbMUbvXY+h5Gax3BWD6GYEoJ6IW1HG0TDmdYX2rjY3VIs8ZxyGJUf+S/cJJ6QMpg RNOy06bL4R3rcQB9mKHHZ1zgLyqw9uyKVpqfYbK6ZSQen7gxHI1TZLsejqSoNOh3O3q/ UwuQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZuB0jU4K; 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 ffacd0b85a97d-37d1695efdesi16758f8f.476.2024.10.04.09.41.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:41:41 -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=ZuB0jU4K; 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 1swlJB-0004yU-L9; Fri, 04 Oct 2024 12:37:37 -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 1swlH1-0008M7-PA for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:35:23 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlGz-0006Sb-0u for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:35:23 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2facf00b0c7so30477241fa.1 for ; Fri, 04 Oct 2024 09:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059719; x=1728664519; 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=0hTPF2P0wkzOAl3QcmMS55AC0dIObjOQe3WnAgnhe+k=; b=ZuB0jU4K88OVDQVNrOJZ8HeMX1m0z8jd4vIL4a/dgxfoaGJOSJqkl/3aQO/s9eOlhy Kb2wCgRnEmDJ+PiQio03iDUpj1jsOOakdt06e4YSjxzcZ6E3Xb7DC4jqWSgGyKzxsxoN 09BepvsgLUw63Xpdy6wPeUoDO4njTCovkRb6WyqRCPJHnVGFdskZ/58+CaiBokkA/pVf nGPb4fdtBBS6hHn0nuClei+fhxjL8AQ3pTNs3uJkMRXZEEylwf2gD9Wql0Ee6LPJ5XjG XL5z3l3qO+eeQIfPj3SfGwEeFQRxqEIRG5PvwIaECEAxiDCc3l/4Z0o6xYWfdk/S2nF5 28wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059719; x=1728664519; 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=0hTPF2P0wkzOAl3QcmMS55AC0dIObjOQe3WnAgnhe+k=; b=QWWO26xAxTEo+RG6jo7+AZlZE78QcXxSpEcJHkICq7bQckhYGfXnl0wFEhWRfvOd53 cNQRsTDjVnE/drzcxyhBjrAfmGTHNTMlOuTKuFhuX7ERN3+X9Ms6rhLChenyfSj7lc19 lF3kYsTxzbDxT148al2jWGxgrT8vTp51qXTETPG552iD4bxcySnP+4W6Auw9Oh7qWvSR rUVPNBMr2AgVaW+gut40r6VS9KyGirE1KQ4/T1UxmHZtfZ/SYoPhzMhxOgTqHn+bBOob xNZnh6FKkFVoYoF1ki39kdYVV3h/fkuffuiw0Xo/AeCiDRMqxt7bywe3HMENw0NCrdZL CCsg== X-Gm-Message-State: AOJu0YwAic126m9e1+HPJbpb0uukaqPY9x1g5wKomL2OEytb30ihbMRZ NnP6V4EqqLFaqjUh32ZGVY6zNbpmfGLGSNLOFZLaVLKeEACVFxDrSeGj1BQKdCqaKokufmKPBbj 463sWvQ== X-Received: by 2002:a05:651c:1989:b0:2fa:cfba:fb65 with SMTP id 38308e7fff4ca-2faea1b7d1dmr26392521fa.3.1728059718985; Fri, 04 Oct 2024 09:35:18 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9b24991sm201001fa.83.2024.10.04.09.35.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:35:18 -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 18/25] target/m68k: Use explicit big-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:34 -0300 Message-ID: <20241004163042.85922-19-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::22a; envelope-from=philmd@linaro.org; helo=mail-lj1-x22a.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 M68K architecture uses big endianness. Directly use the big-endian LD/ST API. Mechanical change using: $ end=be; \ 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/m68k/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- target/m68k/gdbstub.c | 2 +- target/m68k/helper.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/m68k/gdbstub.c b/target/m68k/gdbstub.c index 15547e2313c..136159f98f2 100644 --- a/target/m68k/gdbstub.c +++ b/target/m68k/gdbstub.c @@ -52,7 +52,7 @@ int m68k_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) CPUM68KState *env = cpu_env(cs); uint32_t tmp; - tmp = ldl_p(mem_buf); + tmp = ldl_be_p(mem_buf); if (n < 8) { /* D0-D7 */ diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 4c85badd5d3..9d3db8419de 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -57,15 +57,15 @@ static int cf_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n) if (n < 8) { float_status s; - env->fregs[n].d = float64_to_floatx80(ldq_p(mem_buf), &s); + env->fregs[n].d = float64_to_floatx80(ldq_be_p(mem_buf), &s); return 8; } switch (n) { case 8: /* fpcontrol */ - cpu_m68k_set_fpcr(env, ldl_p(mem_buf)); + cpu_m68k_set_fpcr(env, ldl_be_p(mem_buf)); return 4; case 9: /* fpstatus */ - env->fpsr = ldl_p(mem_buf); + env->fpsr = ldl_be_p(mem_buf); return 4; case 10: /* fpiar, not implemented */ return 4; @@ -107,10 +107,10 @@ static int m68k_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n) } switch (n) { case 8: /* fpcontrol */ - cpu_m68k_set_fpcr(env, ldl_p(mem_buf)); + cpu_m68k_set_fpcr(env, ldl_be_p(mem_buf)); return 4; case 9: /* fpstatus */ - cpu_m68k_set_fpsr(env, ldl_p(mem_buf)); + cpu_m68k_set_fpsr(env, ldl_be_p(mem_buf)); return 4; case 10: /* fpiar, not implemented */ return 4; From patchwork Fri Oct 4 16:30:35 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: 832762 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp872791wra; Fri, 4 Oct 2024 09:41:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUY2W3q+q/SCFNR7bfM6hg50fx3CdV76AjiRY43Z1E6etd93gNT+c+WXAdAhn0W4RemAq2w6Q==@linaro.org X-Google-Smtp-Source: AGHT+IFBQy/iB99exhyTGtjTmoTjASlmviY2aHrLeJ3zFJQDWg0D6zyYN9YTsRjtSOjn+BDJa3Ia X-Received: by 2002:a05:600c:21c4:b0:42c:af06:71b with SMTP id 5b1f17b1804b1-42f87e4e24amr16517725e9.28.1728060085896; Fri, 04 Oct 2024 09:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728060085; cv=none; d=google.com; s=arc-20240605; b=FLeDxD0SNkv3A/0Z6KMpdfdW9+ZulxesOC5ctOd5rvPgsXUzJYHpTgxm9NbU19OCPe ykr84oaqxV9wRboVjo1BABZWoJ8nNbM1tDREBS+ZnBAcQvrz1OvW3XQLZ3dgnmEojO73 HJmqFF/2agqdZtVey8PmGv+VLq3Iaz43yf54ZMGoy//zdMSkLny88dmNnfSrymZttW2K qIF8lqhllQJjMM6l2E88xdMv6uTLNB9sHhZIRk4XKLYqbs4o/iQpebQLd6K04DAPgOGo oqvRX/JuC9gBXhJW6HuKI/8vstPiDv8yUpxpXoFu5/qUeALJtH5zGBcpauAy+62YOkBF PV/g== 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=6M7F9MlipNOYzrQaom9GAgFYoDMLlj7tvvuZZcP6m74=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=IqtLW9oNudT2x8nyQ1YxQ5WmHILlQ3tEUrfxb33RMKgoY9TXuMB04XTzaM6iV3ghPz C6TwMc4A9qkr5awMP7XHXDdt7E8yUd61Le/RTn6AOhLzgYLJCRALvrWgPmtGkwpas5iT CmSmoWu3kqurfa2kI+VWmhEl7KVeSbbvYChuvFG73uJrvDbo/v9LwDaqjICe638yK2Su sOk/H1ub97O9ty1Gw6U3pl0wHLDOdAfXB6RBf7kw7v02XwPk617OoEAV0Lx4BzQtSxgQ skMmwLGDh5tQwbKvLaFrDMhrww/HHbZQLLPfeuppO6Y/36zC/XFCI36rEwqqr2FzYHf3 ODwQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZYz+7t0T; 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 ffacd0b85a97d-37d1695e9d1si17829f8f.443.2024.10.04.09.41.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:41:25 -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=ZYz+7t0T; 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 1swlJH-0005lp-U4; Fri, 04 Oct 2024 12:37:44 -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 1swlHN-00012F-N6 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:35:49 -0400 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlHE-0006XK-D4 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:35:39 -0400 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-5398e7dda5fso2436446e87.0 for ; Fri, 04 Oct 2024 09:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059733; x=1728664533; 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=6M7F9MlipNOYzrQaom9GAgFYoDMLlj7tvvuZZcP6m74=; b=ZYz+7t0TtaAPsYKGt8H5gHvKwveX6NZfEZcJ6CoTN2XjjBAEVW0dbDdjVtJVM9tBvV 1s4d/0gDwgYrY/3ObyVbCpuOSw0hHN74XeHcezXNRg81KqkL1m4MAjzugw2kMEsRrIUo 5FNqAuIkbZKIzQE/SN6FOxdcQ2M57zNE6mgtYMUQjFLFWSR/MtobeRWtv9K+PL+gHPdX ALGiA+QjQaRsXAJ58mbdEPerSo6Z3Ar79/LMMzv9jHSr93x+L4WdwUpPGyCaK1qet6vW mCpq1KKzu0Cuddb17ZQtox93HgIWcquQqjEuRa/882NwM9IiieYu/mHQ/zHL91z0frnB BJ8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059733; x=1728664533; 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=6M7F9MlipNOYzrQaom9GAgFYoDMLlj7tvvuZZcP6m74=; b=J1jVMBGKTP09vSVmjPq7H5OhKg9wghMyx83Seg+Q2TuNOXyO2206ft10Kh/T+IbvLe iXuqmkDX/+56lJzZGS8PBbAt5VtuLuSE/hWhnbixrGtEfvgm5+pL2KLW2Ow83Ta71DUN 8tZ/njeBWQwK/SU0pjNEHMfv2kixvMQMk7cl16Cin4z1IYup2foY9Ie/MzKlMFEazrQe bzM/M98BeTU77eb5mmvamp8bI3BpnwUw9S1Ii9pALL5g7FRv0VeKU3pfBJWqGS4Ebyiy H+JdhgqiB2hGLilxTOUOQpZRnfTFgxF0XitFKVcIbhkyVr1oaABbTfpvI3iCXa5iGA8c JVnQ== X-Gm-Message-State: AOJu0YxLNSqwiGwEP2ZUHptOoUJs63sxaVXyUh1kchn0iVP+AugIJEKH dGR9mYLGkoYBxbM83CpQXllHcHAy6QlEnNRkEjV0xU9zurSDqSWK3XVV6DlGE/22CPZcYQE+5fL 6QBoIQQ== X-Received: by 2002:a05:6512:1387:b0:539:955b:43d0 with SMTP id 2adb3069b0e04-539ab9d0ad2mr2091898e87.47.1728059733102; Fri, 04 Oct 2024 09:35:33 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539aff23e0bsm1307e87.243.2024.10.04.09.35.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:35:31 -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 19/25] hw/sparc: Use explicit big-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:35 -0300 Message-ID: <20241004163042.85922-20-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::132; envelope-from=philmd@linaro.org; helo=mail-lf1-x132.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 SPARC architecture uses big endianness. Directly use the big-endian LD/ST API. for a in uw w l q;do sed -i -e "s/ld${a}_p(/ld${a}_be_p(/" $(git grep -wlE '(ld|st)u?[wlq]_p' hw/sparc/);done Signed-off-by: Philippe Mathieu-Daudé --- hw/sparc/leon3.c | 42 +++++++++++++++++++++--------------------- hw/sparc/sun4m.c | 6 +++--- hw/sparc64/sun4u.c | 6 +++--- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index 6aaa04cb191..021b5070128 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -78,21 +78,21 @@ typedef struct ResetData { static uint32_t *gen_store_u32(uint32_t *code, hwaddr addr, uint32_t val) { - stl_p(code++, 0x82100000); /* mov %g0, %g1 */ - stl_p(code++, 0x84100000); /* mov %g0, %g2 */ - stl_p(code++, 0x03000000 + + stl_be_p(code++, 0x82100000); /* mov %g0, %g1 */ + stl_be_p(code++, 0x84100000); /* mov %g0, %g2 */ + stl_be_p(code++, 0x03000000 + extract32(addr, 10, 22)); /* sethi %hi(addr), %g1 */ - stl_p(code++, 0x82106000 + + stl_be_p(code++, 0x82106000 + extract32(addr, 0, 10)); /* or %g1, addr, %g1 */ - stl_p(code++, 0x05000000 + + stl_be_p(code++, 0x05000000 + extract32(val, 10, 22)); /* sethi %hi(val), %g2 */ - stl_p(code++, 0x8410a000 + + stl_be_p(code++, 0x8410a000 + extract32(val, 0, 10)); /* or %g2, val, %g2 */ - stl_p(code++, 0xc4204000); /* st %g2, [ %g1 ] */ + stl_be_p(code++, 0xc4204000); /* st %g2, [ %g1 ] */ return code; } @@ -112,13 +112,13 @@ static void write_bootloader(void *ptr, hwaddr kernel_addr) /* If we are running on a secondary CPU, jump directly to the kernel. */ - stl_p(p++, 0x85444000); /* rd %asr17, %g2 */ - stl_p(p++, 0x8530a01c); /* srl %g2, 0x1c, %g2 */ - stl_p(p++, 0x80908000); /* tst %g2 */ + stl_be_p(p++, 0x85444000); /* rd %asr17, %g2 */ + stl_be_p(p++, 0x8530a01c); /* srl %g2, 0x1c, %g2 */ + stl_be_p(p++, 0x80908000); /* tst %g2 */ /* Filled below. */ sec_cpu_branch_p = p; - stl_p(p++, 0x0BADC0DE); /* bne xxx */ - stl_p(p++, 0x01000000); /* nop */ + stl_be_p(p++, 0x0BADC0DE); /* bne xxx */ + stl_be_p(p++, 0x01000000); /* nop */ /* Initialize the UARTs */ /* *UART_CONTROL = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE; */ @@ -133,17 +133,17 @@ static void write_bootloader(void *ptr, hwaddr kernel_addr) p = gen_store_u32(p, 0x80000318, 3); /* Now, the relative branch above can be computed. */ - stl_p(sec_cpu_branch_p, 0x12800000 - + (p - sec_cpu_branch_p)); + stl_be_p(sec_cpu_branch_p, 0x12800000 + + (p - sec_cpu_branch_p)); /* JUMP to the entry point */ - stl_p(p++, 0x82100000); /* mov %g0, %g1 */ - stl_p(p++, 0x03000000 + extract32(kernel_addr, 10, 22)); - /* sethi %hi(kernel_addr), %g1 */ - stl_p(p++, 0x82106000 + extract32(kernel_addr, 0, 10)); - /* or kernel_addr, %g1 */ - stl_p(p++, 0x81c04000); /* jmp %g1 */ - stl_p(p++, 0x01000000); /* nop */ + stl_be_p(p++, 0x82100000); /* mov %g0, %g1 */ + stl_be_p(p++, 0x03000000 + extract32(kernel_addr, 10, 22)); + /* sethi %hi(kernel_addr), %g1 */ + stl_be_p(p++, 0x82106000 + extract32(kernel_addr, 0, 10)); + /* or kernel_addr, %g1 */ + stl_be_p(p++, 0x81c04000); /* jmp %g1 */ + stl_be_p(p++, 0x01000000); /* nop */ } static void leon3_cpu_reset(void *opaque) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index d52e6a7213f..f375f0d389b 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -271,9 +271,9 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename, if (*initrd_size > 0) { for (i = 0; i < 64 * TARGET_PAGE_SIZE; i += TARGET_PAGE_SIZE) { ptr = rom_ptr(KERNEL_LOAD_ADDR + i, 24); - if (ptr && ldl_p(ptr) == 0x48647253) { /* HdrS */ - stl_p(ptr + 16, INITRD_LOAD_ADDR); - stl_p(ptr + 20, *initrd_size); + if (ptr && ldl_be_p(ptr) == 0x48647253) { /* HdrS */ + stl_be_p(ptr + 16, INITRD_LOAD_ADDR); + stl_be_p(ptr + 20, *initrd_size); break; } } diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 4ece1ac1ffc..e591e5a741a 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -210,9 +210,9 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename, if (*initrd_size > 0) { for (i = 0; i < 64 * TARGET_PAGE_SIZE; i += TARGET_PAGE_SIZE) { ptr = rom_ptr(*kernel_addr + i, 32); - if (ptr && ldl_p(ptr + 8) == 0x48647253) { /* HdrS */ - stl_p(ptr + 24, *initrd_addr + *kernel_addr); - stl_p(ptr + 28, *initrd_size); + if (ptr && ldl_be_p(ptr + 8) == 0x48647253) { /* HdrS */ + stl_be_p(ptr + 24, *initrd_addr + *kernel_addr); + stl_be_p(ptr + 28, *initrd_size); break; } } From patchwork Fri Oct 4 16:30:36 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: 832759 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp872407wra; Fri, 4 Oct 2024 09:40:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVJoTsDysb9rdnScl/BvYiI09D60eScsUdcz9jAkDKAyzplWp4SPzjHsWK/GDnax2HXV3IrpQ==@linaro.org X-Google-Smtp-Source: AGHT+IH5a1x9KKYMjHJh1Pxw+sfTaY6X6g2RkmPh9+BFOD8aTI62U1kvnsbrDNNPrehuzrjR5qoa X-Received: by 2002:a2e:8488:0:b0:2f6:5fa7:2640 with SMTP id 38308e7fff4ca-2faf3d75bbbmr16569881fa.34.1728060027700; Fri, 04 Oct 2024 09:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728060027; cv=none; d=google.com; s=arc-20240605; b=V6ogMr8DrL/qrzA+/JGS/rGjW5oNS5/d03g1rVtCN0ZdIigyI3zdzg0G32/OUJy9FA 9mVJak2jJ1++WiOM+5qkEvmH0xYZRgYKTD/GODHNCkjAWA6+08aN8zgiHVoC3SaAicoc LcDX0T2fSJJlQzoMxFqZFveXt353Z7CUa8v949VTOa0YSmJr/PEJ44zS9OGFHnks4vRi GT2banwnDI2yY3ohz0e8M8XJrt+fiP43Y1eTLDhc/btYhc64TYtKgGW5LqVbDEO4mewA ogUJeLtrTOyg0VlUUWueheov0vF5th9eBiuJZpHl18vRZd9lQo/Htf+rzuX1OoyQwifL 4KTA== 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=hBcEgRLUs4YPVNfRAPRCJw9z4l7rdD9SQBWLJrOyEBM=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=DnIpiSUp4JP4qTahL0QlJnTRBFE3UfAoj31deC/RzUvqvmhOJgzv5Rz2xp3Rti/z5t qL0n5c25EKI1i3+EJxJTu1nI1HiuOVEkL6fw9F9ij0+nc3hwD9VsUCXVJ1b8t4GhkfL2 KmgQSzQ+v1r9RziMVG53iAGr8lU5tQ6g2tH+h/SBEIOymkhmRw0B7M8VZN1Kb6KtCqsB ROk8J5w3bhvryuPUPlMbi/SXxBKSoMN9WKLRP6bD4OTo0WcwGIqDy0xzNx52WdmVdQhr olOSCb0ROj4pii4jWjGtbZdome15QxArolV9elD0/1wQELWlcs68CB6+kCyTYgw3cG98 TABg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NAqeAgM5; 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-5c8e060d00bsi51968a12.626.2024.10.04.09.40.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:40:27 -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=NAqeAgM5; 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 1swlJO-0006Lt-LA; Fri, 04 Oct 2024 12:37:50 -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 1swlHT-00018l-Cv for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:35:52 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlHR-0006ZT-Ck for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:35:51 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5398d171fa2so2884789e87.0 for ; Fri, 04 Oct 2024 09:35:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059746; x=1728664546; 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=hBcEgRLUs4YPVNfRAPRCJw9z4l7rdD9SQBWLJrOyEBM=; b=NAqeAgM5WLkAgc+qIO89u+x0Eky4qIE0QJ1oxky0egZsOUqSXFBRjbuXdPzf+TBHyL 83tgZOf9PKkSB3t4u0DT8AfsBd004WqiyLXKMYaqbn4bQOAjLRAWrBeDyntIYvYtqeJ3 u8fS5ZmaJGScSTxSUjYfPYqRqd7LN0e2QX0LLXZI9sMgYGqLcpJHgvz62sSDCLzHmnEO 0PtGaBB46KiVbegrp68sFIs3uHTO7LDOwLalDTahsYzfw7oeJQJgTecliN+nyj69WO9n tIpA5Mn09flysF+YGVs/HaRw3WB0e2V8P20S8eac6dAjUBP+jYfp6gsrglR7phLbmbZ2 WuDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059746; x=1728664546; 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=hBcEgRLUs4YPVNfRAPRCJw9z4l7rdD9SQBWLJrOyEBM=; b=IRNQ+MW48CFmJ6fZwxaIXqZ22LSk52icr79Qm7BKLklG8RnUGpA6jSOdM56Ia7si/8 5msNdNbLlx7pOQKCyOI3zrlhrC579gCSECwgyvdFmL57B8/upnsqE7xBcx1+IJrWJaX1 K8i7+sZsZ5235jgYV0I48ZO5mOvFjOuGC3qbYvjBZNi1ItaaYnjDvDyxvRfuwWRo2JWF vlAv3RQMCuhcKd3tS67n4h6sriwGKIwFDfeRPSgwpE7yRdhCisQxVLQ8EIamE4uUM1w1 kC6JMOVugaV5J7Yh2YBgqbXqKQM5egIkF0qwP33WKGyQdggb5qQ/dModELMG9ks4QF9j HCrw== X-Gm-Message-State: AOJu0Yxh2aNdjj52VMx2wDrkTx0wYPMOYeokgTPSW0Z49e43+BLGOhjC DCdVpL+Vfd/6eLd/8PfVBDGpg4sW5vvKwJEkpDe+U5LI3HwnS/18fTl45tFcaH2/VTWreqDgD/u IUYgHIg== X-Received: by 2002:a05:6512:3d87:b0:52e:9b9e:a6cb with SMTP id 2adb3069b0e04-539ab876cedmr2107733e87.15.1728059746062; Fri, 04 Oct 2024 09:35:46 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539aff23588sm1192e87.196.2024.10.04.09.35.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:35: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 20/25] target/sparc: Use explicit big-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:36 -0300 Message-ID: <20241004163042.85922-21-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::131; envelope-from=philmd@linaro.org; helo=mail-lf1-x131.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 SPARC architectures use big endianness. Directly use the big-endian LD/ST API. Mechanical change using: $ end=be; \ 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/sparc/); \ done Signed-off-by: Philippe Mathieu-Daudé --- target/sparc/gdbstub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/sparc/gdbstub.c b/target/sparc/gdbstub.c index ec0036e9ef6..6c82b7db8cf 100644 --- a/target/sparc/gdbstub.c +++ b/target/sparc/gdbstub.c @@ -110,11 +110,11 @@ int sparc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) #if defined(TARGET_ABI32) uint32_t tmp; - tmp = ldl_p(mem_buf); + tmp = ldl_be_p(mem_buf); #else target_ulong tmp; - tmp = ldtul_p(mem_buf); + tmp = ldtul_be_p(mem_buf); #endif if (n < 8) { @@ -165,7 +165,7 @@ int sparc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) #else else if (n < 64) { /* f0-f31 */ - tmp = ldl_p(mem_buf); + tmp = ldl_be_p(mem_buf); if (n & 1) { env->fpr[(n - 32) / 2].l.lower = tmp; } else { From patchwork Fri Oct 4 16:30:37 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: 832761 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp872687wra; Fri, 4 Oct 2024 09:41:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUIIwFB87ZXF0oUQNYVyng8iIx5Hvu6plrDbr7+NIN64ZYFLi7CjDgm7GuIxepF7wSDMC6lAg==@linaro.org X-Google-Smtp-Source: AGHT+IFk6r83UpaErMpjWEbth3l2NuWCjjjoXJ7DzEJ8ROP9/OoLxK7gICTHEaG+j24iEgctGUcb X-Received: by 2002:a05:600c:1c23:b0:42c:df67:1d35 with SMTP id 5b1f17b1804b1-42f85a6d7f3mr28918755e9.1.1728060070764; Fri, 04 Oct 2024 09:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728060070; cv=none; d=google.com; s=arc-20240605; b=WSMqPBIFR+fqYSUrsM5zsxVIS7XQSL+zGlMxFuuNd4sk8aQRpkbrnVNvHntGzsfcH9 gkF/5RwSwJAnOC6f71OGGW/r7QvTP/r1r5J9Mg5AvuoT8oRG2KwAhh4bxVdPJu4WAabl 5+7KD+g/N5pCaCEbKnUkbHe9T4y0X+HbWrOnReHeA0nLeZ9AzSJcV6Jyv4A0IO4pM1RM CS0VxLL9n0UIVTElACDaR0QsK3E4xoqZwF+QR4u7yKgKtihL9D+LeqppsUtZZntmfQQT MusXucL0PI46PJJVDMx6Zk9XlhtiFo+fbFagpQMNtCfLhhpJlq4N4IwJbH9J0pcJXxZQ bwpg== 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=OORWjVjOZFqIjyOcIzgstQ5I3F8E3+RG/c415FzxU5E=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=J1+uLl8G36OAfp3Qx+7TM5ZDmrqWzEgKoukid6WaiG6dbCwVTvTIngaT2T3xQsUh4/ cyc+IWblvNs3+Oi77GQIJFrbI2lkqopyDhaSjNDRNISgbDJkEsEKAPmRaUPbrowzNQ67 EmVoaZ/NlyKq8p6b64u8HRqKEQF072WvGaxK8Qp6nW+l/obWB3+5mPFI2Wz86RoWZpBJ DrRHXaeMmGXCdFRzIOqMHpGaNsoc0AT1es04oEo7IJ6f8+mU6+hBiv9P+2zQDoRc4J3k MQp2DYBrfy9UVC34vIvCAl4DLg2cnWJKvURKwDE3ll7b6HeHgS4+jSJWWW60BDQj+Ws5 3bkg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TyBD6zuk; 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 ffacd0b85a97d-37d16b98b18si13705f8f.1040.2024.10.04.09.41.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:41:10 -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=TyBD6zuk; 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 1swlIr-0002p3-F9; Fri, 04 Oct 2024 12:37:17 -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 1swlHh-0001Kc-Un for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:36:09 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlHe-0006b3-TW for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:36:05 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2fad100dd9eso26961711fa.3 for ; Fri, 04 Oct 2024 09:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059761; x=1728664561; 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=OORWjVjOZFqIjyOcIzgstQ5I3F8E3+RG/c415FzxU5E=; b=TyBD6zukJ3Kij6T6j4InFLVBuqL1a3MAlIXxjuTQxV+6Zu/i5pii/71GF6SuoJ+gHs 6QMFLfe50P5cywZ3AfnS0b3MrU/zpe4boKYgyuQCLnhZ86zQDyUopGvPTempbvuTtX3u yGoHsb/NMoF7QWg0nrtr8sgTIQMqwDljtbUZkA1CWOe6mBliX7MDXl0mhwuffiatMGsy Gp0TqnRmuZWfmz3dtoIYm8KsW21lMB1QrvmvvYFN0qEXcXfkBwVBscjRcZ7/SFIFj+e5 gAtkaxlPV5eyFdzv75CRKZMoZmWUeB3q86j4plAg9j1L4r/gP8E6dgH9XNs+Nz2Nm4zO 3RQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059761; x=1728664561; 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=OORWjVjOZFqIjyOcIzgstQ5I3F8E3+RG/c415FzxU5E=; b=X/ur9Y0RuVSfMcEM2GTCwL8yFDVdeZydpWTkKWJiiF+uN1wuR/INrGZiBdxBgxIxXW /wgT/68GuTc60B7Sq+EgVKXC6nidO7/CB9pODa2pNpkj5Wf3waAb2RshQoIXiXKW8JJI vf1miI34CmcfWQdsaC0EMmXsmEI+YJdSZeAVJXkYSklRoKopG9rkLA6rPRfirjIhJQWZ wep0BHa+1VUAGEUkYTB66T1d2v2C87tKgFXLqz8y5ALiabaHCG56iRKJUV4CVa/RxUJs Pjp0I8+oJ5QpbzSNH079bjxEeY2GVYdf9m03xK/gmBBocfqZfVZWqDTqhe+JZbY/fsOp VgmA== X-Gm-Message-State: AOJu0YxTlcj3fZHWLKNRVNuBJdMSWeKdudYtcrydEtsIuE5bbH/BTZN/ VjWPM/bdGXmtFa/kqePTg8mZN344+Mdpu6Q8kq7Fn1Oeot2+FSZvWhmEhdjIRMRQm4xWzpDEk0/ 7Xl/RTQ== X-Received: by 2002:a2e:a543:0:b0:2fa:c5b0:3994 with SMTP id 38308e7fff4ca-2faf3c60358mr21419471fa.13.1728059760737; Fri, 04 Oct 2024 09:36:00 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9b336c3sm214031fa.113.2024.10.04.09.35.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:35:59 -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 21/25] target/hppa: Use explicit big-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:37 -0300 Message-ID: <20241004163042.85922-22-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::22e; envelope-from=philmd@linaro.org; helo=mail-lj1-x22e.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 HPPA architecture uses big endianness. Directly use the big-endian LD/ST API. Mechanical change using: $ end=be; \ 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/hppa/); \ done Signed-off-by: Philippe Mathieu-Daudé --- target/hppa/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/hppa/gdbstub.c b/target/hppa/gdbstub.c index 0daa52f7af2..537d0d2dfff 100644 --- a/target/hppa/gdbstub.c +++ b/target/hppa/gdbstub.c @@ -150,7 +150,7 @@ int hppa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { CPUHPPAState *env = cpu_env(cs); - uint32_t val = ldl_p(mem_buf); + uint32_t val = ldl_be_p(mem_buf); switch (n) { case 0: From patchwork Fri Oct 4 16:30:38 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: 832757 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp871458wra; Fri, 4 Oct 2024 09:38:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVXc51TJ88UY2M8p1gZKpL7HcDh5QJisqJz7h6dN8wG81M/NiaNdJrgT8pLRbosAlq2bTTRDQ==@linaro.org X-Google-Smtp-Source: AGHT+IH7RSlbd6jITloKIkI5VNiJhpbzWtXIS8xGwe7KxxbIw+jQF66JqbL72Gmb1/UO+WgmaSrp X-Received: by 2002:a05:600c:19d2:b0:42c:bae0:f066 with SMTP id 5b1f17b1804b1-42f85aa72f6mr25293615e9.13.1728059893314; Fri, 04 Oct 2024 09:38:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728059893; cv=none; d=google.com; s=arc-20240605; b=Y9LSFi17pdAa6PLD10p/79NYsBpX6yv2m0J2bw3tnxLSl+xgV+k651ZYsEzeuQeJ9Y 6POgMkDZVXkqt8sB+Lox5nzKdNY9sRsRbpvxLVDC0pHHaNwiZqOz5317t4NhvK6UpRty 2SXOMnWguIePkrQNnjGKCydOHuAMTe30v6JVDX7wHkWl7wW8Jv0vsN57df1wgLrk2Jet DrbR02KR2oA50uSDVDNpdOsSfPZMq30j7yqpRRyCOnv4MRq4egcVzKAxcPjfeSAMPdeT PQNj1pbKOnlxgal4lMVIPgGWbZjyIWI+E2+VQcBywFf9pAWw3JFfbPc/xXAqB9aPS0Dq 6MSg== 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=X8sRbzp8Sb06kpJ58T7p1q2wLwhmxDezE8ovGt3QAms=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=H2R6x5lwhtnQWJcHMNJP+pV0S2k47Zyu0FYqNCKMuzfXnpMFFPiU3hU4uu2a06h+tY thpVuAg1lBMHy8VwuqeBh/BJ8Ra2vbFA/nXxZL4ni+kwhUbZiSXBatjPuk3SqP5tvoq0 TmKUFfUervtpLoWNz4f97BwZEz78uyyzKavp4FZ+u+RL/pF0zmRVT0RwgbjtQBRQKsif BwUfW9CZ2v0TMYWjiag+xDf7VtauF9IIAqT0Bkn6mm9P3VOw9nfro9zjCUmO0Cl0wPWK koFJIf6f+xKEt0uikgSvM4FXpGe2H9Pmmnr6XAJuMdKDnzEVbnrY3NEtQSYjGO3cqAII lNAQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B5rA090v; 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 5b1f17b1804b1-42f86b49bd8si9083165e9.164.2024.10.04.09.38.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:38:13 -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=B5rA090v; 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 1swlJ6-00049o-Ic; Fri, 04 Oct 2024 12:37:32 -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 1swlI0-0001ep-Bt for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:36:27 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlHs-0006eh-Ee for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:36:20 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5399651d21aso2266965e87.3 for ; Fri, 04 Oct 2024 09:36:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059774; x=1728664574; 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=X8sRbzp8Sb06kpJ58T7p1q2wLwhmxDezE8ovGt3QAms=; b=B5rA090vVzw2ii4Gl1n/kpf0W6Jwd9i7cAUrCmFdToHrohcKcosfe6DjHrZ+xM6sBA PauUa9K7jf/SUY9DYbQJSlrlPQzp+g2eYR98KztqgdZCCNk7MTrqOQggjyZKpoVgxcLS hnet42xb+SoF2gtWNFQHh8qABtMQau3n1ZdiaZyD+v9okd7+HEpT8iePZLVIVKmxfiTP ohStaem7lOTzfrVrHWH1BP/PEjEgSo7L3OCE9DBqRPdLlIEJ3EjRcekhn8kANOsQEjq/ tMWfPPuvTkjdAJqYBO4wWj5m5GdFV5G9mXkRfIDaGgnaCfAPyKXjyhAvC1QMjRSoD0nd sVUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059774; x=1728664574; 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=X8sRbzp8Sb06kpJ58T7p1q2wLwhmxDezE8ovGt3QAms=; b=rn8zZDm78ZzFEb0DuKfiKtdUIV8EmDcVG/guKtPY8SbdYiqqBKeRyaEyN9NXVKw7/d +jABbVY4T045W4qyeMSGltZED+/l7y/bJMjULH21asfHqPmaLhCXojHdZ1v603Jy8boO ietNMP/tRSo7wK893vHZQfsYoCVJ+Fd6TlQajV5izNsLqbOqPkajflKI+8Tqpm+7Xd1Y CenAXy4QZqDsGhDqbsUq3QchI9QuLpY/boBKFZ1BhM9LETOcLp1RU0/FSh2LBbg9rflq 5T/fifV5bsCl92q9GYx6YxJgq4S/i/9+peGk7Mp3wiHlHJOG632h3rtQCeGveehLgLUl Rabw== X-Gm-Message-State: AOJu0Yyf6TemTkdbHY6EGxG6QHQeUtfdrgsvWsj9mNAyMnfwtikx34zN DlB7zGhe5eekdm0t42fWc8bbsjq5FV7Eh19miaNMsFIikJ7QT11NVW00yfqFPPiAiVJ+TdakVhk /l7hqWw== X-Received: by 2002:a05:6512:12d1:b0:539:94df:38e9 with SMTP id 2adb3069b0e04-539ab88af26mr2020980e87.31.1728059774064; Fri, 04 Oct 2024 09:36:14 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539afec107esm2712e87.6.2024.10.04.09.36.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:36:13 -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 22/25] hw/s390x: Use explicit big-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:38 -0300 Message-ID: <20241004163042.85922-23-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::12e; envelope-from=philmd@linaro.org; helo=mail-lf1-x12e.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 S390X architecture uses big endianness. Directly use the big-endian LD/ST API. Mechanical change using: $ end=be; \ 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' hw/s390x/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- hw/s390x/ipl.c | 4 +- hw/s390x/s390-pci-inst.c | 166 +++++++++++++++++++-------------------- 2 files changed, 85 insertions(+), 85 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index dd71689642b..5ab74339087 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -252,8 +252,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) */ romptr = rom_ptr(INITRD_PARM_START, 16); if (romptr) { - stq_p(romptr, initrd_offset); - stq_p(romptr + 1, initrd_size); + stq_be_p(romptr, initrd_offset); + stq_be_p(romptr + 1, initrd_size); } } } diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 30149546c08..41655082dac 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -55,26 +55,26 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc) uint64_t resume_token; rc = 0; - if (lduw_p(&rrb->request.hdr.len) != 32) { + if (lduw_be_p(&rrb->request.hdr.len) != 32) { res_code = CLP_RC_LEN; rc = -EINVAL; goto out; } - if ((ldl_p(&rrb->request.fmt) & CLP_MASK_FMT) != 0) { + if ((ldl_be_p(&rrb->request.fmt) & CLP_MASK_FMT) != 0) { res_code = CLP_RC_FMT; rc = -EINVAL; goto out; } - if ((ldl_p(&rrb->request.fmt) & ~CLP_MASK_FMT) != 0 || - ldq_p(&rrb->request.reserved1) != 0) { + if ((ldl_be_p(&rrb->request.fmt) & ~CLP_MASK_FMT) != 0 || + ldq_be_p(&rrb->request.reserved1) != 0) { res_code = CLP_RC_RESNOT0; rc = -EINVAL; goto out; } - resume_token = ldq_p(&rrb->request.resume_token); + resume_token = ldq_be_p(&rrb->request.resume_token); if (resume_token) { pbdev = s390_pci_find_dev_by_idx(s, resume_token); @@ -87,13 +87,13 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc) pbdev = s390_pci_find_next_avail_dev(s, NULL); } - if (lduw_p(&rrb->response.hdr.len) < 48) { + if (lduw_be_p(&rrb->response.hdr.len) < 48) { res_code = CLP_RC_8K; rc = -EINVAL; goto out; } - initial_l2 = lduw_p(&rrb->response.hdr.len); + initial_l2 = lduw_be_p(&rrb->response.hdr.len); if ((initial_l2 - LIST_PCI_HDR_LEN) % sizeof(ClpFhListEntry) != 0) { res_code = CLP_RC_LEN; @@ -102,33 +102,33 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc) goto out; } - stl_p(&rrb->response.fmt, 0); - stq_p(&rrb->response.reserved1, 0); - stl_p(&rrb->response.mdd, FH_MASK_SHM); - stw_p(&rrb->response.max_fn, PCI_MAX_FUNCTIONS); + stl_be_p(&rrb->response.fmt, 0); + stq_be_p(&rrb->response.reserved1, 0); + stl_be_p(&rrb->response.mdd, FH_MASK_SHM); + stw_be_p(&rrb->response.max_fn, PCI_MAX_FUNCTIONS); rrb->response.flags = UID_CHECKING_ENABLED; rrb->response.entry_size = sizeof(ClpFhListEntry); i = 0; g_l2 = LIST_PCI_HDR_LEN; while (g_l2 < initial_l2 && pbdev) { - stw_p(&rrb->response.fh_list[i].device_id, + stw_be_p(&rrb->response.fh_list[i].device_id, pci_get_word(pbdev->pdev->config + PCI_DEVICE_ID)); - stw_p(&rrb->response.fh_list[i].vendor_id, + stw_be_p(&rrb->response.fh_list[i].vendor_id, pci_get_word(pbdev->pdev->config + PCI_VENDOR_ID)); /* Ignore RESERVED devices. */ - stl_p(&rrb->response.fh_list[i].config, + stl_be_p(&rrb->response.fh_list[i].config, pbdev->state == ZPCI_FS_STANDBY ? 0 : 1 << 31); - stl_p(&rrb->response.fh_list[i].fid, pbdev->fid); - stl_p(&rrb->response.fh_list[i].fh, pbdev->fh); + stl_be_p(&rrb->response.fh_list[i].fid, pbdev->fid); + stl_be_p(&rrb->response.fh_list[i].fh, pbdev->fh); g_l2 += sizeof(ClpFhListEntry); /* Add endian check for DPRINTF? */ trace_s390_pci_list_entry(g_l2, - lduw_p(&rrb->response.fh_list[i].vendor_id), - lduw_p(&rrb->response.fh_list[i].device_id), - ldl_p(&rrb->response.fh_list[i].fid), - ldl_p(&rrb->response.fh_list[i].fh)); + lduw_be_p(&rrb->response.fh_list[i].vendor_id), + lduw_be_p(&rrb->response.fh_list[i].device_id), + ldl_be_p(&rrb->response.fh_list[i].fid), + ldl_be_p(&rrb->response.fh_list[i].fh)); pbdev = s390_pci_find_next_avail_dev(s, pbdev); i++; } @@ -138,13 +138,13 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc) } else { resume_token = pbdev->fh & FH_MASK_INDEX; } - stq_p(&rrb->response.resume_token, resume_token); - stw_p(&rrb->response.hdr.len, g_l2); - stw_p(&rrb->response.hdr.rsp, CLP_RC_OK); + stq_be_p(&rrb->response.resume_token, resume_token); + stw_be_p(&rrb->response.hdr.len, g_l2); + stw_be_p(&rrb->response.hdr.rsp, CLP_RC_OK); out: if (rc) { trace_s390_pci_list(rc); - stw_p(&rrb->response.hdr.rsp, res_code); + stw_be_p(&rrb->response.hdr.rsp, res_code); } return rc; } @@ -172,7 +172,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra) return 0; } reqh = (ClpReqHdr *)buffer; - req_len = lduw_p(&reqh->len); + req_len = lduw_be_p(&reqh->len); if (req_len < 16 || req_len > 8184 || (req_len % 8 != 0)) { s390_program_interrupt(env, PGM_OPERAND, ra); return 0; @@ -184,7 +184,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra) return 0; } resh = (ClpRspHdr *)(buffer + req_len); - res_len = lduw_p(&resh->len); + res_len = lduw_be_p(&resh->len); if (res_len < 8 || res_len > 8176 || (res_len % 8 != 0)) { s390_program_interrupt(env, PGM_OPERAND, ra); return 0; @@ -201,11 +201,11 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra) } if (req_len != 32) { - stw_p(&resh->rsp, CLP_RC_LEN); + stw_be_p(&resh->rsp, CLP_RC_LEN); goto out; } - switch (lduw_p(&reqh->cmd)) { + switch (lduw_be_p(&reqh->cmd)) { case CLP_LIST_PCI: { ClpReqRspListPci *rrb = (ClpReqRspListPci *)buffer; list_pci(rrb, &cc); @@ -215,9 +215,9 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra) ClpReqSetPci *reqsetpci = (ClpReqSetPci *)reqh; ClpRspSetPci *ressetpci = (ClpRspSetPci *)resh; - pbdev = s390_pci_find_dev_by_fh(s, ldl_p(&reqsetpci->fh)); + pbdev = s390_pci_find_dev_by_fh(s, ldl_be_p(&reqsetpci->fh)); if (!pbdev) { - stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FH); + stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FH); goto out; } @@ -225,17 +225,17 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra) case CLP_SET_ENABLE_PCI_FN: switch (reqsetpci->ndas) { case 0: - stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_DMAAS); + stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_DMAAS); goto out; case 1: break; default: - stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_RES); + stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_RES); goto out; } if (pbdev->fh & FH_MASK_ENABLE) { - stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP); + stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP); goto out; } @@ -249,29 +249,29 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra) /* Take this opportunity to make sure we are sync'd with host */ if (!s390_pci_get_host_fh(pbdev, &pbdev->fh) || !(pbdev->fh & FH_MASK_ENABLE)) { - stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FH); + stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FH); goto out; } } pbdev->fh |= FH_MASK_ENABLE; pbdev->state = ZPCI_FS_ENABLED; - stl_p(&ressetpci->fh, pbdev->fh); - stw_p(&ressetpci->hdr.rsp, CLP_RC_OK); + stl_be_p(&ressetpci->fh, pbdev->fh); + stw_be_p(&ressetpci->hdr.rsp, CLP_RC_OK); break; case CLP_SET_DISABLE_PCI_FN: if (!(pbdev->fh & FH_MASK_ENABLE)) { - stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP); + stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP); goto out; } device_cold_reset(DEVICE(pbdev)); pbdev->fh &= ~FH_MASK_ENABLE; pbdev->state = ZPCI_FS_DISABLED; - stl_p(&ressetpci->fh, pbdev->fh); - stw_p(&ressetpci->hdr.rsp, CLP_RC_OK); + stl_be_p(&ressetpci->fh, pbdev->fh); + stw_be_p(&ressetpci->hdr.rsp, CLP_RC_OK); break; default: trace_s390_pci_unknown("set-pci", reqsetpci->oc); - stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP); + stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP); break; } break; @@ -280,23 +280,23 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra) ClpReqQueryPci *reqquery = (ClpReqQueryPci *)reqh; ClpRspQueryPci *resquery = (ClpRspQueryPci *)resh; - pbdev = s390_pci_find_dev_by_fh(s, ldl_p(&reqquery->fh)); + pbdev = s390_pci_find_dev_by_fh(s, ldl_be_p(&reqquery->fh)); if (!pbdev) { - trace_s390_pci_nodev("query", ldl_p(&reqquery->fh)); - stw_p(&resquery->hdr.rsp, CLP_RC_SETPCIFN_FH); + trace_s390_pci_nodev("query", ldl_be_p(&reqquery->fh)); + stw_be_p(&resquery->hdr.rsp, CLP_RC_SETPCIFN_FH); goto out; } - stq_p(&resquery->sdma, pbdev->zpci_fn.sdma); - stq_p(&resquery->edma, pbdev->zpci_fn.edma); - stw_p(&resquery->pchid, pbdev->zpci_fn.pchid); - stw_p(&resquery->vfn, pbdev->zpci_fn.vfn); + stq_be_p(&resquery->sdma, pbdev->zpci_fn.sdma); + stq_be_p(&resquery->edma, pbdev->zpci_fn.edma); + stw_be_p(&resquery->pchid, pbdev->zpci_fn.pchid); + stw_be_p(&resquery->vfn, pbdev->zpci_fn.vfn); resquery->flags = pbdev->zpci_fn.flags; resquery->pfgid = pbdev->zpci_fn.pfgid; resquery->pft = pbdev->zpci_fn.pft; resquery->fmbl = pbdev->zpci_fn.fmbl; - stl_p(&resquery->fid, pbdev->zpci_fn.fid); - stl_p(&resquery->uid, pbdev->zpci_fn.uid); + stl_be_p(&resquery->fid, pbdev->zpci_fn.fid); + stl_be_p(&resquery->uid, pbdev->zpci_fn.uid); memcpy(resquery->pfip, pbdev->zpci_fn.pfip, CLP_PFIP_NR_SEGMENTS); memcpy(resquery->util_str, pbdev->zpci_fn.util_str, CLP_UTIL_STR_LEN); @@ -304,16 +304,16 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra) uint32_t data = pci_get_long(pbdev->pdev->config + PCI_BASE_ADDRESS_0 + (i * 4)); - stl_p(&resquery->bar[i], data); + stl_be_p(&resquery->bar[i], data); resquery->bar_size[i] = pbdev->pdev->io_regions[i].size ? ctz64(pbdev->pdev->io_regions[i].size) : 0; trace_s390_pci_bar(i, - ldl_p(&resquery->bar[i]), + ldl_be_p(&resquery->bar[i]), pbdev->pdev->io_regions[i].size, resquery->bar_size[i]); } - stw_p(&resquery->hdr.rsp, CLP_RC_OK); + stw_be_p(&resquery->hdr.rsp, CLP_RC_OK); break; } case CLP_QUERY_PCI_FNGRP: { @@ -326,23 +326,23 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra) if (!group) { /* We do not allow access to unknown groups */ /* The group must have been obtained with a vfio device */ - stw_p(&resgrp->hdr.rsp, CLP_RC_QUERYPCIFG_PFGID); + stw_be_p(&resgrp->hdr.rsp, CLP_RC_QUERYPCIFG_PFGID); goto out; } resgrp->fr = group->zpci_group.fr; - stq_p(&resgrp->dasm, group->zpci_group.dasm); - stq_p(&resgrp->msia, group->zpci_group.msia); - stw_p(&resgrp->mui, group->zpci_group.mui); - stw_p(&resgrp->i, group->zpci_group.i); - stw_p(&resgrp->maxstbl, group->zpci_group.maxstbl); + stq_be_p(&resgrp->dasm, group->zpci_group.dasm); + stq_be_p(&resgrp->msia, group->zpci_group.msia); + stw_be_p(&resgrp->mui, group->zpci_group.mui); + stw_be_p(&resgrp->i, group->zpci_group.i); + stw_be_p(&resgrp->maxstbl, group->zpci_group.maxstbl); resgrp->version = group->zpci_group.version; resgrp->dtsm = group->zpci_group.dtsm; - stw_p(&resgrp->hdr.rsp, CLP_RC_OK); + stw_be_p(&resgrp->hdr.rsp, CLP_RC_OK); break; } default: - trace_s390_pci_unknown("clp", lduw_p(&reqh->cmd)); - stw_p(&resh->rsp, CLP_RC_CMD); + trace_s390_pci_unknown("clp", lduw_be_p(&reqh->cmd)); + stw_be_p(&resh->rsp, CLP_RC_CMD); break; } @@ -914,7 +914,7 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr, for (i = 0; i < len / 8; i++) { result = memory_region_dispatch_write(mr, offset + i * 8, - ldq_p(buffer + i * 8), + ldq_be_p(buffer + i * 8), MO_64, MEMTXATTRS_UNSPECIFIED); if (result != MEMTX_OK) { s390_program_interrupt(env, PGM_OPERAND, ra); @@ -935,13 +935,13 @@ specification_error: static int reg_irqs(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib) { int ret, len; - uint8_t isc = FIB_DATA_ISC(ldl_p(&fib.data)); + uint8_t isc = FIB_DATA_ISC(ldl_be_p(&fib.data)); pbdev->routes.adapter.adapter_id = css_get_adapter_id( CSS_IO_ADAPTER_PCI, isc); - pbdev->summary_ind = get_indicator(ldq_p(&fib.aisb), sizeof(uint64_t)); - len = BITS_TO_LONGS(FIB_DATA_NOI(ldl_p(&fib.data))) * sizeof(unsigned long); - pbdev->indicator = get_indicator(ldq_p(&fib.aibv), len); + pbdev->summary_ind = get_indicator(ldq_be_p(&fib.aisb), sizeof(uint64_t)); + len = BITS_TO_LONGS(FIB_DATA_NOI(ldl_be_p(&fib.data))) * sizeof(unsigned long); + pbdev->indicator = get_indicator(ldq_be_p(&fib.aibv), len); ret = map_indicator(&pbdev->routes.adapter, pbdev->summary_ind); if (ret) { @@ -953,13 +953,13 @@ static int reg_irqs(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib) goto out; } - pbdev->routes.adapter.summary_addr = ldq_p(&fib.aisb); - pbdev->routes.adapter.summary_offset = FIB_DATA_AISBO(ldl_p(&fib.data)); - pbdev->routes.adapter.ind_addr = ldq_p(&fib.aibv); - pbdev->routes.adapter.ind_offset = FIB_DATA_AIBVO(ldl_p(&fib.data)); + pbdev->routes.adapter.summary_addr = ldq_be_p(&fib.aisb); + pbdev->routes.adapter.summary_offset = FIB_DATA_AISBO(ldl_be_p(&fib.data)); + pbdev->routes.adapter.ind_addr = ldq_be_p(&fib.aibv); + pbdev->routes.adapter.ind_offset = FIB_DATA_AIBVO(ldl_be_p(&fib.data)); pbdev->isc = isc; - pbdev->noi = FIB_DATA_NOI(ldl_p(&fib.data)); - pbdev->sum = FIB_DATA_SUM(ldl_p(&fib.data)); + pbdev->noi = FIB_DATA_NOI(ldl_be_p(&fib.data)); + pbdev->sum = FIB_DATA_SUM(ldl_be_p(&fib.data)); trace_s390_pci_irqs("register", pbdev->routes.adapter.adapter_id); return 0; @@ -994,9 +994,9 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib, uintptr_t ra) { S390PCIIOMMU *iommu = pbdev->iommu; - uint64_t pba = ldq_p(&fib.pba); - uint64_t pal = ldq_p(&fib.pal); - uint64_t g_iota = ldq_p(&fib.iota); + uint64_t pba = ldq_be_p(&fib.pba); + uint64_t pal = ldq_be_p(&fib.pal); + uint64_t g_iota = ldq_be_p(&fib.iota); uint8_t dt = (g_iota >> 2) & 0x7; uint8_t t = (g_iota >> 11) & 0x1; @@ -1289,7 +1289,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar, } break; case ZPCI_MOD_FC_SET_MEASURE: { - uint64_t fmb_addr = ldq_p(&fib.fmb_addr); + uint64_t fmb_addr = ldq_be_p(&fib.fmb_addr); if (fmb_addr & FMBK_MASK) { cc = ZPCI_PCI_LS_ERR; @@ -1399,17 +1399,17 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar, return 0; } - stq_p(&fib.pba, pbdev->iommu->pba); - stq_p(&fib.pal, pbdev->iommu->pal); - stq_p(&fib.iota, pbdev->iommu->g_iota); - stq_p(&fib.aibv, pbdev->routes.adapter.ind_addr); - stq_p(&fib.aisb, pbdev->routes.adapter.summary_addr); - stq_p(&fib.fmb_addr, pbdev->fmb_addr); + stq_be_p(&fib.pba, pbdev->iommu->pba); + stq_be_p(&fib.pal, pbdev->iommu->pal); + stq_be_p(&fib.iota, pbdev->iommu->g_iota); + stq_be_p(&fib.aibv, pbdev->routes.adapter.ind_addr); + stq_be_p(&fib.aisb, pbdev->routes.adapter.summary_addr); + stq_be_p(&fib.fmb_addr, pbdev->fmb_addr); data = ((uint32_t)pbdev->isc << 28) | ((uint32_t)pbdev->noi << 16) | ((uint32_t)pbdev->routes.adapter.ind_offset << 8) | ((uint32_t)pbdev->sum << 7) | pbdev->routes.adapter.summary_offset; - stl_p(&fib.data, data); + stl_be_p(&fib.data, data); out: if (s390_cpu_virt_mem_write(cpu, fiba, ar, (uint8_t *)&fib, sizeof(fib))) { From patchwork Fri Oct 4 16:30:39 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: 832760 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp872564wra; Fri, 4 Oct 2024 09:40:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU5jX0oo3Qs6TpGkguydMxnmodGXNrTz78HnX13gHIFstJDUjyRP3fPPQij6fVzr7wWErJkWA==@linaro.org X-Google-Smtp-Source: AGHT+IFkFbggWxAujXD/MGZi4zl6KA1M+OmSOr3ehBeTXaP23/0+7M53BBZZmhTQdUAYWoxl4pjq X-Received: by 2002:a5d:4408:0:b0:37c:d18e:6463 with SMTP id ffacd0b85a97d-37d0e8da581mr2908484f8f.47.1728060054498; Fri, 04 Oct 2024 09:40:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728060054; cv=none; d=google.com; s=arc-20240605; b=NXdEfK1JLXdzd7PpZSEYV2bQdhcQXpbE+7flKEDE1HV9qG2AgMwETrp2S+ufqWzvhC jaovvr59ectJly2g3ngkiKzfS96hAMUBwUEs1lMJtNcjgP5jWJxZtvuxggPL04PIN/cM a7FbA9BfAMvTB6cHwHHiWf43pJGKsrkKomwifMPcXaQ8aFEjNQu5RlD723Av7jqN3/rX DfJPFq8G/REo5o1C8brJsjCa5bvSIC2+C/WmHF4/RO7h7wXiB5OK8oGl3Bsr8YyHGRx5 8MEQXkXmNblK7flcmgSrKe9QOCkVS2akV68U0FuFnvwX7JCNsobijjdHxZs2AnaAxQhW MfKw== 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=NkIrQblPdREZDLEsszsFCn2NBix9iyMsfxXdICSQWJM=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=eu0oQxu+CTiNoA/Cp8js6713UbX/T3Xax+85dErpvnL4oB2jxqAAPsujixY0f1ZZLS 3m5rDyrvXQmLfvikV765XLR94wzdF3rgRUJIDFGemkc1tHpzuNYtK94i2MIOr2PTymlF M1DOzU2KsV0xZme7eTo5BHSiyS41I0nNqH0Y+Lu7lQ3VvAFzbyr+BbvFDmdD4kiEjkij e3ZxqJalCeEwbo6x0uzEHNf3QWrzML5ra6ISDcSL5MgHoE4hQnuNZZNxlyQwHxGW99KI pp1OeghvwaUKkfk4Lj70DcDUBwuJey6cJf91b5UmJzvlone+CslgGbfaNJKWuXyx+Xuu v8EQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pU3hSHe8; 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 ffacd0b85a97d-37d16b99255si13117f8f.1036.2024.10.04.09.40.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:40:54 -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=pU3hSHe8; 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 1swlJ9-0004gS-HQ; Fri, 04 Oct 2024 12:37:35 -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 1swlIE-0001p2-HA for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:36:40 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlI8-0006fr-Ho for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:36:36 -0400 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2fac6b3c220so34773751fa.2 for ; Fri, 04 Oct 2024 09:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059788; x=1728664588; 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=NkIrQblPdREZDLEsszsFCn2NBix9iyMsfxXdICSQWJM=; b=pU3hSHe8xnDOmzLEEnVMOeqmlNZu5cvpqCCCzAIYx/+ZufvQuam50aPZhDWuLLVP33 Stk21TgLBxz4vTM6lc3yZ50trFiWFqHl0939T8ZuUefKEDc6XkHQffnynuN1HRts9wPa hVinW0Y/jPQQi4rmEqNDRjtneo5yfoSq9H2EZL7bWelTb+uWxUgDxKWvMmOiXe5wIFrP GjzI6MJSJkZbDTW/DxEKBqpIjhOKcskaNlv7Uz1HTC9VJuTtQyK/MC7PNqa/lTxRaoJt ZLocksa57hTbJ9xl22NEmm58T7JR2+zNnv2qwGhuT4xPlXzgAiLgnUWT8SEyDmri8Q3C 2APA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059789; x=1728664589; 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=NkIrQblPdREZDLEsszsFCn2NBix9iyMsfxXdICSQWJM=; b=CkB9VobOzpldW+QXjyl8MSRwHj5KltA0PBeWvC8rPNBu2sQDtgWa0LARAXeIuI5ENm 8PjSPKbQe2dotkdt2XMdCLvtalcgh0UzNg+6HrSJKBYmsOlh22R0aam8rxM4dcj6Z2/M AyQ+GD+yKT92T4f9RBgNTqlnzseidugMqd0fWGdyrphoy/kyH0NDuCPnGnNUN3ERB9FW bhR86n49E44EjIaIOQ9KenU8JIP1WdUROGhWeVAINY46wDWyiKkRWjJoSU6DdvVAnKM5 z9AD86lZ05gfVcax2oqwJjX0cL98r5xNXNxkt+QaBdPoIuVFwOjdKYOTe3HKIO3MbKai 3qHA== X-Gm-Message-State: AOJu0Yxlh/KJLOoWBmNiBPlCzOeORz3Udromz80JTNmxsKUmRFoq2fpl efF4B/Sg/qUkSPB6NfH9KQQqMAn57z4408fIFnepNOqZ05P6QuEc4Tza/o/ZdQT/bIj753njIsJ 8XBdugg== X-Received: by 2002:a05:651c:b0b:b0:2fa:f5f9:4194 with SMTP id 38308e7fff4ca-2faf5f94416mr23634551fa.27.1728059788500; Fri, 04 Oct 2024 09:36:28 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9ac4415sm210841fa.34.2024.10.04.09.36.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:36:26 -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 23/25] target/s390x: Use explicit big-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:39 -0300 Message-ID: <20241004163042.85922-24-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::22f; envelope-from=philmd@linaro.org; helo=mail-lj1-x22f.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 S390X architecture uses big endianness. Directly use the big-endian LD/ST API. Mechanical change using: $ end=be; \ 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/s390x/); \ done Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- target/s390x/gdbstub.c | 34 +++++++++++++++++----------------- target/s390x/ioinst.c | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c index 9ffec0bccbc..63373f02cef 100644 --- a/target/s390x/gdbstub.c +++ b/target/s390x/gdbstub.c @@ -46,7 +46,7 @@ int s390_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { CPUS390XState *env = cpu_env(cs); - target_ulong tmpl = ldq_p(mem_buf); + target_ulong tmpl = ldq_be_p(mem_buf); switch (n) { case S390_PSWM_REGNUM: @@ -88,7 +88,7 @@ static int cpu_write_ac_reg(CPUState *cs, uint8_t *mem_buf, int n) switch (n) { case S390_A0_REGNUM ... S390_A15_REGNUM: - env->aregs[n] = ldl_p(mem_buf); + env->aregs[n] = ldl_be_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 4; default: @@ -123,10 +123,10 @@ static int cpu_write_fp_reg(CPUState *cs, uint8_t *mem_buf, int n) switch (n) { case S390_FPC_REGNUM: - env->fpc = ldl_p(mem_buf); + env->fpc = ldl_be_p(mem_buf); return 4; case S390_F0_REGNUM ... S390_F15_REGNUM: - *get_freg(env, n - S390_F0_REGNUM) = ldq_p(mem_buf); + *get_freg(env, n - S390_F0_REGNUM) = ldq_be_p(mem_buf); return 8; default: return 0; @@ -167,11 +167,11 @@ static int cpu_write_vreg(CPUState *cs, uint8_t *mem_buf, int n) switch (n) { case S390_V0L_REGNUM ... S390_V15L_REGNUM: - env->vregs[n][1] = ldq_p(mem_buf + 8); + env->vregs[n][1] = ldq_be_p(mem_buf + 8); return 8; case S390_V16_REGNUM ... S390_V31_REGNUM: - env->vregs[n][0] = ldq_p(mem_buf); - env->vregs[n][1] = ldq_p(mem_buf + 8); + env->vregs[n][0] = ldq_be_p(mem_buf); + env->vregs[n][1] = ldq_be_p(mem_buf + 8); return 16; default: return 0; @@ -203,7 +203,7 @@ static int cpu_write_c_reg(CPUState *cs, uint8_t *mem_buf, int n) switch (n) { case S390_C0_REGNUM ... S390_C15_REGNUM: - env->cregs[n] = ldq_p(mem_buf); + env->cregs[n] = ldq_be_p(mem_buf); if (tcg_enabled()) { tlb_flush(env_cpu(env)); } @@ -246,19 +246,19 @@ static int cpu_write_virt_reg(CPUState *cs, uint8_t *mem_buf, int n) switch (n) { case S390_VIRT_CKC_REGNUM: - env->ckc = ldq_p(mem_buf); + env->ckc = ldq_be_p(mem_buf); cpu_synchronize_post_init(cs); return 8; case S390_VIRT_CPUTM_REGNUM: - env->cputm = ldq_p(mem_buf); + env->cputm = ldq_be_p(mem_buf); cpu_synchronize_post_init(cs); return 8; case S390_VIRT_BEA_REGNUM: - env->gbea = ldq_p(mem_buf); + env->gbea = ldq_be_p(mem_buf); cpu_synchronize_post_init(cs); return 8; case S390_VIRT_PREFIX_REGNUM: - env->psa = ldq_p(mem_buf); + env->psa = ldq_be_p(mem_buf); cpu_synchronize_post_init(cs); return 8; default: @@ -298,19 +298,19 @@ static int cpu_write_virt_kvm_reg(CPUState *cs, uint8_t *mem_buf, int n) switch (n) { case S390_VIRT_KVM_PP_REGNUM: - env->pp = ldq_p(mem_buf); + env->pp = ldq_be_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 8; case S390_VIRT_KVM_PFT_REGNUM: - env->pfault_token = ldq_p(mem_buf); + env->pfault_token = ldq_be_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 8; case S390_VIRT_KVM_PFS_REGNUM: - env->pfault_select = ldq_p(mem_buf); + env->pfault_select = ldq_be_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 8; case S390_VIRT_KVM_PFC_REGNUM: - env->pfault_compare = ldq_p(mem_buf); + env->pfault_compare = ldq_be_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 8; default: @@ -338,7 +338,7 @@ static int cpu_write_gs_reg(CPUState *cs, uint8_t *mem_buf, int n) S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; - env->gscb[n] = ldq_p(mem_buf); + env->gscb[n] = ldq_be_p(mem_buf); cpu_synchronize_post_init(env_cpu(env)); return 8; } diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c index bbe45a497a8..a944f16c254 100644 --- a/target/s390x/ioinst.c +++ b/target/s390x/ioinst.c @@ -603,7 +603,7 @@ static int chsc_sei_nt2_have_event(void) #define CHSC_SEI_NT2 (1ULL << 61) static void ioinst_handle_chsc_sei(ChscReq *req, ChscResp *res) { - uint64_t selection_mask = ldq_p(&req->param1); + uint64_t selection_mask = ldq_be_p(&req->param1); uint8_t *res_flags = (uint8_t *)res->data; int have_event = 0; int have_more = 0; From patchwork Fri Oct 4 16:30:40 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: 832764 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp873084wra; Fri, 4 Oct 2024 09:42:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX3JqT2ZAVsOQUHX5MN2NYEfozeVijxp24ohz06/utHg2G5crsQLvigdeVGpaW+dVH9KxObCg==@linaro.org X-Google-Smtp-Source: AGHT+IEM3Q6xOepI88ecibAGzDuhlDCWSaayGx620eDeFECLdFUN+WNJ8tYH/8ust05MsA0H8wDX X-Received: by 2002:a05:651c:2110:b0:2fa:d75b:2ef5 with SMTP id 38308e7fff4ca-2faf3d70252mr27778651fa.32.1728060123059; Fri, 04 Oct 2024 09:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728060123; cv=none; d=google.com; s=arc-20240605; b=BYoPWPHb+UjmmYhuLHT4YSlGNB11vflmAMRl7d8EAsrmx3jY2HYzN6Gul0/1QZ+2DT 3XgC+uisla98BzIrC/RcYtoW5T1Z/5Y0dWQ9La6zRJgs6frlBq2NHS2qFpf/2958mgDQ XyVWgqt9kTIparCOBZrukRbea8xRB4+qUfxSLQihWt4qu3439Gtwb/W773MYuy5bd5Gl LA1G1Z1OpJGXSbcXHLKcmyrXyuOanm2NbtNinsXkM5flPim4eOTI7+Hc/zoipmZy66eO kXq3phf89OOI4fpFi5sgAEI5gGxUa0VWloygqbZDjatneEKpeHiatuPTy6ojhMak6Qi9 OZcQ== 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=0KcWyV0l74Ltt00k0SuMNwX9PI5KG07PSsGD0S0u9KA=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=HhONSmO1QwbMTlSXwmFr2JuGovpiqak1uRh+Mozc77PS0ZDZQd0AFPGDfK4hRYk6eg J8y3suyK4pxOzQCP/kO2v4Hkp7epi37J3YC4JKGEriyTVEi3J4fth8k3eX1nK3WU9NqX PBHh4yrAPbyhF+UeafQxuvV42GM5QfUzL2NriJkbBRf42xkEIrHhZfKzG6TOXfn7HHyd l/AeqK2lu7Vfe+scn/LJX7DTiHgnB6ohJHGFrKPYoHfxXx9KcRTzZV4QZOs4Q5+ipcne 2pBelKq/HqliWPPzvkDq3L/KsUeowOOLqa+OYWD3Qau6UWwBrtLk346zKxsBcD87iFY6 A1Ag==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gf2/F9Qb"; 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-5c8e060cd13si58061a12.633.2024.10.04.09.42.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:42:03 -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="gf2/F9Qb"; 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 1swlKB-0008BP-2h; Fri, 04 Oct 2024 12:38:40 -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 1swlIV-0002Dq-MA for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:36:56 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlIT-0006iU-2X for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:36:55 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2fad100dd9fso36948121fa.3 for ; Fri, 04 Oct 2024 09:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059802; x=1728664602; 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=0KcWyV0l74Ltt00k0SuMNwX9PI5KG07PSsGD0S0u9KA=; b=gf2/F9QbraxPaiXc1wQaBI1zwl4PbxhGiq4sIt+XqH4xA8fGrezjxjAL7zC3f9Ai+k psmiODmZV3aCRRIZW7MLfwukv/bHeqID4P8EHi3ErHb1xMSL3BIcdmBZIxx8Hp7sDQ2/ /19VjHW0RTYXdyUujLHGNYI9lKzuDhgtsW2tXku5d0j/DNCfMkyrUPnWKq01o06mjwD8 cic9kir4yO9o5oKr3dQ82zINlWZ1pxp0m6JGIWqaNxywQ67eOZNgjFCbhCK2fwJN6F0F X22sp2OnjkNV2WKi2YpCswQdAP7jkgiVf8Qwbv1Eh6r7zy/8dIsEhY4AYMDRWFX4r2f1 y+xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059802; x=1728664602; 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=0KcWyV0l74Ltt00k0SuMNwX9PI5KG07PSsGD0S0u9KA=; b=WnjRdPngoJ3L/es/taMzPUNI8L8NW0QvSo51DUjejIbJMzQCwi7mZoO/iypUbV0Hs9 WyPOESc4S2wV0sBAHnWfFbEpppqkuA4aV3pOjZqOhOc3UJUXq95utrupQXS5onIb1oOL qclbef/4UvAYFllnBuRwZWFpKfQ5+/4oinKs7xDYaJhP+eIUOBuFyGYcrkXVx6g0s2NG /e9SPE0I7o88cWGtNDtj25l8jDoUSUxBZWzj4bFt8Tok25uRvTHWDDdDTDl7a3GVnSGy QOfu00rV0dadBJGTTAdaD62gRxPix0T26xSGhGYD6xbeNJNJqWi+AYTuaBhyvR+im33Z JhIQ== X-Gm-Message-State: AOJu0YzjBXhUe907eCmPlL64WFHHgkvWVN5wNcvIhh1Y2rAx736UZ+hj /a03jSF+q1f+/0vtXScyEY5feINuA/xujVc/A05CM+zYoUXzBB7ZjeVaamEf+bxoR50CFo+b9qD IZk3wuQ== X-Received: by 2002:a05:651c:1545:b0:2f7:712d:d08 with SMTP id 38308e7fff4ca-2faf3c2978amr28480481fa.23.1728059802212; Fri, 04 Oct 2024 09:36:42 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9b248b3sm208721fa.75.2024.10.04.09.36.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:36:40 -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 24/25] target/openrisc: Use explicit big-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:40 -0300 Message-ID: <20241004163042.85922-25-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::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.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 OpenRISC architecture uses big endianness. Directly use the big-endian LD/ST API. Mechanical change using: $ end=be; \ 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/openrisc/); \ done Signed-off-by: Philippe Mathieu-Daudé --- target/openrisc/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/openrisc/gdbstub.c b/target/openrisc/gdbstub.c index c2a77d5d4d5..11f5c50423b 100644 --- a/target/openrisc/gdbstub.c +++ b/target/openrisc/gdbstub.c @@ -55,7 +55,7 @@ int openrisc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) return 0; } - tmp = ldl_p(mem_buf); + tmp = ldl_be_p(mem_buf); if (n < 32) { cpu_set_gpr(env, n, tmp); From patchwork Fri Oct 4 16:30:41 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: 832766 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp873729wra; Fri, 4 Oct 2024 09:43:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVy1twx3YmGXUntOKW4krBPgQD19JViKDe3UDzQjfKMdXXlMK8XdJGVQE2cpAvSSts8+DHhtQ==@linaro.org X-Google-Smtp-Source: AGHT+IEjoW21qWPsStESOYeUWdaorRFbuMJ9uMhkFN0rpygJCZ2JluLDfNkpNJP3qk4lXPEltRIa X-Received: by 2002:a05:6512:39c5:b0:539:972a:2360 with SMTP id 2adb3069b0e04-539ab9ed503mr2114421e87.55.1728060216579; Fri, 04 Oct 2024 09:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728060216; cv=none; d=google.com; s=arc-20240605; b=edZ905ebl7h7b7SyE15qK8wPKnaBDUjlP0TeMJjZDmeqnJEc68Tkd0Hrp+gN7H2yVM a1ADD/vV6vOk3dYwxyNmJSkm24i3bGlxgvUeHnH8jKJGc+GgauUY8QGJJW00iFi290Vj /ZAycqDf+woj21PgOX8xk0PDfathw/Gw89tIzMSxvTRuGaGJUCodIbrQRNH+OE8D/JNT 05NhKJimP0MHOV4RYs1wuXqIQP8SGXdEuQRaERz2UcaX+aWA/eZEARN0Xs/FWwDWj7Vz DtwesN8mHEz5jjL6Y5TJzZ+0WDtWlSj5r7Q0xqoldS4kEL8Fn1ec7vRsshSG67MfYEHp O1Hg== 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=/xxV2v0QPsMAJ2+RBFGZoSHYGXcFciUFYUOuAoIuqTc=; fh=Cyx8393Oz+CWhBBtvLnsw/Ha6TQ3OyuB9akIVJXTJlY=; b=KruokGBBspw8XZTmmXVDR5SC+zy/d5L3El9Jho1sKi6qbzPZyLbUZBbiRYktSCu8h/ 3a4lESdm2sw6UWwJw6GJ3QlM/hsY5U1G4gH82MQiOCqMzYnWncU8dTmn1NVN6+ojwx5R VtLNRnWKKeldQNjuSERpUHcl1ffCQs1YKzmaFax2GKSJlZAmbzqFzF+pMg54wy3rAPc1 flSccnBKzPLV38/9ErAr+wfJ7hGyi8lzRlRpnpi/nwEATgOS10CwA9jsN5sCIhUW2PZ1 rCHy0X3fuH2YjRlpw8iWasTx5TGc57cO+jo5h7frh7FuF8ShqKuB67VO/LHxQSiOF5dF Emnw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=adK7yN1l; 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 a640c23a62f3a-a992e57dae7si14968366b.5.2024.10.04.09.43.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2024 09:43:36 -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=adK7yN1l; 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 1swlKk-0000pU-7f; Fri, 04 Oct 2024 12:39: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 1swlIb-0002Sj-6A for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:37:02 -0400 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swlIY-0006jR-F3 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:37:00 -0400 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-539973829e7so2389776e87.0 for ; Fri, 04 Oct 2024 09:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059815; x=1728664615; 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=/xxV2v0QPsMAJ2+RBFGZoSHYGXcFciUFYUOuAoIuqTc=; b=adK7yN1lhJKKvrYX1L2gLziUONI67JzxOz/5mkmk7eUn3zM1jWnjquJOnpgmq0LG9r g55SaHF6U6oewVeaddLqPFJ68Tp3TmCeebZKcz/syghGEAZ5YxW9ZOMWrttEO4bx/5O6 nMtkgcK3LA/u8VzclZPAh5OEGjKCVqrBmbCyf4iWGSaH20abkFj4lky49Xd1Pbp68Cvx K7soQSFuubOFyx904xElv+6SZP3NlN95i/M7kLG+xeFXyY28OZMxq4Mxtlno1t86OajQ nEqhC5ZpLXj31lZYLQTuakjL7RZV+Pqr5lE+GDd28gFQg/FLS2IAzftArVokV9MV0GeT gIZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059815; x=1728664615; 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=/xxV2v0QPsMAJ2+RBFGZoSHYGXcFciUFYUOuAoIuqTc=; b=gLuVkPRinuyPFNmsMMB1Z0EMyma8xNvatzv88VAQ5IQWgoTx0S0dyu2OwObeuH4VFA WVaeUjceSD+jtDj1dAa0y90AYlSJPfOgupDZscgmYavk65LyNYUegRuv+0TXrfUb1vkZ s2X/g4uAHqp7X0EJnK7D9uHbvQ6BDRm8v2IhCrx9gMIs2xilylktNxxnBdXBKcxRdKXA 9RCV/l6vyNQiW/0K/mtZ2qDFOA9XvW546V3etCcmBjb+YLt5Qlvk3Btgak8LSGXU/gFD AxFjKRkkQFdRkYjicGLscQnRt+YJLNsbszCMzYmlhrPJsRg37GsFxCJiZbtWW/qLMzVr CF8g== X-Gm-Message-State: AOJu0YzaT00aNYmCb2jKIi6KoJdOkzrvgIg779HnuebDZjmhZmSMvAa/ blPLShX1I+n78ZoiVtfGhLY/LHwwTs79ybI/9y2qgyWs94xkjLo/ef2P1GdnzKXtE6yw27+SSdO 1iIgYQQ== X-Received: by 2002:ac2:4c49:0:b0:539:88ae:ded6 with SMTP id 2adb3069b0e04-539ab87e1ebmr2548554e87.35.1728059814899; Fri, 04 Oct 2024 09:36:54 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539aff235casm1392e87.226.2024.10.04.09.36.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:36:54 -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 25/25] hw/ppc/e500: Use explicit big-endian LD/ST API Date: Fri, 4 Oct 2024 13:30:41 -0300 Message-ID: <20241004163042.85922-26-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::12f; envelope-from=philmd@linaro.org; helo=mail-lf1-x12f.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 32-bit PPC architecture uses big endianness. Directly use the big-endian LD/ST API for the E500 hardware. Mechanical change using: $ end=be; \ 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' hw/*/*e500*); \ done Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/ppce500_spin.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c index e08739a443d..8e0ef9467e4 100644 --- a/hw/ppc/ppce500_spin.c +++ b/hw/ppc/ppce500_spin.c @@ -64,9 +64,9 @@ static void spin_reset(DeviceState *dev) for (i = 0; i < MAX_CPUS; i++) { SpinInfo *info = &s->spin[i]; - stl_p(&info->pir, i); - stq_p(&info->r3, i); - stq_p(&info->addr, 1); + stl_be_p(&info->pir, i); + stq_be_p(&info->r3, i); + stq_be_p(&info->addr, 1); } } @@ -96,9 +96,9 @@ static void spin_kick(CPUState *cs, run_on_cpu_data data) hwaddr map_start; cpu_synchronize_state(cs); - stl_p(&curspin->pir, env->spr[SPR_BOOKE_PIR]); - env->nip = ldq_p(&curspin->addr) & (map_size - 1); - env->gpr[3] = ldq_p(&curspin->r3); + stl_be_p(&curspin->pir, env->spr[SPR_BOOKE_PIR]); + env->nip = ldq_be_p(&curspin->addr) & (map_size - 1); + env->gpr[3] = ldq_be_p(&curspin->r3); env->gpr[4] = 0; env->gpr[5] = 0; env->gpr[6] = 0; @@ -106,7 +106,7 @@ static void spin_kick(CPUState *cs, run_on_cpu_data data) env->gpr[8] = 0; env->gpr[9] = 0; - map_start = ldq_p(&curspin->addr) & ~(map_size - 1); + map_start = ldq_be_p(&curspin->addr) & ~(map_size - 1); mmubooke_create_initial_mapping(env, 0, map_start, map_size); cs->halted = 0; @@ -141,14 +141,14 @@ static void spin_write(void *opaque, hwaddr addr, uint64_t value, stb_p(curspin_p, value); break; case 2: - stw_p(curspin_p, value); + stw_be_p(curspin_p, value); break; case 4: - stl_p(curspin_p, value); + stl_be_p(curspin_p, value); break; } - if (!(ldq_p(&curspin->addr) & 1)) { + if (!(ldq_be_p(&curspin->addr) & 1)) { /* run CPU */ run_on_cpu(cpu, spin_kick, RUN_ON_CPU_HOST_PTR(curspin)); } @@ -163,9 +163,9 @@ static uint64_t spin_read(void *opaque, hwaddr addr, unsigned len) case 1: return ldub_p(spin_p); case 2: - return lduw_p(spin_p); + return lduw_be_p(spin_p); case 4: - return ldl_p(spin_p); + return ldl_be_p(spin_p); default: hw_error("ppce500: unexpected %s with len = %u", __func__, len); }