From patchwork Fri Aug 12 18:08:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 596830 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1795019maz; Fri, 12 Aug 2022 11:40:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR6SErgpQJyhypXHGs3wEX5Dax5e177M0tNd2Jb3q8UCBJtRKUbnGJ8obeOqGHe8LuoKA+Ig X-Received: by 2002:a05:6214:2b0f:b0:478:5319:c4ff with SMTP id jx15-20020a0562142b0f00b004785319c4ffmr4703228qvb.66.1660329603579; Fri, 12 Aug 2022 11:40:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660329603; cv=none; d=google.com; s=arc-20160816; b=OVO+u4m5eUk1G3YGUUI/0xy4xrgv33iJuEb+IqYc5PaiXfoOgDCCfMteMKSEIt9oKJ IcdSIaUX7fGLI/KfCv9Y+9vnpr1QnAjoP4d6MLu/TlLY+pQsYAOCIQNOHrSIgyuU8zHA CfyqJrmQZsiD+8Hqm4TdTrlmvmrpJ3TOL9rn0qfZfb4TT5BI9hKdoDbTXXWNk/lc5eLO tVXFLCrgtwPqqQY4P4z9Tozx6solbd42P7wkqhgQO2WXR4KLrjL6CSaxi8sfXgXKEMFL 6SXq906QhgLiMPwPuCfFvHhQ8vvECmzPI5f4g+mrfsMdyERszf3/IuOJJBRIbi/aWprN OrTg== 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=PnxOd469lmAdC/RQB8O6SvRIgXAOuOZ1V4tulDNdRcM=; b=Ibsa0GaoEsdvJezZBzN2hF28ddK2ELjUKy36U5AQaF+vLzZORGI7l/Affzeh8Yv3sL +aSH41CQ20gKqYn3VxyJit1Zc2Rb++qozJIhYtomvoiqaeTyCR3hIX2n66Kmkv5ctXyv g1evog1XgyhjTJe0qbpV1/GZaUzWLb0oKt1AfeZ1dUsp5T7ojzaOFD2KGGKImZKUrQSV C0c5b5HFy7ZGuUuS3AsmnuWYEuKwNSjmYll7aeM7cdnc/w+4Y0KCGPQWnPMkPITo64Jz mo9OHzbNS/W0Y+sTRIDENfBahQtI3AEsEb4CiyJQgjFHlcgkJTge7JOEPMWJ/svwjE+Q jiPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bSCP71l0; 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 bl22-20020a05620a1a9600b006bab801f2c5si1761288qkb.24.2022.08.12.11.40.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Aug 2022 11:40:03 -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=bSCP71l0; 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]:60920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMZZj-0001Aq-0P for patch@linaro.org; Fri, 12 Aug 2022 14:40:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMZ5E-0003i4-G2 for qemu-devel@nongnu.org; Fri, 12 Aug 2022 14:08:32 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:35580) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMZ5C-0006ZH-Sm for qemu-devel@nongnu.org; Fri, 12 Aug 2022 14:08:32 -0400 Received: by mail-pj1-x102b.google.com with SMTP id o3-20020a17090a0a0300b001f7649cd317so9069184pjo.0 for ; Fri, 12 Aug 2022 11:08:30 -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=PnxOd469lmAdC/RQB8O6SvRIgXAOuOZ1V4tulDNdRcM=; b=bSCP71l0DqojHC87bomEzD7pShba3IoTEr+nDTV9Y7ssoz3/48akMFEnb3USjI42g6 9jbOf7mByveComiogBqDtKw72nYtAoYKN7DhMiJJRFLoNtnyEKK+hp0lghHK4ywz+Gro VGjozr1JgYo4wxI4JuT3RqB7lHI/hXZ3VGtkREm+5jElATCSiYo4+IRd0L7LG38LBAa0 UjuKMYGcpFVHSB9jU1JXHicPoRlydRV7BYV/rhpiWg6mW82hkrDLwfxxo0ZxBrEWsoss NKZZudR2FxKLJRXl3in+NHYq211l9baastZCYpQWXzmliPOey4XZ2o0EiDfqDyl12iAH xlbg== 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=PnxOd469lmAdC/RQB8O6SvRIgXAOuOZ1V4tulDNdRcM=; b=ohiXvIo98gDv3T2F8+wB1LjlGd2uYHRuxn10AeFd/YayYdYV9GpksXkrlt/+/GayVL qcoqkPqLr02iiE3V4RBDVjsNLST6Sx5080N1AuXzA8LWRWhqt1ww67/143gtp8EEHeNl iMydc4f2pTSygKWfgxh10GKlwxPMFj5LooeXpxs9dov3t1l6KvFIcI07/p3ZE+v41azk p3EAn64qSbRG5WmcZfU4z4wVj84C4/qNgUs6kErnaZtgzcaDY/Ysd8yR0cuiQUXPq5yc 4W7PPtLQQU294dxyu8pJWOwv4frXH8yB9oiLUFXZB7j7meM9kZeGSaO0n1x4ot6Q+dId nfzA== X-Gm-Message-State: ACgBeo3Cfx86NS5TphGLjOAeKcTCP7wZjyOqI/MlIe1ndxgAeRiVQWJI kAsmE60d/fDXwCubW1KFZ1sAV5jj0B+MOA== X-Received: by 2002:a17:902:744b:b0:16d:cef6:ffe8 with SMTP id e11-20020a170902744b00b0016dcef6ffe8mr5157015plt.163.1660327709524; Fri, 12 Aug 2022 11:08:29 -0700 (PDT) Received: from stoup.. ([2602:ae:154e:e201:a7aa:1d1d:c857:5500]) by smtp.gmail.com with ESMTPSA id h9-20020a056a00000900b0052dee21fecdsm1914761pfk.77.2022.08.12.11.08.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 11:08:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, iii@linux.ibm.com, alex.bennee@linaro.org Subject: [PATCH for-7.2 17/21] accel/tcg: Introduce is_same_page() Date: Fri, 12 Aug 2022 11:08:02 -0700 Message-Id: <20220812180806.2128593-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220812180806.2128593-1-richard.henderson@linaro.org> References: <20220812180806.2128593-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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. 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 */