From patchwork Tue Aug 3 04:14:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 490856 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp311339jap; Mon, 2 Aug 2021 21:25:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnoD1WCEo9Keg1onLlYB7ILzjEZDniik0Qs5f3O6irblpLeWovf+W5q3Xi9Nyarn8vQWCO X-Received: by 2002:a25:be8a:: with SMTP id i10mr25780964ybk.176.1627964758269; Mon, 02 Aug 2021 21:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627964758; cv=none; d=google.com; s=arc-20160816; b=yKpx0iKALBEea8/SUEsDApyCdRRnjftBFtsXiH/tUlSYlVtTJwIZptXLRUZ84HyHQA YJffVXd/U1I7I9eV0WGmafGMPAU9lXIm2R0BTQCSRXWKtrXaskr/bNhdpX/BjpfkAr8B hEorBvv6BFkcv2V6IYPUGlCwwfACs4gspnZVASPJBmYz0vJCYRE4DZv0gZyr+bofBlsI 4fMe2CCZie6WDB62D+iBLR/oHM+2eRuiBz/hecFgcXsD6dVL4bQ1HotNRKSibjz7MLkH sRNlBfqF9Cbu/5PKork4nOSsc5z/zOrzWFdKmoZCkFGEfcE4C/1sAuzs7JVy7qw3QsFu +r7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=J9rPOAfrVBDrqHtq45P5qdmr5bo/FAMYzfvKwys2uDA=; b=l9I45o6DKim2T6s1PNo7f0MMVthB4HPQPjod5DmLBoHligROCwciyJzBlhYzW/UFGm ZpxiyYmvXByvLbXIBSvOlijMRsiZomUWYJyTdvF7ukGGe478KtvGCOjU14N1GbBY6qBu 7DGdP1rinHKZWavQ6wsDJ4G3sz4/Uw3/HqPPt4gpcs8Bez0i8cVFOyFw/P2zLza9xHX6 QGGAHph/B32ZIXkIFIy3jef9pOyYIEQeeaMF2O2ouQzHGwwLzyMxNFQfAcruXEYL3CxY +KMHbHXZuMKNTxEOSBqf6diZPNsKuYq1c6IEWQDeJvQ4/Eha+1Q2HQO3A4tXKD8FHWyi XvNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LZHMz383; 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 p12si3781544ybk.462.2021.08.02.21.25.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Aug 2021 21:25:58 -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=LZHMz383; 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]:58838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAm05-0006NB-MC for patch@linaro.org; Tue, 03 Aug 2021 00:25:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAlpl-0003gy-1X for qemu-devel@nongnu.org; Tue, 03 Aug 2021 00:15:17 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:52105) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mAlpj-0002Lr-69 for qemu-devel@nongnu.org; Tue, 03 Aug 2021 00:15:16 -0400 Received: by mail-pj1-x1034.google.com with SMTP id mt6so28092162pjb.1 for ; Mon, 02 Aug 2021 21:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J9rPOAfrVBDrqHtq45P5qdmr5bo/FAMYzfvKwys2uDA=; b=LZHMz383E0s5qbMKlKlD06iVz+jgXTfsdjKOHxHbKa5v/T5hqHrS9mCeFZh78pEm2w 8/1MSNyh8LKHYURw41DGCke27jPlWIp9YQ+Zmb/E/DiorBleeSv528tBNGEHzYIU4qhB 0htb502A6KO0vePZgQM6jOFteJ87cJra7wYRKWZ2KvOmAzidrdJo4hSZUxVvi5likgdf M8leUis3Pvp3tB68sIlxHzS+f4G+i8EzMegu1Lc/KVosNRTCTt8TtehCeChqD9acE3do GfBCMn4l09BfW+mOme7ZkYdtgbFv6X3ltjwYb5a6I70iNsxT4uk5xqS8F2TPwZKByNxP Lc7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J9rPOAfrVBDrqHtq45P5qdmr5bo/FAMYzfvKwys2uDA=; b=NOgOXdrJ44iwCRD2aFe5npEg42+0k1A5IBzuie8d7ZRGaZLJ8AqER7UoknMmF3ODEI rzPRlRHMNh1FZ57gevona+1RajLBYfbjIpI5hSwyShnEgT0vrulAdLXLVaoClAjpS0C6 Vng+D6rSTddKMV7tN88NI53ao/szY4KRSXEaLobab4L2MVzFSBXzNKb9/vfwTTbFwteW s7YbQ/EVtR/gjZHCb+h7K6W7J+QfSmJjZPCYdggAEbF8hqxAN8xAjsTP6oFcipaEncau DJQVmWqRTGSlsyVQofJ/FPTfMNNtzaKsK3SGMf5A3LgOJxU1/ibsjr0RcYexlrzkcBx1 750A== X-Gm-Message-State: AOAM5316sQTmmrBWVw7PlSGAfwoDlwDz/BplJ5FHwFOVuP8Jp7i4tky8 8LPrfX1IBKloGyObto6VTbWp7qtr+VCjPg== X-Received: by 2002:a63:c22:: with SMTP id b34mr58962pgl.422.1627964113913; Mon, 02 Aug 2021 21:15:13 -0700 (PDT) Received: from localhost.localdomain (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id c23sm13718532pfn.140.2021.08.02.21.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 21:15:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 24/55] tcg: Split out MemOpIdx to exec/memopidx.h Date: Mon, 2 Aug 2021 18:14:12 -1000 Message-Id: <20210803041443.55452-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210803041443.55452-1-richard.henderson@linaro.org> References: <20210803041443.55452-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move this code from tcg/tcg.h to its own header. Reviewed-by: Philippe Mathieu-Daudé 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 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