From patchwork Fri Mar 3 02:58:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 658465 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp226485wrb; Thu, 2 Mar 2023 19:01:51 -0800 (PST) X-Google-Smtp-Source: AK7set9vPP+bB6fOTuCskMmFgZmRUPOCKKbEfp6af+AJ1kqDOyzNXo6zggOUfABegbmJ00gic1UC X-Received: by 2002:ac8:5acd:0:b0:3bf:b896:ff72 with SMTP id d13-20020ac85acd000000b003bfb896ff72mr604098qtd.68.1677812511568; Thu, 02 Mar 2023 19:01:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677812511; cv=none; d=google.com; s=arc-20160816; b=SD3WnZK9yHraArofZJkHha9tDLLV7jiJENS/I/AW3sf9qJgmuWnMUYGY5wqrm9nBre ydTgTUShRltMkYxSYOHQXkI8LzocRd8vCOnP3wAf3n/Eghne/HoTvnWxlo4cGR45jY3u jzBnhwgNNDtqTFQ1F/MiVfEAP7/HRSLgByUFVcTvI7mvBiHj+y+lzKSfdr22iXncwLUe FgUB/TPt0BS43eAvpk0wAtGgja5tzN/VjsTt8fm0mvXhKQvtfZ5lJWw1ieYSbSCtFnqy Cj1IBE1Lt5B17OS9gOLs/F+w1ypI5EW9CMngaj6yv7Zn/uffLiJ9eHyouPSnst0mALCJ V9oA== 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=KRaITTDPU/D6klVb43sMtjcQy7hN+w0/N4+Vvipb27U=; b=I4tlilEIuR72l8N1GCYxspxp8+pZPWXqNlf3u3dUcvFBY2YcRxVWlk2JH+bjdS+8M8 by9V3083kUoP0iIfZLg1SuNhI/d/4nqkLAuAZ40lxB0FN7CJmzMfITHC46KfUgBj1653 XwuNNcBwRhQcAUw5BSGZYh3hquLraikUNCHvMQtRx4oyRdMdQCqCxbtG/6EhpX1sZBR7 9M/fgsl75Q2Irv+jT/j2w32xpzcQ512uAhHVyS6a8iC00O7lXrQV7+MroAZDxpZ207LA etYzG/0SzQ1IswgmbDJW9lG0lTQjet4A+89+zsurWXWDX8r9DzwWT3mTzrzy4ZxQOoGy cdww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gp+rIZIT; 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 l20-20020a05622a175400b003b86be9c604si1011149qtk.301.2023.03.02.19.01.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2023 19:01:51 -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=gp+rIZIT; 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 1pXvcu-0007cA-Cz; Thu, 02 Mar 2023 21:58:32 -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 1pXvcs-0007ax-J4 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 21:58:30 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0: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 1pXvcq-0001ta-Po for qemu-devel@nongnu.org; Thu, 02 Mar 2023 21:58:30 -0500 Received: by mail-pl1-x630.google.com with SMTP id n6so1349585plf.5 for ; Thu, 02 Mar 2023 18:58:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677812307; 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=KRaITTDPU/D6klVb43sMtjcQy7hN+w0/N4+Vvipb27U=; b=gp+rIZITTpoVxoZKl80/YVSUEdXSkc1kvrWIKz/5Jj9skHq5OWGrmscm6uuN8bP0bl 8QGo/BGPaPzvMeWWgzCz5HqzFPnMb9n9duFJ8uG/9LughwRXvI+lP5G7XMNAbTORHTnG MgH1W2fsbzZiPhmWvvYHgXp7jKC6U6kxfjB51N4Zh/iKuTd9aftisZOgZWdGfc6SqYbo mBSb0AX90zOLUAFyDKlHuNuFeF8HLy3/Gf5zLxY9PhbtIAX3dxUwQQ4mxKRKwWyTFjkn LtDP0OKRnSHhx8gph17UTIgE6YnEo2JKnil5Vn7jsJNO665/LaLfNIrI+6doporIpCUz M+Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677812307; 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=KRaITTDPU/D6klVb43sMtjcQy7hN+w0/N4+Vvipb27U=; b=2i1tWpDBdObyEtPi1mQtPRBWtFEy+ICeieYnvAh0/DMFU+X3MGG1wfPQHzZ7UsFFk2 UEj+kxtTzKrl5tSEccrkT32Ml5iuXLmYY82Ra1mdKuWHgA3zi+6JYEWPpj/101RhJXNU D1IB+exLLJQ0MBU2MqLkg/cVb86IgGx8/SNv29LBGnyHcUTQLjefzA8CcyfeF2J8rNsF KHJOFL75TXv+YDea0DHcjWkuKp90ADIPOwIo8mzK4gx/dN1zYtm75zxeCny+/QBqStPG h25Fr81VW28RRQ7knO6yzU/iuYjBsVHsebEQyKpK1raBqNbDbd/BLguV42ZW3ixEkzKC s5Wg== X-Gm-Message-State: AO0yUKWkILSFz8+JVpgLFAC419HuMBQvL6JfnFBOPu+QTUNPUrrbn5hI xOGlzSvUS5mJJ+XL2kq9IFnxaH6P3S7A4vzuzOw= X-Received: by 2002:a17:902:db01:b0:19b:c37:25e7 with SMTP id m1-20020a170902db0100b0019b0c3725e7mr431698plx.66.1677812307293; Thu, 02 Mar 2023 18:58:27 -0800 (PST) Received: from stoup.. ([2602:ae:154a:9f01:f3e6:4626:fbc8:b2ce]) by smtp.gmail.com with ESMTPSA id e4-20020a17090301c400b001992e74d055sm372244plh.12.2023.03.02.18.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 18:58:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org Subject: [PATCH v4.5 24/29] include: split target_long definition from cpu-defs Date: Thu, 2 Mar 2023 18:58:00 -0800 Message-Id: <20230303025805.625589-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230303025805.625589-1-richard.henderson@linaro.org> References: <20230303025805.625589-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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: Alex Bennée 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> --- MAINTAINERS | 1 + include/exec/cpu-defs.h | 19 +---------------- include/exec/target_long.h | 42 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 include/exec/target_long.h diff --git a/MAINTAINERS b/MAINTAINERS index 8d0113b8f9..3ef68cd0cf 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_ */