From nobody Fri Dec 19 17:53:10 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1747304883; cv=none; d=zohomail.com; s=zohoarc; b=BtcI/hfs5Gdz/ijam3UD4fRG8jFMVY/KLgZ74stXCLMWHdU5nPNl7xSNJ4wbFUld6q3S+9cwfOkdlcxXmq6CBaD+vIFO6JM5Rpc3OhVWdRZClxHIfGIv2HtZ3zp3ihNH6Q5We/vqt/r+FfQf2qUznGWvTGlzoL3IC3ZLzTva89M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747304883; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=JBwP4MINLJbGQNTaVfNpgXGCUDV61F8mAdNh5p7lyQQ=; b=DREW1b/zC2SW8/qfTB56eq0xFxl03FtXWeZ44GmH+a9w1ne2gQ74CJBTFWklqL6Fk9zFOFmCSs501bgIVvGAiEX0SQnleL44zTBXS9T2dHE8s3ha2Vh9e04TbnkQWdef8f4WgXu5cgbm1wB3MBZhpMHZS6Ihxax7ijEdkVGs8Lc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747304883661852.2398832191784; Thu, 15 May 2025 03:28:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uFVo9-00065E-U0; Thu, 15 May 2025 06:27:23 -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 1uFVnB-0004ot-Rz for qemu-devel@nongnu.org; Thu, 15 May 2025 06:26:21 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uFVn9-0008BE-Rz for qemu-devel@nongnu.org; Thu, 15 May 2025 06:26:21 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3a206845eadso427406f8f.3 for ; Thu, 15 May 2025 03:26:19 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442f396c3a4sm65657855e9.26.2025.05.15.03.26.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 May 2025 03:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1747304778; x=1747909578; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=JBwP4MINLJbGQNTaVfNpgXGCUDV61F8mAdNh5p7lyQQ=; b=PKsc4F5CRS4zcTDIm1s32VA3CEvfJAnm1cDEui6MQ/4cy7JWx3dUyeADSFcJDDw9HX U638S0wIleTnv0HYFvneL3nX/7C13k3x8cm98kwbwpUbrdEXBRU9sGl1y8YwdrdN+cXe hqff1fzB9OyboWw1pWXZHsr7zR5I8302vd+Erfaag5jgxZD6vX+stWMqJsMU9rAkc0K0 bZmkewarMAnwI0vr+FN4FmT11vXXq5okNX6eTgHLA0vf0t0fspBX5VjVwQvoZeTgoR6V JncSY+t+67ALMmzyoC5chGe2DrI7hP6CVtVq8Tlr+sL7XP7QV+f4aXGa/hfjukcVGkBK 4BaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747304778; x=1747909578; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JBwP4MINLJbGQNTaVfNpgXGCUDV61F8mAdNh5p7lyQQ=; b=Lxl3pF3YxNTK0a+aGYf4o6ocwF8FkoGUXo1T8DL7LrxyIiCxRNSXyH2o285DCE2mmF ZQdwKNqT2vKm1Rp7Cn2bvZkOQ/8S7nZCGjvUqP0qkojHQrp80uV3L7t5tn1shP95iDl3 TAEqJoYLxfxBiFVC+MHfcCl7Ia/YRlebo3S8YuggGr6LH/RjV5twLPBZtCguOHtezway rzUAcAXvpYHU9vCHgsB8jNLb+fGL9x9SHKU9L6PB5ik7WGIkZy9LducIdwxSO8hx9efs vggvIhWXqo/WlGUrfSmQLAW7n4fhygolEBGbNWJtXqQdpH9+jR/FT86XvT8IHra/MoIp kIzw== X-Gm-Message-State: AOJu0Yw9N5LQxw/Sd7J5B4M1MllNoOGBTUlSCNl4Cydf8cy591nGn87D ZdVI3re3E7EXLAschhApeGyVIkL0Jg8QJCQVq8mXGccUBnaSILXVPbg0l4P/9vgtywUTBApFcTj jdEU= X-Gm-Gg: ASbGnctpBFd3CcldbnZgglOg6j/FRcndOubiR9dhInib1HSkmQ0z4OVrJojSsG7LPfF AZ+8inCRbfedb7KE3tXedlDcGaC8gZJfy4lGIaf33V5St7KFXupsWYVgGhIq2EhrGESk1V2N4Dw 2tY2Chn/QlS/Ygy01mDYVwOPji5X+/fwVg5QXCodx+nI9TDLrhKPFvCbVzDW/oyLVpTaT/zUM0o pcWvxUvtulWn+5I/2CLUiyQcMvOLgSkGA4maAHmn40TIdVWxQDO32FRqBpjoKhsYtCv96ArHQv2 FqChsABFHKSPrF7jdMlWrZjvN+n7rXnt1JBXRVenQFnNP72CtHY2XFTSGPR7ZnAKlXO3 X-Google-Smtp-Source: AGHT+IGtOQlUXFzwrnfc12eEZhS72PYLuZHeqzaV60tY8lD4yR24nuiRcKt6AKL17Swek2FWbMVt1A== X-Received: by 2002:a5d:598f:0:b0:3a3:4a1a:de6f with SMTP id ffacd0b85a97d-3a353748601mr1742158f8f.26.1747304778277; Thu, 15 May 2025 03:26:18 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/58] tcg: add vaddr type for helpers Date: Thu, 15 May 2025 11:25:10 +0100 Message-ID: <20250515102546.2149601-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250515102546.2149601-1-peter.maydell@linaro.org> References: <20250515102546.2149601-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1747304885693116600 From: Pierrick Bouvier Defined as an alias of i32/i64 depending on host pointer size. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20250512180502.2395029-13-pierrick.bouvier@linaro.org Signed-off-by: Peter Maydell --- include/tcg/tcg-op-common.h | 1 + include/tcg/tcg.h | 14 ++++++++++++++ include/exec/helper-head.h.inc | 11 +++++++++++ tcg/tcg.c | 5 +++++ 4 files changed, 31 insertions(+) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index b439bdb385a..e1071adebf2 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -14,6 +14,7 @@ =20 TCGv_i32 tcg_constant_i32(int32_t val); TCGv_i64 tcg_constant_i64(int64_t val); +TCGv_vaddr tcg_constant_vaddr(uintptr_t val); TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val); TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t = val); =20 diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index a8c00c72cc8..3fa5a7aed2c 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -189,6 +189,7 @@ typedef tcg_target_ulong TCGArg; * TCGv_i64 : 64 bit integer type * TCGv_i128 : 128 bit integer type * TCGv_ptr : a host pointer type + * TCGv_vaddr: an integer type wide enough to hold a target pointer type * TCGv_vec : a host vector type; the exact size is not exposed to the CPU front-end code. * TCGv : an integer type the same size as target_ulong @@ -217,6 +218,14 @@ typedef struct TCGv_ptr_d *TCGv_ptr; typedef struct TCGv_vec_d *TCGv_vec; typedef TCGv_ptr TCGv_env; =20 +#if __SIZEOF_POINTER__ =3D=3D 4 +typedef TCGv_i32 TCGv_vaddr; +#elif __SIZEOF_POINTER__ =3D=3D 8 +typedef TCGv_i64 TCGv_vaddr; +#else +# error "sizeof pointer is different from {4,8}" +#endif /* __SIZEOF_POINTER__ */ + /* call flags */ /* Helper does not read globals (either directly or through an exception).= It implies TCG_CALL_NO_WRITE_GLOBALS. */ @@ -577,6 +586,11 @@ static inline TCGv_ptr temp_tcgv_ptr(TCGTemp *t) return (TCGv_ptr)temp_tcgv_i32(t); } =20 +static inline TCGv_vaddr temp_tcgv_vaddr(TCGTemp *t) +{ + return (TCGv_vaddr)temp_tcgv_i32(t); +} + static inline TCGv_vec temp_tcgv_vec(TCGTemp *t) { return (TCGv_vec)temp_tcgv_i32(t); diff --git a/include/exec/helper-head.h.inc b/include/exec/helper-head.h.inc index bce5db06ef3..5b248fd7138 100644 --- a/include/exec/helper-head.h.inc +++ b/include/exec/helper-head.h.inc @@ -58,6 +58,17 @@ # define dh_ctype_tl target_ulong #endif /* COMPILING_PER_TARGET */ =20 +#if __SIZEOF_POINTER__ =3D=3D 4 +# define dh_alias_vaddr i32 +# define dh_typecode_vaddr dh_typecode_i32 +#elif __SIZEOF_POINTER__ =3D=3D 8 +# define dh_alias_vaddr i64 +# define dh_typecode_vaddr dh_typecode_i64 +#else +# error "sizeof pointer is different from {4,8}" +#endif /* __SIZEOF_POINTER__ */ +# define dh_ctype_vaddr uintptr_t + /* We can't use glue() here because it falls foul of C preprocessor recursive expansion rules. */ #define dh_retvar_decl0_void void diff --git a/tcg/tcg.c b/tcg/tcg.c index 648333a9fb7..ae27a2607df 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2367,6 +2367,11 @@ TCGv_i64 tcg_constant_i64(int64_t val) return temp_tcgv_i64(tcg_constant_internal(TCG_TYPE_I64, val)); } =20 +TCGv_vaddr tcg_constant_vaddr(uintptr_t val) +{ + return temp_tcgv_vaddr(tcg_constant_internal(TCG_TYPE_PTR, val)); +} + TCGv_ptr tcg_constant_ptr_int(intptr_t val) { return temp_tcgv_ptr(tcg_constant_internal(TCG_TYPE_PTR, val)); --=20 2.43.0