From patchwork Thu Jul 29 00:46:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 488644 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp1714204jas; Wed, 28 Jul 2021 18:12:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ3RJy2iY3UjNUu8ZxTs3xH9hWZSfoFiINdCxszFTrNE/ckBWiAvsROSx3kk4m1l1nsX43 X-Received: by 2002:a05:620a:982:: with SMTP id x2mr2659662qkx.347.1627521121414; Wed, 28 Jul 2021 18:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627521121; cv=none; d=google.com; s=arc-20160816; b=xKAyecNqWFAZZ5PHVcWqY4b1qqOjXBuDoN9NeM9lmAq6WVU1pLvrNQ8t68eMTBbvi4 DEO4fQPpb23eJj62KZH5OhsA+9PN9Ih5McbJ/YwnRO9PsNQG0gSd1l309rFxx+hCm73X 9MCbG2coLnj9jy+wOiKHVFtltPZvBAt7u4BVUTCrFKHnHjb4B3+o6oUSGYovYb+G2xcD gz3XJoooT8A+9eQP49D0e+xREWEXRMInOrvL7IlOsTsCDyyBDz+/vB8ObI+SwPUcqRUn Kl0QV/Yytu+nN2/6uhXfDcBrbt++9OXaX6QOe8hcpsv2Mbwt60OWQZo7xEYh7CxkzGu6 FBYw== 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:to:from :dkim-signature; bh=PRWthvJqHxBpL5Udb2FSryhMPHjHKQKgHQUt7Gw5z2E=; b=fMHDT9423h1/lEp0IA2ZxUwsuNSI94ryvEWUs0EveEiE4wPIQBoOivcKYForTAWAPx JHa4Ulwmux/n3t/Gy+BEO8pQaawiHst9Xr/qFa3CU759fIaQchEiAL0gxVnjnwuT1+Hr idSBKZAR7CDs7o/rkE9mwl4qqIDX34r8MaMHh68zzyClI0iM9AabFFlQONFvPi5iXDIx rQY/+W+A4PjpUi/EaN7DoWT0pWD9hdtaeVffsIX1hRISaWRQ2rktYFrSic1StXZ3SLFK EmTGww/Z7DZxI+0F1UMU6WNSFun1cAI1rESzGg9NH3xTJN3G95U6h67Gw0e43v1Pr9Qr VuNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R1oEJEg4; 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 v9si999579qtf.86.2021.07.28.18.12.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Jul 2021 18:12:01 -0700 (PDT) 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=R1oEJEg4; 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]:37970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m8uae-00051j-KO for patch@linaro.org; Wed, 28 Jul 2021 21:12:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m8uCk-0004Rc-Cr for qemu-devel@nongnu.org; Wed, 28 Jul 2021 20:47:18 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:43975) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m8uCi-0002e6-OS for qemu-devel@nongnu.org; Wed, 28 Jul 2021 20:47:18 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d17so4837567plh.10 for ; Wed, 28 Jul 2021 17:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=PRWthvJqHxBpL5Udb2FSryhMPHjHKQKgHQUt7Gw5z2E=; b=R1oEJEg4tU1C18sbFqLDRHq3hhj5uFeg5Ij2luNxHy99S3IkvQs+42a/O2+5AsAKq0 B3cUqE5IMEIrIWTyAlWHgRQUhvlsy4zMmfKS84+t1dAXSrkz/+EX+n6pOx9EIMR8b4f8 oY8w20BvEp8szJWmhMprAwqhwYX8ifLUXvuKHc85WtwIUg8ax7QO6F9VC4xJ0Finp+Pa yjQUQlvoIUhkWKjlFBwnlW7AVbNhemQS1bGz/eQaP+XWpokfejQTeNxmcVa64EI6Rzh3 KnurAj66DC1RpN7eEMT3uKJXnClYgvDsh7nLTvl4lRgpOXG4+GnN5b8KSGkKjhVjqiqR LzJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PRWthvJqHxBpL5Udb2FSryhMPHjHKQKgHQUt7Gw5z2E=; b=Aqs7wd9Rh59P430k/OqXorPf9Bg8W4oNCC1woU+/kketG5hqFQ1BiuWL3yLqXWL/eQ ieJ0dfyLaA755Q5er8f4Z2opo0/IPsreuM4BueCvQovddY9A4PNGxst+xfEiKfxS4R/p 3Grglvr2vaHdh2SzxMyEHPeAsucRiz8WV49e8Rf2CFWCyz4GE0qTZySeyXE+gXaag8k2 /L86fNQvIQMFUC/tksUXYFTacZZSSc99ueRLcQ0GM8buel1dm1V2CJ7CFhCf8tHcwm8f Do5Jrj7eYhsRjiEQyFwSeSdD1DvQ5/Z56yxRjeVDHuCm1ZpBnJhpQXON0XP8iC7kzaEn ACyg== X-Gm-Message-State: AOAM5301OT0Mbl8FnW9AsgxAPqzMF0SHHD0k2loTV+IJ6QuWfA3zbNWF tGRm+JxrvwCicaqIawCRRVtSIHC+1FInKA== X-Received: by 2002:a17:90a:9483:: with SMTP id s3mr2521111pjo.22.1627519635567; Wed, 28 Jul 2021 17:47:15 -0700 (PDT) Received: from cloudburst.home (2603-800c-3202-ffa7-dcaa-9e71-a2b2-2604.res6.spectrum.com. [2603:800c:3202:ffa7:dcaa:9e71:a2b2:2604]) by smtp.gmail.com with ESMTPSA id t205sm1305005pfc.32.2021.07.28.17.47.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 17:47:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 21/43] tcg: Split out MemOpIdx to exec/memopidx.h Date: Wed, 28 Jul 2021 14:46:25 -1000 Message-Id: <20210729004647.282017-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210729004647.282017-1-richard.henderson@linaro.org> References: <20210729004647.282017-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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.23 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" Move this code from tcg/tcg.h to its own header. Signed-off-by: Richard Henderson --- include/exec/memopidx.h | 55 +++++++++++++++++++++++++++++++++++++++++ include/tcg/tcg.h | 39 +---------------------------- 2 files changed, 56 insertions(+), 38 deletions(-) create mode 100644 include/exec/memopidx.h -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/include/exec/memopidx.h b/include/exec/memopidx.h new file mode 100644 index 0000000000..83bce97874 --- /dev/null +++ b/include/exec/memopidx.h @@ -0,0 +1,55 @@ +/* + * Combine the MemOp and mmu_idx parameters into a single value. + * + * Authors: + * Richard Henderson + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef EXEC_MEMOPIDX_H +#define EXEC_MEMOPIDX_H 1 + +#include "exec/memop.h" + +typedef uint32_t MemOpIdx; + +/** + * make_memop_idx + * @op: memory operation + * @idx: mmu index + * + * Encode these values into a single parameter. + */ +static inline MemOpIdx make_memop_idx(MemOp op, unsigned idx) +{ +#ifdef CONFIG_DEBUG_TCG + assert(idx <= 15); +#endif + return (op << 4) | idx; +} + +/** + * get_memop + * @oi: combined op/idx parameter + * + * Extract the memory operation from the combined value. + */ +static inline MemOp get_memop(MemOpIdx oi) +{ + return oi >> 4; +} + +/** + * get_mmuidx + * @oi: combined op/idx parameter + * + * Extract the mmu index from the combined value. + */ +static inline unsigned get_mmuidx(MemOpIdx oi) +{ + return oi & 15; +} + +#endif diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index f91ebd0743..e67ef34694 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -27,6 +27,7 @@ #include "cpu.h" #include "exec/memop.h" +#include "exec/memopidx.h" #include "qemu/bitops.h" #include "qemu/plugin.h" #include "qemu/queue.h" @@ -1147,44 +1148,6 @@ static inline size_t tcg_current_code_size(TCGContext *s) return tcg_ptr_byte_diff(s->code_ptr, s->code_buf); } -/* Combine the MemOp and mmu_idx parameters into a single value. */ -typedef uint32_t MemOpIdx; - -/** - * make_memop_idx - * @op: memory operation - * @idx: mmu index - * - * Encode these values into a single parameter. - */ -static inline MemOpIdx make_memop_idx(MemOp op, unsigned idx) -{ - tcg_debug_assert(idx <= 15); - return (op << 4) | idx; -} - -/** - * get_memop - * @oi: combined op/idx parameter - * - * Extract the memory operation from the combined value. - */ -static inline MemOp get_memop(MemOpIdx oi) -{ - return oi >> 4; -} - -/** - * get_mmuidx - * @oi: combined op/idx parameter - * - * Extract the mmu index from the combined value. - */ -static inline unsigned get_mmuidx(MemOpIdx oi) -{ - return oi & 15; -} - /** * tcg_qemu_tb_exec: * @env: pointer to CPUArchState for the CPU