From patchwork Wed Mar 19 18:22:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 874734 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a90:0:b0:38f:210b:807b with SMTP id s16csp550699wru; Wed, 19 Mar 2025 11:23:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUTHPp3uczYjCohD5Rcu8A/+Jy83FtEtw8d9eEbh7LHa3r0usKilBH1srni5X9w0+Gx9gN3hg==@linaro.org X-Google-Smtp-Source: AGHT+IHZpq8xdIo265fyrhoUGYe1CV2hAu/djo30AtYTmWpnMXba1gL+LVMnoXFaqHszqQfUlX/P X-Received: by 2002:a05:622a:2b4a:b0:476:9847:7c6e with SMTP id d75a77b69052e-4770834a7admr67425201cf.19.1742408599097; Wed, 19 Mar 2025 11:23:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742408599; cv=none; d=google.com; s=arc-20240605; b=HzX0QFGm6VgSKN+VehaFzt4QSd/EaGoS5BtPjEv3xvbDDXCbXBDtSS0ikWYSit34VD SULa2OQAmsETY1AKl8i6OGn1fnoNaNvGNM0RsQtHjJUsQUfLZ5R4s9JBK86BWcLP0pVL GmxxbpbIhEEYUl7RbMAC49aAXok9eR1sVATboAlKtdnt/7q4VBevPDYB7x8gktc9OAP/ 1Y+lWXjtGRWDnnzTjp1KcM/SnNo32DqdZ2NNUwzVBli6ldcohZ4RNVkNsKZGHY31DbZb xF+gi6QYeHQ9/KgVWevuH/r80kpqfkmUD5RcPpRJUs7KBoTQOzxADHW7374+cEpuCvFj U8MQ== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=xItThavxbz79L7NOidpyzs2tzBWqOmj6JZGfASxb4os=; fh=T52BgT3tuf9UvcX3m00r9EBGHnFXJV6qFB7GDz7WSU4=; b=kWEsmaWLSs3Ap8hwYvYGuiiPOkcH2NPmvtVY3ZaOSaPf2rU/iNA8Gw3cnOBnqSpnHu 92wSmEAjAaogdT/Qgobup9eNzSM1tSKhkl52BfU7HDFPmp2YDJhoJVoeQ0CYchbP9FWd U1h7YK56XgMv0L0le0TQi9cMm3luV4ZOttclUzjIHEi8RtOYiU5/pQIekkLqD2gzKyGo B669moZnp/VV3mXmbS8XHJBbx+LTdT8QsY6wUIAS8HmGkG22kxPFjyZiiHhu/VhPvJKK IyWOnSPyzD6SJEHHzMmQ9GVZznyobTxIK9IrDoNdgL+NkAawcmvpyUW25IYVdpjYULjq PGSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SscHJqBT; 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-476bb7df92csi147163691cf.216.2025.03.19.11.23.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Mar 2025 11:23:19 -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=SscHJqBT; 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 1tuy4K-0000Be-4l; Wed, 19 Mar 2025 14:23:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuy4E-0008Uq-U3 for qemu-devel@nongnu.org; Wed, 19 Mar 2025 14:23:03 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuy4B-0006Mg-9V for qemu-devel@nongnu.org; Wed, 19 Mar 2025 14:23:02 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43d04dc73b7so49877005e9.3 for ; Wed, 19 Mar 2025 11:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742408578; x=1743013378; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xItThavxbz79L7NOidpyzs2tzBWqOmj6JZGfASxb4os=; b=SscHJqBTBFWXdkeJwyb7PRP4rUqBd6duBxNtZQpSAT20TqQa4bRUCeJG7lliHPeYo9 J0kq8FU9jV0zPAg7GrqlqDGfiKnN69bh0db5772F2Noeb0JckM9sHHWE57sa69JyOdg7 EmMo3aDdliIyiXfxgIn6fdlOEtAepuZFKdJJlhKUNS1ayJ/PSfBZHV2k7DsUe1kBZ03q xzARHUJoOK9kDg7cv2YA0E6eVnpWH9xAB4NBFz52NEINHU+dsTP/Rgf0lf1XHlVW8yX0 uLZLAoa92pXn05sx7rz0PGeDmS9YUlydBGEz36Pjd84DgO998xxTsyZNPNf6jdch3CYD LHzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742408578; x=1743013378; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xItThavxbz79L7NOidpyzs2tzBWqOmj6JZGfASxb4os=; b=G/NLdvYztYdvpaUhXbo0f2xNe4+PDqBiTJEOBmIH9+wq2wY/MAT+QOff2myxc48fAs OaZGaL6hf4YWwSRTa3pdUQqV5IBZzqW1vYkoAG+p3IzX5sTCzb4sLJKf6mm10ApLGQYN uR4vdNiw3sybLHGyu746iSE/3EA4Ed63K/MtWjIDSLkAb0IV+S3K3dvcV0hTBTCCyd8U IuZsS0lMTvMw2YB864B/bZDBTQu3qxevuOrY7My1XJIxU7/JKMJQw5tU2d6Ctxsfy8la a/ZnrYEATW48KDGNa+1n7C9FQINprycMt9XovrWV+wxNfQHym5lryQrVQGlequn35mI4 WEmg== X-Gm-Message-State: AOJu0YwkvutOnOlkI4mUPOx+qvQyiZaIfmCji3Hf/zl0NgoB3XZZRvO8 nm0/x0Qg8Kx0Zod2+2JvWLbaGZZtlhOV7Q2ggvGroX3NLcphm+BIcgWBmx/GXUY= X-Gm-Gg: ASbGnctqeH/1c9iusDpMU0gAHlgrL6qQ9oqrVUNugWUYbM1FRDNNkAKdYQzHeXUSIIZ tsIS7qXENTURDZCJ1jbyt7ofbDrbDYEWyiCMobE86bNSq8QWrjAFjyvLyamtZHLfNhbBVt8IOfy u31pOj8oxMnDCIgG2EW2m+ckn0bYmyvEbirmKeYhpK8+jx2r6gG8+W8ryvdHtaGfekFbFwLUYK4 GNAGHTFMY/il1eDddUSqxM3BC9pLfJ4N6iSjVe6FG/cjhYH/nY37U4Z0HiYNVqSaFqNm7Ro9Ssz TQr5/9ijKsSVkZkw5/GZ98hpVFNIx5UNeQdT6QQjiHe8LQg= X-Received: by 2002:a05:600c:1906:b0:43d:2313:7b54 with SMTP id 5b1f17b1804b1-43d4950e273mr1767245e9.3.1742408577496; Wed, 19 Mar 2025 11:22:57 -0700 (PDT) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d43f32fcdsm26234845e9.7.2025.03.19.11.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Mar 2025 11:22:56 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 356E55F93F; Wed, 19 Mar 2025 18:22:55 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Juan Quintela , Ilya Leoshkevich , Thomas Huth , Akihiko Odaki , qemu-ppc@nongnu.org, David Gibson , qemu-s390x@nongnu.org, Wainer dos Santos Moschetta , Peter Xu , Markus Armbruster , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Daniel Henrique Barboza , David Hildenbrand , Yonggang Luo , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Beraldo Leal , qemu-arm@nongnu.org, Greg Kurz , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Paolo Bonzini , "Edgar E. Iglesias" Subject: [PATCH 00/10] gdbstub: conversion to runtime endianess helpers Date: Wed, 19 Mar 2025 18:22:45 +0000 Message-Id: <20250319182255.3096731-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.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 aim of this work is to get rid of the endian aware helpers in gdbstub/helpers.h which due to their use of tswap() mean target gdbstubs need to be built multiple times. While this series doesn't actually build each stub once it introduces a new helper - gdb_get_register_value() which takes a MemOp which can describe the current endian state of the system. This will be a lot easier to dynamically feed from a helper function. The most complex example is PPC which has a helper called ppc_maybe_bswap_register() which was doing this. This is still an RFC so I'm interested in feedback: - is the API sane - can we avoid lots of (uint8_t *) casting? - should we have a reverse helper for setting registers If this seems like the right approach I can have a go at more of the frontends later. There are a few other misc clean-ups I did on the way which might be worth cherry picking for 10.0 but I'll leave that up to maintainers. Alex. Alex Bennée (10): include/gdbstub: fix include guard in commands.h gdbstub: introduce target independent gdb register helper target/arm: convert 32 bit gdbstub to new helper target/arm: convert 64 bit gdbstub to new helper target/ppc: expand comment on FP/VMX/VSX access functions target/ppc: make ppc_maybe_bswap_register static target/ppc: convert gdbstub to new helper (!hacky) gdbstub: assert earlier in handle_read_all_regs include/exec: fix assert in size_memop target/microblaze: convert gdbstub to new helper include/exec/memop.h | 4 +- include/gdbstub/commands.h | 2 +- include/gdbstub/registers.h | 30 ++++++ target/ppc/cpu.h | 8 +- gdbstub/gdbstub.c | 24 ++++- target/arm/gdbstub.c | 57 +++++++---- target/arm/gdbstub64.c | 53 ++++++---- target/microblaze/gdbstub.c | 44 ++++---- target/ppc/gdbstub.c | 194 ++++++++++++++++++++---------------- 9 files changed, 257 insertions(+), 159 deletions(-) create mode 100644 include/gdbstub/registers.h