From patchwork Thu Sep 1 06:51:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 601798 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp255009mae; Thu, 1 Sep 2022 00:12:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR61mgyAG3iTP1UsFOYD3f8D0nIdSa4mGcq92wZL1JV4NW4URIzBJTVNgtFkNdYM0k1L2yiN X-Received: by 2002:a05:622a:1115:b0:344:5d08:ff1d with SMTP id e21-20020a05622a111500b003445d08ff1dmr22174442qty.23.1662016355575; Thu, 01 Sep 2022 00:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662016355; cv=none; d=google.com; s=arc-20160816; b=chiwu0EUbi9actzqP+CPMfYO3IUfwi1tQkppfBLIdGgLma2Kq7X3UgWWOFBW5AoUm6 JgvRYAqbGi2DoG1RyYjGLKN53EgYcPYWQ+hD+c5AYLnUQKfn1QpLh5P+JjE4U2qkCyzZ KU1uxIMtjpHjRDF85pry8/7pcV+wAudZKmcxIconcIXqkOPT4VOGV9Ro9+yUo76izIYB 2Gzv7pgCA/X2aPU6v89Xj71QAVWbQZJ52Q3/llq76ypOn67xWLoBgGOcCD618SMkdJpH Ft0GQECD7Z4Ch6v+U2DPjpI/VAFV9uE3u3BsyPMgzlayPvt47cZRsEsXbFNDJOYXNtxk Vovg== 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=OsbFR6exiIugNlN/OA1NiX9KQk6dg8u5+nqhU943Djk=; b=TamyHmMsD4bb9tfqFYVPwFw1Qqs1q5nX3nP1QMg+LHIYuKjXjrg5KsGr9NwmDFCuIX faVrNnSLGnUEZL4FAIFJxJKKgzN0TKu7dg9uFg1SKpIIY7L4IcRxLOqi4VW/2eabWf3j tGXOUarTf92kBryb6qfdQo4x95dyPcy/w6yuKF+OlN65/qg7f5ZEADJt3bF3oEyWxQat NpXR2nsfpcK62ADG3oCDu75bhKHRTWsYCcTfzO7X/4b/Tldk2/O9aoRStWP71c7b0GEj eNiTdPq/4F50n9/83E4wc9ZQk/tnpK/ZDqcfQ5TAqvp8t+8TtnI+iq9A5D+OksboXfMv UUXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iHHwqQQD; 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 a4-20020ad45c44000000b00498f0edfa3esi9979245qva.264.2022.09.01.00.12.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Sep 2022 00:12:35 -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=iHHwqQQD; 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]:57734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTeNP-00019n-5G for patch@linaro.org; Thu, 01 Sep 2022 03:12:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTe4O-0005wO-5S for qemu-devel@nongnu.org; Thu, 01 Sep 2022 02:53:02 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:36760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTe4I-0003HE-1f for qemu-devel@nongnu.org; Thu, 01 Sep 2022 02:52:53 -0400 Received: by mail-wr1-x432.google.com with SMTP id u17so1744245wrp.3 for ; Wed, 31 Aug 2022 23:52:47 -0700 (PDT) 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; bh=OsbFR6exiIugNlN/OA1NiX9KQk6dg8u5+nqhU943Djk=; b=iHHwqQQDIPgqQjEBQ0AM+ad6yviEEToq0tbdAALDR4+2KIGud02xYzu26YAtD0sV6K P7OgBy6zISuKyrDS2Es0hygczDk79dTYOt0sVBLOgu97vBbyzcMwGXVVpOh6H6TurWii QROQiKfUlwYBH0GX6f7erwBko7sfyOjIlF5wOVPGaFG0Nbcyz6MJpVTPq2yKOh3xZEaK RzMw7bYowYw7srFuCU08VlrWQuEUNlnCGbxsbWQLHPaP5OIGC9VXbvfm29wenrUsb8w9 zC5b6guil4d1pNARPkVxhgDch7roQAmVMT33Yd+DxPOS4VA02vktfJZd0Ufle7R6mgOD +phQ== 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; bh=OsbFR6exiIugNlN/OA1NiX9KQk6dg8u5+nqhU943Djk=; b=kw3cCqoHgZIM/IKC1YxV/ncd27ZCQ/M5H++C1B75NJmMJ7ewr2zdiVHjvK/FNz3S/2 wT8R7+epmNvTy+iXxNGOWI59fssR+RFVIPPsiGCJscsombBYgWQINfals23gw06Rqtsb qPYfYWXat9QaLA272e3YxgwPLa+4bCcci4O2j1w7tdlC5wPORgd0vXvTuz2MnSaQ/nyp DglJXPqZy+aM99i6B1l4w5qX9eB8/OrQ3t8I0ct1TKozAU/Wi4EszC+J99u2Aa3Jh44L xlqMkicpgi4l/44UMlpfwnMYxNiBjYPAi/JQB5/CP53Xh2YiRLX+9RFIW1gKYWkK9H3W CLiw== X-Gm-Message-State: ACgBeo270iNOZA1J4DyOC4MtF0Vz/wn71AGk4H1NbjnHWwzXZd0HKKHJ IPZcBIz+Ace0E03lIR8xjTcUdJhOXamnklLZ X-Received: by 2002:adf:e78c:0:b0:225:f5db:969e with SMTP id n12-20020adfe78c000000b00225f5db969emr14331996wrm.716.1662015167107; Wed, 31 Aug 2022 23:52:47 -0700 (PDT) Received: from stoup.. ([87.192.221.83]) by smtp.gmail.com with ESMTPSA id a6-20020a5d4d46000000b00226dedf1ab7sm8308153wru.76.2022.08.31.23.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 23:52:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Alistair Francis Subject: [PULL 07/20] accel/tcg: Introduce is_same_page() Date: Thu, 1 Sep 2022 07:51:57 +0100 Message-Id: <20220901065210.117081-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220901065210.117081-1-richard.henderson@linaro.org> References: <20220901065210.117081-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x432.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, T_SCC_BODY_TEXT_LINE=-0.01 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" From: Ilya Leoshkevich Introduce a function that checks whether a given address is on the same page as where disassembly started. Having it improves readability of the following patches. Reviewed-by: Alistair Francis Signed-off-by: Ilya Leoshkevich Message-Id: <20220811095534.241224-3-iii@linux.ibm.com> Reviewed-by: Richard Henderson [rth: Make the DisasContextBase parameter const.] Signed-off-by: Richard Henderson --- include/exec/translator.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/exec/translator.h b/include/exec/translator.h index 7db6845535..0d0bf3a31e 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -187,4 +187,14 @@ FOR_EACH_TRANSLATOR_LD(GEN_TRANSLATOR_LD) #undef GEN_TRANSLATOR_LD +/* + * Return whether addr is on the same page as where disassembly started. + * Translators can use this to enforce the rule that only single-insn + * translation blocks are allowed to cross page boundaries. + */ +static inline bool is_same_page(const DisasContextBase *db, target_ulong addr) +{ + return ((addr ^ db->pc_first) & TARGET_PAGE_MASK) == 0; +} + #endif /* EXEC__TRANSLATOR_H */