From patchwork Mon Mar 24 10:21:31 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: 875751 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp2054587wrb; Mon, 24 Mar 2025 03:22:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVWSaIfM4KYUSiSy7KJYf8n0YVJTqdqtqyrcTmeBEHzgg0xbGQ5JM2MjSChnAyy0KyxsINTtw==@linaro.org X-Google-Smtp-Source: AGHT+IH58RVqfG+k62/gynLDN3coSMJbcMrWdYt1cE5VYmP+XrbQJtoc6FHbj+ZoIfmBi848R9Ek X-Received: by 2002:a05:620a:2949:b0:7c5:46e4:480b with SMTP id af79cd13be357-7c5ba16855fmr1549115385a.22.1742811752103; Mon, 24 Mar 2025 03:22:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742811752; cv=none; d=google.com; s=arc-20240605; b=K4yG/Ec9vKzR9DvslxzZLryqKNjwoRQEHLYMvtS627jlRuwL76g7qN2MHYGdh8AYml 2NWhVOfFbjvARTf2cozYUQ/cdAhN5oC0bE4d1eKXCRt2666M6ucENh6irBDTzimhEJjv Z23+RT/ccJv+lt+uY/1ffHEwXlGk9HzxGINQVAgtoSND6IpKadP+qJdqF5zSWuMDtvNN Po2zy4WeZEIXEHq/uU27k8q6cZUEPSdNphkjmAcGoJLgSZRl0bfQjukzr7Ypn7osCdlo CPo8GT3yvPxIxue5JY3oHXC4ZbcEHlGNKThXB+DTIsM46cX3qJfoLa1vMXpKKfszlqcD +VVA== 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=Yu8RlLKAJY774dQq/0UwJZZsh2CwMTMr9ikfsbGGuSA=; fh=VwvbTy/9FzhWBe/NUg5xFz7zi7QtkVebvdi5BcOpDn0=; b=F0l+HMfFQE7bNX9/46Xv5abdTLbqvkjCn6tSBoKVtWJyQbo2EmniNBVAIqYa7mZEKW LsU9OKzlBpSBE9nxLAXCmHHJmqpknyXPCZbjQwcx+0CSe9GfFIVXnhNp+QtnueU0B8aT aqfEQUwijIDdob1NLUUyLls8jCUWCuzeM0LvmLRTYHnBysWR5+1Y7yVzpfJYK98WJ5jf MKUkI8qR/O2YgrB4Ecpiq+kLbKEeAzwWbKFq5SmTrcoA8N0KuzoWjDhbeT9Li7xf+2FU qfAnhpEtJ0qCJe3vaAKDNG1fLyRGPotdrnT91TZad0PFIN/x18RTZDc1VSlhpiuQH9PC LNyw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f2rMd78v; 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 af79cd13be357-7c5b9347185si735295885a.219.2025.03.24.03.22.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Mar 2025 03:22: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=f2rMd78v; 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 1twewM-0002jg-B6; Mon, 24 Mar 2025 06:21:57 -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 1twewH-0002hd-Ha for qemu-devel@nongnu.org; Mon, 24 Mar 2025 06:21:49 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1twewE-0006yI-6o for qemu-devel@nongnu.org; Mon, 24 Mar 2025 06:21:48 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-aaf0f1adef8so746914966b.3 for ; Mon, 24 Mar 2025 03:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742811704; x=1743416504; 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=Yu8RlLKAJY774dQq/0UwJZZsh2CwMTMr9ikfsbGGuSA=; b=f2rMd78vq/SngrpuuUun7pwqGDClkKbDfLE7nYgsV5GceFhn6JqOr2OncW2Fc8WnYk KMWVapKdTdd8L/03Qc5Q8Ifm1VPi0jVS43t4lu33G5AyOEHEwPmZ6F2WneshtLcilTPj hGdmrpk24jFlQmdGSQL1rpWwxWLPTWeUnLU3QRfEQqjJEcF16ZsBAc7pxjX/4IxdV8/Y dK/2utVxFVuwWAR4pP8wSCYNVna4NIk8AZvpVCqGdPv55LRzXhCGk09rkdp7fsHl1ehb wYR7ZeLzUTGUVTcE74NkQobtFMxpsbD7iMZphYspjh/qZf+DMYoPcPu0nkz89IFpe6ic GwRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742811704; x=1743416504; 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=Yu8RlLKAJY774dQq/0UwJZZsh2CwMTMr9ikfsbGGuSA=; b=ZxLYWF+Ma9YlhTc0ZR0EUqXLOPlNbzBOoNRqjeNUa0B5iGHcz+iTabkZJZRcDJqJdP YwAMS1bgOcvyWW9rH1k9o7wnyVihu+2RD+xwHaA9bP3eFPhsPch3qNTSCYZr7nE31Hl9 xa6VAo8rQB0j6Jegc1ZRHdR7LBbXzzPP1lAzJgRPh3B+kZrqzLS/BN1PekUp/1mb/6Xi 4rl19AS4TZHfNmH2SBWfmSfKDi6YVjCE8GRAAf6yEuaDusB1ckvMot6dhWKMG0npVPEp LSCXCb/2m7HAgxNXIr7KzZavj+ihaaR8rHRs7lxcKnxRoUgqhHKPKz/I2UUNFnEx6QJo QyUw== X-Gm-Message-State: AOJu0YxA2RFdFlRxxw6OWAFrooLwdiUVGYBhvfiUOGtUqB0BG4V9NUGD /KdpWS3opiNsI8A1SvRq3X+hfEzhQgZYzSk26pv5gdcGSYvC3xFioprFfgVTajQ= X-Gm-Gg: ASbGncuSGBckhZvIWI1mYxhun0gUqCri4lTCQxt5S3HI3guHQdLBsKPUie/Cp1RyDyp tBRLA0m1FJLEDVuqhK1/2VYi+GJQd8iXNzbIgJaW6xQZiKjHYhXWUgNPvXy1nOsNzXhQk4P+ELt 542dUlGWsFTu8Jvv6cvzAIA3avz5zHcZQkvWATUVCmWm+qrEuJWTBZuRogLL+aBe5KzTjozURUo EX5fdbydLQK8lELCWFao903x+yX+teyhXafOTIxegoZPxGO8hpDypKwhDyaHl82ofGR87A7diav xNbblzTlvSHvwR7dSpCgjG8/msp7m2BU5SSjT322JdzRG7qCTKsXeJobbQ== X-Received: by 2002:a17:907:1b10:b0:ac3:c56c:26ca with SMTP id a640c23a62f3a-ac3f20f8556mr1332662766b.8.1742811703927; Mon, 24 Mar 2025 03:21:43 -0700 (PDT) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3efbdfcc7sm654291866b.146.2025.03.24.03.21.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Mar 2025 03:21:43 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 95AEB5F8B9; Mon, 24 Mar 2025 10:21:42 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Nicholas Piggin , "Edgar E. Iglesias" , Markus Armbruster , Akihiko Odaki , qemu-ppc@nongnu.org, Richard Henderson , Thomas Huth , David Gibson , Daniel Henrique Barboza , =?utf-8?q?Daniel_P=2E_Berr?= =?utf-8?q?ang=C3=A9?= , Ilya Leoshkevich , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Peter Maydell , qemu-s390x@nongnu.org, Wainer dos Santos Moschetta , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , David Hildenbrand , Pierrick Bouvier Subject: [PATCH v2 00/11] gdbstub: conversion to runtime endianess helpers Date: Mon, 24 Mar 2025 10:21:31 +0000 Message-Id: <20250324102142.67022-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::630; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x630.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 but I've spun out v2 for further discussion. In v2: - drop uint8_t casting and use void as C intended ;-) - add specific 32/64 bit helpers with type checking an assertion - various tweaks and fixes (see individual commits) 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 Bennée (11): include/exec: fix assert in size_memop include/gdbstub: fix include guard in commands.h gdbstub: assert earlier in handle_read_all_regs gdbstub: introduce target independent gdb register helper target/arm: convert 32 bit gdbstub to new helpers target/arm: convert 64 bit gdbstub to new helpers target/ppc: expand comment on FP/VMX/VSX access functions target/ppc: make ppc_maybe_bswap_register static target/ppc: convert gdbstub to new helpers target/microblaze: convert gdbstub to new helper include/gdbstub: add note to helpers.h include/exec/memop.h | 4 +- include/gdbstub/commands.h | 2 +- include/gdbstub/helpers.h | 4 +- include/gdbstub/registers.h | 55 ++++++++++ target/ppc/cpu.h | 8 +- gdbstub/gdbstub.c | 25 ++++- target/arm/gdbstub.c | 55 ++++++---- target/arm/gdbstub64.c | 53 ++++++---- target/microblaze/gdbstub.c | 49 ++++----- target/ppc/gdbstub.c | 197 ++++++++++++++++++++---------------- 10 files changed, 292 insertions(+), 160 deletions(-) create mode 100644 include/gdbstub/registers.h