From patchwork Tue Feb 21 22:52:26 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: 655394 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp371475wrb; Tue, 21 Feb 2023 14:57:22 -0800 (PST) X-Google-Smtp-Source: AK7set8NFEUcU+jF9cnbpByJqbWXDlVz8Y9nYDdwAWK/mcrNcsScoVf+k9Yhc+hRlvcDOdR/t5Lj X-Received: by 2002:ad4:4ee9:0:b0:56e:b690:9bc5 with SMTP id dv9-20020ad44ee9000000b0056eb6909bc5mr14583283qvb.19.1677020241871; Tue, 21 Feb 2023 14:57:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677020241; cv=none; d=google.com; s=arc-20160816; b=HunsCP0aDmyV71aPlZxUSq0XZ7OmX1BFUEkWfVUUFFEpgRUOtR4ab4DmJ0B7aKou7L gfpcfLQtQd23XjiMLSgFP9uV0pPxHNr4o1Tyt+4LEzxYpsCdv4kHxK6wE6Vzewf88TzP vFXPjEKF8n6wP5IrrhbDBm/LIn9/z+UzTVI96gBlGH1xiOA4ooCqx+9TSu77Qub4BTIi Amthggi75vKy7+VuKAnWLDX6+F+pHafRQzLwc+nt5KbgTcq1oG0TKgZEq3b3V8PBe2Cy brMy88dnnFiuSE7LahTA3hf2g92KEwc6l12aoFE/JON1bBrbFMlMvKm0NCZMSe9uNrwJ y5XQ== 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=kwGQxDNbuoIi381f9n/oIctldgRasmJRzr/HFVuEYZ4=; b=lcX/Bi2BAbdK5dWsoWRuboEePlu3pSRxDbDpG288bHpyarXHLQMkUFquwguAna1YT2 Mk0+EPN9wSfOOqLwbiwS9I8VoQCEc2NawjrMyNK9FEQP9iW/S3T59moAwunp3nCreHGJ 5P/fIHSdxlJrtcelwsy2H1ZPXMs9Xas5QJRrP2D3FnOBkDEHv+zUo2sAEfYjrfj9hMvR UEq2ibLXX7pdBOfuy0Tk/kOoGHFxb7U9CqyqfhR5+LLmqRNZuPZbujaTJCZ1D8/TOKMI dxXZIDDefC6ryf4eRjJGg7KAUswI3yWILD8PYRvVYK3skJ/SuCp9irXROaz+spJn3eoJ RAzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WOGWaTxs; 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 d11-20020a0cb2cb000000b0056c07f12377si7822412qvf.158.2023.02.21.14.57.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Feb 2023 14:57:21 -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=WOGWaTxs; 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 1pUbVR-0007l0-3S; Tue, 21 Feb 2023 17:53:05 -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 1pUbVH-0007Yo-AY for qemu-devel@nongnu.org; Tue, 21 Feb 2023 17:52:55 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUbV0-00048G-8p for qemu-devel@nongnu.org; Tue, 21 Feb 2023 17:52:55 -0500 Received: by mail-wm1-x333.google.com with SMTP id j2-20020a05600c1c0200b003e1e754657aso4837550wms.2 for ; Tue, 21 Feb 2023 14:52:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=kwGQxDNbuoIi381f9n/oIctldgRasmJRzr/HFVuEYZ4=; b=WOGWaTxsD5z/FKTBp7AP4/IyukZythRHjIn7qR2DlBu2+PmrvMgIF9DbpzdxsjTai8 DpR7VEQc70BXoQ1yqjOl0PPSIe6G5HNfmAcdsEeY+DcbhprsPPfngF6Yx/kOOtk+JUGC eRK0Ym7HupliogQpbpXfsAeFhakZh9/pmcm1Kqe9Xw1Y5eVPYTiX4kvmSnRswUcYqErA /aYFQoaXrkJ0yQ++vsshVzQxrAuglNPsBAP8hVL/6VWb+KH6uqhRfNCGt5IMCNrgikxF o3Dpj/b/ZHrF6Sr3ySIrvq+rzsjRC6ITYMduWwN/+oit8HEYfnwn22Ao7wkCER66ZR9V A0cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=kwGQxDNbuoIi381f9n/oIctldgRasmJRzr/HFVuEYZ4=; b=4jSu7m9S5WqWp2m0xVC3dZgFF1aMEw07KJEB9aKas5aRC0aoMwwHMWPe6B7dH6JtYO A0zulNtPMqKwqJYii4aG4xsgL6GDR0skkBh1et4uyMjdctt6N3faEjVQTc0FSzOa85EK /+cApnLG6L3GEW2Pla6WWRfrTi2D7vfd8QukGpsFDeUh1/GbJceurCGWTDAqEeC/p88i XU0iF5gsY/j5C0FJPLmcH6sW8LYDBRxrC3/9dhaQve7bHOxWkIZeUQ/7MsagkAJAo3M5 iCRnWl4LSdXqJEQGtAD1GqaMlp4TVwP1uqYSyUvGWWnuhy4roFP+oWSFixad012xZRDi If0Q== X-Gm-Message-State: AO0yUKU+QPfJalpDcMe8v7UlD0Pyx0nU+sQiuOM6OF5yEPpjnhsCNqVF 40v+5GfhggAKLPT01Mex0UZWxA== X-Received: by 2002:a05:600c:3088:b0:3d3:49db:9b25 with SMTP id g8-20020a05600c308800b003d349db9b25mr4947969wmn.26.1677019954695; Tue, 21 Feb 2023 14:52:34 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id q6-20020a05600c46c600b003dc47d458cdsm6451600wmo.15.2023.02.21.14.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 14:52:34 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 40D6A1FFD1; Tue, 21 Feb 2023 22:52:31 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, Yoshinori Sato , nicolas.eder@lauterbach.com, Stafford Horne , Daniel Henrique Barboza , Mahmoud Mandour , Taylor Simpson , mads@ynddal.dk, Marek Vasut , Artyom Tarasenko , Alistair Francis , qemu-ppc@nongnu.org, Yanan Wang , Sunil Muthuswamy , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Eduardo Habkost , Bin Meng , Bastian Koppelmann , Palmer Dabbelt , Marcel Apfelbaum , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Rolnik , Aleksandar Rikalo , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Aurelien Jarno , Xiaojuan Yang , Richard Henderson , Peter Maydell , Alexandre Iooss , Chris Wulff , Jiaxun Yang , David Gibson , "Edgar E. Iglesias" , Greg Kurz , David Hildenbrand , Song Gao , Ilya Leoshkevich , Max Filippov , Mark Cave-Ayland Subject: [PATCH v3 23/24] include: split target_long definition from cpu-defs Date: Tue, 21 Feb 2023 22:52:26 +0000 Message-Id: <20230221225227.3735319-24-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230221225227.3735319-1-alex.bennee@linaro.org> References: <20230221225227.3735319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x333.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=unavailable 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. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- include/exec/cpu-defs.h | 19 +---------------- include/exec/target_long.h | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 include/exec/target_long.h diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index 21309cf567..98605dfba2 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -58,24 +58,7 @@ # define TARGET_TB_PCREL 0 #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_ */