From patchwork Sat Mar 8 07:23:47 2025 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: 871528 Delivered-To: patch@linaro.org Received: by 2002:a5d:64ce:0:b0:38f:210b:807b with SMTP id f14csp59403wri; Fri, 7 Mar 2025 23:24:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWgXZt6ZL/Q00DTtujULc/2YXVIp5a594qymvryAyAYXQ77VkdPXPHLGRe+gG/ZMlEBrBEQSA==@linaro.org X-Google-Smtp-Source: AGHT+IEoXiNIaPTmvEpcm7aUQsQwMgtG/8RX6USqyr9/VOKOjGoQnv5zYl0AFO5PcQ03ivXSvutu X-Received: by 2002:a05:620a:6504:b0:7c5:3ce4:7396 with SMTP id af79cd13be357-7c53ce473e5mr380236585a.48.1741418686492; Fri, 07 Mar 2025 23:24:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741418686; cv=none; d=google.com; s=arc-20240605; b=JJMjKDdXquB32BN0IQLYqP9gGxFLWeHaiokhEqZjTrlWrH9NKM5foo7FES3tGJ2wcH W95FBns3VQx23IBDYR/a/tdNG/HkPE1jOMSCn2WMZcYjBy+2Ul1ma7a2ZNPP/IRZr+yb CdgIO90feU87R5uzzuxt6/mx4Ld4TRtOBOJetlTZbPChTAaePhFNv7S/Rxp5Jxrz1VGk izlEEiXryrNFqJ0QNvfej2Dg/9iqqgR2kMjHseVh+uWzk/nAFkfbp6zxrYl2ly7booAF FT+YpqUTBNyCF7d4y3PBHBH291ffJDC+Y9ScITvdWKjHwnF+dkWpSmz4FdqabUYbrVK2 qqzQ== 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=K4eoVoXXRJyhwukYmalfs9jSQF5Wz6XN2stlsLIjFEk=; fh=pgRJImLGStw4JiZaQ8tZ6Gx4wEkoSwwNn1cV112GpBk=; b=aRdnAOoOpkh9VhrQZuNyPzgTanuQmGvD7NdgUcMAhuhN6oQZYT2FapWolZraqUq/EA 67pnPyNRE1EeZeSdKOuCdQq5KRKEZG3DyDayCL3wOK4TO6WkVcHsgIs7k0GVDNzePqny k0v7Gk+5BjrG4GqPAv6eUf9H6GgGgSBfWu4Q4HTxwijNw9Ip6lSBzoXM9ceBUsrDXy2Q Flx74b/lDaawUUSKLePR//S9V+LiqnjBocCetBLD/mj+3XHmBASTl2adCP4Fz772RgHN iNQYL5DaXTWPyZwnHKJMSpbpZdR1SUIxrX0PXvei28PiAzbufGmWZMk2Pqy1mkkz7S15 KNEg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kn749YMU; 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-7c53e74d9a5si88798585a.182.2025.03.07.23.24.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Mar 2025 23:24:46 -0800 (PST) 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=kn749YMU; 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 1tqoXc-0001P7-6e; Sat, 08 Mar 2025 02:24:12 -0500 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 1tqoXY-0001OC-CK for qemu-devel@nongnu.org; Sat, 08 Mar 2025 02:24:08 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tqoXV-0008Ky-4d for qemu-devel@nongnu.org; Sat, 08 Mar 2025 02:24:07 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-390e702d481so1328114f8f.1 for ; Fri, 07 Mar 2025 23:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741418643; x=1742023443; 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=K4eoVoXXRJyhwukYmalfs9jSQF5Wz6XN2stlsLIjFEk=; b=kn749YMUmwz3jGsx/x4pU+nfNzlrnZYvtz6WcHwuIjuef69DOOFF5k3UomkM2umEYE IASK3iSeA8lDfjT7JI24PE4fFyMonV0niFD98z50Av8sh16zGzXI+9lHIDagHSaxlbS2 NHJOv4fykr+B5J/qhKKgLufMqG4oGRZwZmKzTROKNLksVGBcMozQnFpuk+x0IfBhkRH1 gV8JGV6+Ln4Pb0QUAjSOoCi/WGSVUYZSGvy0pG+37sxegg5ybxdCQRsqbD7QTBXUvw2E B5xOctjY0tK+KjF77KcFbZsyC7wnJwDrtTU1u2xca7gJWuNPHNv7Dd8fP48y1DA9aD3p +WUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741418643; x=1742023443; 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=K4eoVoXXRJyhwukYmalfs9jSQF5Wz6XN2stlsLIjFEk=; b=mScnazM2nTnMNM/vGji6DWdYwweh42sHeV2aeqaBiA4DxoihzLluEgD3CndPKz5pOg AEq1+9oE2PpuKA0L4A8K53qGFhly0E8C0QYj6QWoCmqQ/0/+uwJF37PGznOSXwasrh0r znJ6FOmcC2YqlaNHL6h+HV61Sm2S70+TfLx2gSN7/iR6+Q5uPDwjslIZBNdRI1MoaWkt FCl2ZmcOusMcRp4unAI3+LqhI6gHUKzkGXTB09KHJPTjHCoBPNY7QdgaBZn+owFExwIZ MIF5mKWXaS+xZgfepjepNVEGleIZP38WEug2s3eykCLJ3pZm4dEotrC3q7LWmsqHDbV5 urYQ== X-Gm-Message-State: AOJu0YxVomhAPoLYQkjmXQ4AkR5hPDi5RmDVnpvXq0BogZJzfgx1VL1t kmzOmiO44pRgZCaVCeLg9n6q6Gj0eDH+C3w8wmp2y+8LaxdOO89sKBzEuIC61xVTW/ycss0tZhf SoSM= X-Gm-Gg: ASbGnctd+5isuCju1ymNmfrnLCwHXd7dfE5iSEQr9faOLYz7ZX1ie/PjdM1EEPssr3R bMoLGs95fQ/FT2+5HJrp88iadqAMdO/QqEPUCjMpr/qTwaVOETZ2nYidgjTr1+rh1FaoaLF0Lfa qmXb2G0wW24vPHstkTkCnA+hPJwI0cyKBgKqk4I/K5aLkWAX60yv9ZiZ3/VRrec+TVkyE59EB9K 0LQqkFCE0Egc62icLbysYong6UpU+6dslbJ9+DjCUYNWgY9i8yzYORLlE4zGS8NySzulOcYcvlr oSxYJVEiisAf0Za2Ad/OgeDZBWqApAxXMRcUWOmmOPJP06sI8RwIM5uEo0BITw+C9kP9sjFdVoz 4XFq8jOs8sBF1D4pxO8g= X-Received: by 2002:a5d:59a8:0:b0:390:f55b:ba94 with SMTP id ffacd0b85a97d-39132d31f55mr3956175f8f.13.1741418642739; Fri, 07 Mar 2025 23:24:02 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3912bfb7aefsm7793583f8f.20.2025.03.07.23.24.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 07 Mar 2025 23:24:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH v2 16/18] accel/tcg: Split out getpc.h Date: Sat, 8 Mar 2025 08:23:47 +0100 Message-ID: <20250308072348.65723-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250308072348.65723-1-philmd@linaro.org> References: <20250308072348.65723-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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 From: Richard Henderson Split out GETPC to a target-independent header. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier Signed-off-by: Philippe Mathieu-Daudé --- include/accel/tcg/getpc.h | 24 ++++++++++++++++++++++++ include/exec/exec-all.h | 11 ++--------- accel/tcg/tcg-runtime.c | 1 + 3 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 include/accel/tcg/getpc.h diff --git a/include/accel/tcg/getpc.h b/include/accel/tcg/getpc.h new file mode 100644 index 00000000000..4bb5f7b15cd --- /dev/null +++ b/include/accel/tcg/getpc.h @@ -0,0 +1,24 @@ +/* + * Get host pc for helper unwinding. + * + * Copyright (c) 2003 Fabrice Bellard + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef ACCEL_TCG_GETPC_H +#define ACCEL_TCG_GETPC_H + +#ifndef CONFIG_TCG +#error Can only include this header with TCG +#endif + +/* GETPC is the true target of the return instruction that we'll execute. */ +#if defined(CONFIG_TCG_INTERPRETER) +extern __thread uintptr_t tci_tb_ptr; +# define GETPC() tci_tb_ptr +#else +# define GETPC() \ + ((uintptr_t)__builtin_extract_return_addr(__builtin_return_address(0))) +#endif + +#endif /* HELPER_GETPC_H */ diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 2ac98e56c41..ce303de8486 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -29,6 +29,8 @@ #if defined(CONFIG_TCG) +#include "accel/tcg/getpc.h" + /** * probe_access: * @env: CPUArchState @@ -177,15 +179,6 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr); void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t last); void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr); -/* GETPC is the true target of the return instruction that we'll execute. */ -#if defined(CONFIG_TCG_INTERPRETER) -extern __thread uintptr_t tci_tb_ptr; -# define GETPC() tci_tb_ptr -#else -# define GETPC() \ - ((uintptr_t)__builtin_extract_return_addr(__builtin_return_address(0))) -#endif - #if !defined(CONFIG_USER_ONLY) /** diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 9fa539ad3d7..3d4651b4012 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -30,6 +30,7 @@ #include "disas/disas.h" #include "exec/log.h" #include "tcg/tcg.h" +#include "accel/tcg/getpc.h" #define HELPER_H "accel/tcg/tcg-runtime.h" #include "exec/helper-info.c.inc"