From patchwork Tue Mar 7 21:21:33 2023 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: 659872 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2609051wrb; Tue, 7 Mar 2023 13:32:17 -0800 (PST) X-Google-Smtp-Source: AK7set8Aezh8z7PvYYvKl8WQkOPyAFFRSl1wEoU3bqUDrK15p6NqneZiGAn61A49lPCbwKNsukf0 X-Received: by 2002:a05:622a:c2:b0:3b9:e0b2:9a47 with SMTP id p2-20020a05622a00c200b003b9e0b29a47mr26840625qtw.57.1678224736781; Tue, 07 Mar 2023 13:32:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678224736; cv=none; d=google.com; s=arc-20160816; b=ak7q5aLC1uCtoMEDq2BTJcpqPtMfd/hvIhfYBK3XYv2vzZANxSD6+DlbmqV4BKWWDZ ydPAJalNLuAbaS2yMD+8gypu/HZn+DenNlgppmfkjtdokThTWfpS0FusO1Kdv6Lbo28t lCWdN1gKAzu/Wa1WVLHJT3gveZPa61fqsMRXjIyi80GNlCViuXMaM/PJnOvrIzf+YmcE 4MMhbbdsNtwaYht/ok7MLwekUrcAM+qERXNf2dKvVHNRbMN/R2RLby56aYSSQSnv2is/ mQRXrS9D8MW6W+AMZobQtBq1ud2XacZfFXRkOQTxGeun1uhPvdjdVTsKIRpZvb7HyCG0 KBRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=10urY+DE/GoqkWZwAJl3fNjwNytocxqDh4m1t+x1+lQ=; b=WB6yqTNapwSqiiffoXCtkR6MCAazKrP14pQ4bJxO99KRFRE8Jag7+9haCDQ0lRJY/O V9pT9aGAo25od9dCEiMKoSSbViJSlWwTBTYY0MhlC4WslF/HWIR+yWQFQjsHvkEE4dRl sM2AkWIe3eTVabfJp1IwIPvFqCPz3oY/7iaUorXxPxM84xYMymyiJkrsQgABT2VPq2b9 iP5jE+tnyFt8+oRDYiwRwHDsgRfbSYr5WBMMsVJ0q/EmDkH+W75NxR7IcyDsuJtKeB33 bQXT8yIQEpsptBD0ZXisTi1QbgIMGQ8FVDifeX1Jfxhn6Q2i5c5KundMYil7mnsovP4j RBmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="mrMmT/0d"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h10-20020a05620a400a00b0073911cf01f9si12267802qko.705.2023.03.07.13.32.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Mar 2023 13:32:16 -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="mrMmT/0d"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZesD-0004jq-4m; Tue, 07 Mar 2023 16:29:29 -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 1pZesB-0004hi-7n for qemu-devel@nongnu.org; Tue, 07 Mar 2023 16:29:27 -0500 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 1pZes8-0000vg-9B for qemu-devel@nongnu.org; Tue, 07 Mar 2023 16:29:26 -0500 Received: by mail-wm1-x332.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso33708wmb.0 for ; Tue, 07 Mar 2023 13:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678224563; 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=10urY+DE/GoqkWZwAJl3fNjwNytocxqDh4m1t+x1+lQ=; b=mrMmT/0dV3Br+w/6jXbEeaw98I5qOhvJKOKoRqzWaLu4B2QybMIu7WGbrlESfPbBPp j04Dq8jtwg/bFJHX5jRsqj1nnD8xC8lXAf32IczobO0CRHB1naP/FV+B1rsSGjaF10Aa bes8NvNftnd4zXV5XqAaZSzYB6gKj1GEfpIkrbj8ui1tLoh3lMP/DXvVs1SjuUlDAeXX xxSZO7XHc6J9FkaerDKcjY0fY6P7dQUeOwWpsk4K1ITOF8iJde0cHqAD0UkLShn5e0LG PXrpi3i2Sdu2+cp5QAe34b/D/e283beZLtWq+pvB+pO1Yt4ACNpDk+G5cFBRtXmkSJyw vRLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678224563; 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=10urY+DE/GoqkWZwAJl3fNjwNytocxqDh4m1t+x1+lQ=; b=o4WkGBGoqp3A2LuN0Wh3u+747/fij+1gvYPP/5cZjja8D7x2l9oqAfOEH2lZftzWl2 nNfmklv6n5hxU4KJeTRYV7gaXEDjYEAxAes2sb1VTVL5TOU5r4D8sqPKwWNaOE7kKZbU Ojg2p05nsqu4IJzdxcuVDkvG1qEdqF8T5PgF07mWMKw5Szgyu8MGrxZaGXHe2VrvGcCz OBdH8VIMheQVud/A/OELZ+L3RP3bF3IVm2nq7aWBg8DH1fCrYmF5zg+00Fp3F9uAK5/e X6QKk2W71mK653PzN1hU4LJp1yaMjUt1J9bmme/DCC1IeL6oDZyCyCt2vSNtIni/+A50 2jyg== X-Gm-Message-State: AO0yUKWY5nQEk95bZ80iMnK9IKJXxyFSX/8kmq7tja+gWuyQnXrGJ8uI E5ixbuqixjDSCiCAf6aLfTIeag== X-Received: by 2002:a05:600c:c11:b0:3df:d431:cf64 with SMTP id fm17-20020a05600c0c1100b003dfd431cf64mr14246262wmb.39.1678224562946; Tue, 07 Mar 2023 13:29:22 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id v16-20020a05600c471000b003e9ded91c27sm19683660wmo.4.2023.03.07.13.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 13:29:21 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id CB0221FFCC; Tue, 7 Mar 2023 21:21:42 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini Subject: [PULL 24/30] include: split target_long definition from cpu-defs Date: Tue, 7 Mar 2023 21:21:33 +0000 Message-Id: <20230307212139.883112-25-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307212139.883112-1-alex.bennee@linaro.org> References: <20230307212139.883112-1-alex.bennee@linaro.org> 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 While we will continue to include this via cpu-defs it is useful to be able to define this separately for 32 and 64 bit versions of an otherwise target independent compilation unit. Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20230302190846.2593720-25-alex.bennee@linaro.org> Message-Id: <20230303025805.625589-25-richard.henderson@linaro.org> diff --git a/MAINTAINERS b/MAINTAINERS index 04857c71fa..f403619a84 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -137,6 +137,7 @@ F: docs/devel/tcg* F: include/exec/cpu*.h F: include/exec/exec-all.h F: include/exec/tb-flush.h +F: include/exec/target_long.h F: include/exec/helper*.h F: include/sysemu/cpus.h F: include/sysemu/tcg.h diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index be920d4208..cd8aa177cc 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -55,24 +55,7 @@ # endif #endif -#define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8) - -/* target_ulong is the type of a virtual address */ -#if TARGET_LONG_SIZE == 4 -typedef int32_t target_long; -typedef uint32_t target_ulong; -#define TARGET_FMT_lx "%08x" -#define TARGET_FMT_ld "%d" -#define TARGET_FMT_lu "%u" -#elif TARGET_LONG_SIZE == 8 -typedef int64_t target_long; -typedef uint64_t target_ulong; -#define TARGET_FMT_lx "%016" PRIx64 -#define TARGET_FMT_ld "%" PRId64 -#define TARGET_FMT_lu "%" PRIu64 -#else -#error TARGET_LONG_SIZE undefined -#endif +#include "exec/target_long.h" #if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG) diff --git a/include/exec/target_long.h b/include/exec/target_long.h new file mode 100644 index 0000000000..93c9472971 --- /dev/null +++ b/include/exec/target_long.h @@ -0,0 +1,42 @@ +/* + * Target Long Definitions + * + * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2023 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef _TARGET_LONG_H_ +#define _TARGET_LONG_H_ + +/* + * Usually this should only be included via cpu-defs.h however for + * certain cases where we want to build only two versions of a binary + * object we can include directly. However the build-system must + * ensure TARGET_LONG_BITS is defined directly. + */ +#ifndef TARGET_LONG_BITS +#error TARGET_LONG_BITS not defined +#endif + +#define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8) + +/* target_ulong is the type of a virtual address */ +#if TARGET_LONG_SIZE == 4 +typedef int32_t target_long; +typedef uint32_t target_ulong; +#define TARGET_FMT_lx "%08x" +#define TARGET_FMT_ld "%d" +#define TARGET_FMT_lu "%u" +#elif TARGET_LONG_SIZE == 8 +typedef int64_t target_long; +typedef uint64_t target_ulong; +#define TARGET_FMT_lx "%016" PRIx64 +#define TARGET_FMT_ld "%" PRId64 +#define TARGET_FMT_lu "%" PRIu64 +#else +#error TARGET_LONG_SIZE undefined +#endif + +#endif /* _TARGET_LONG_H_ */