From patchwork Fri Aug 19 03:26:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 598472 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1063259mae; Thu, 18 Aug 2022 20:27:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR5CBdn9C2QA9hNiE1FiIZWqr8SaTmgSc4oGhaXzQyO9lyKrJASk6+u0nGkaEZ3e7n9i9dFx X-Received: by 2002:ac8:4e47:0:b0:344:94b1:c8f3 with SMTP id e7-20020ac84e47000000b0034494b1c8f3mr3982012qtw.411.1660879659129; Thu, 18 Aug 2022 20:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660879659; cv=none; d=google.com; s=arc-20160816; b=XcfLDzRcPSINQRgnvdc7Zv4Lwvh+sR4lWxilyeJ7KQ/GRZKYIG2SnYEA1dmuhALcXs IVZN8aaZnVskjYJ96BAZYuKM+p8bXBeBHZVuwgF9pTCAPDqfqQ+gDH9g6VoAp2ghqyV1 Jy+0NHYSSE+rYSE1rHoh0WvWeS4YUeJHB63ZPL+EMUbOSDKCPL8Pmox/37izqF41+ti4 8qI9ERhhmZpvqn2HXxGSu2jCjLC9jDTwbhQ+D434yvxVHJhlBxmXxf0KxKkysebWnYiz dNUvULm9Xrv6dkSrh1FiZJdwFm2kn7q+KhqHSdLTGEcMFfAfKnm1HIWK4MxGx1/4AC+U a4Gw== 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=Cm5A44QyNghBodvrbXoInXx9ps2D6qKtVEQywh7/RlDwvnlEFh5b9YEN8dyJqel2BA gbZaEFemAnrTXp3Mc0imTjwbSydKLz/sNOdD98oPUHMB2tP7/h/spEXhcMeTmCUbOxiL R050VJLSnTsnkiu69kGmOR6GEErbXfPNPxufTR4fBZbphaPKd171pnCQuX8dZ02dEDe3 aK7h1nyLL8eKqTPFCXW0tma+Pujakq82oLcCDcdTunrY1YPeDA4dhHJWpFNMrXMMwSLu nlNf/fR0j5uEX53HmykFkkdOPuGpQaDD7oi8wrxh8+w36QPFnKVWGTC6BwDlChWgLB+d /vkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="f4ODB/4a"; 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 g22-20020a05620a40d600b006bbb1bce643si1993634qko.681.2022.08.18.20.27.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Aug 2022 20:27:39 -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="f4ODB/4a"; 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]:37608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOsfa-0001pT-On for patch@linaro.org; Thu, 18 Aug 2022 23:27:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOseV-0001me-DK for qemu-devel@nongnu.org; Thu, 18 Aug 2022 23:26:31 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:39437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oOseP-0002kA-Od for qemu-devel@nongnu.org; Thu, 18 Aug 2022 23:26:31 -0400 Received: by mail-pj1-x1033.google.com with SMTP id s36-20020a17090a69a700b001faad0a7a34so6404140pjj.4 for ; Thu, 18 Aug 2022 20:26:25 -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=f4ODB/4axXqQSCyfaLKzSQnK/aQ63wY+Msg1h/Ov496F+uawNOrgmAZmhi5DJXe1BF qLCH4Wt/qqqEaENstN6EOomVxiawBt4OBVzw/KiykYnEeEgSHT8y4Myw50UD3NBR6F2U kNvsMExGgKyMOuxeHC8V/ozBDdd715LOlci0iCsk4U5pANutUwTIM05U8bu7SyONgkh+ t8DqQ3MGPxyCXMNOE8t8HksyPw8Hp31KENnp9MS+V382+ZvOgZJblwO3XY+LuRILpO8U SeVjF68FwJnLiLn4TCHBxBF8HVBRUfwB2cBga8nAlQIrn14ofT1FuZCBG8UrUA2vyM2S kQGA== 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=v4uYL7lCabBlgkWqG1bqN+OzU4qDaxUpfZJW1NavNP+d6U/2Lwpi8SDWKKjwIF7h9P wBLvjW7Huq0OxVaDr6gYPRRxEaKCYE6DzwK5fgiwn8zxgeVca/9fnjTgZVhHnUj8wY6M d0YuvQCyrabwevnwxaTdCcrs1TvTkfpW5TuYepccwzeafNAu3dhQmwSJ7nQauhSY/tsl YxEOXfUqY2PGYOs9/5NrdN+BJJld1FokGiBxLYMox09dth5x3Oezt/poUn/+0fKHOtvB Uxu/8AyEP8b1urhw70jRISPUv/EqfJ5+rJP397HD4+CNIfgCA4IzDOiSl0vBsgM/IcTm DNgA== X-Gm-Message-State: ACgBeo0kaVXjKtvBGzFIABeswdR+QPSLo2/Uu8KhOPNBGIkKQ88wh0E4 FaHH2o0cOqlUV5lmCr6WXitvIw1Nd1WCew== X-Received: by 2002:a17:90b:4b0d:b0:1fa:e712:dd53 with SMTP id lx13-20020a17090b4b0d00b001fae712dd53mr517008pjb.10.1660879584451; Thu, 18 Aug 2022 20:26:24 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:bbf3:9914:aa9c:3b4e]) by smtp.gmail.com with ESMTPSA id g184-20020a6252c1000000b00535d19c46d7sm2199904pfb.203.2022.08.18.20.26.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 20:26:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, iii@linux.ibm.com, dramforever@live.com, alistair.francis@wdc.com, alex.bennee@linaro.org Subject: [PATCH v6 07/21] accel/tcg: Introduce is_same_page() Date: Thu, 18 Aug 2022 20:26:01 -0700 Message-Id: <20220819032615.884847-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220819032615.884847-1-richard.henderson@linaro.org> References: <20220819032615.884847-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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 Reviewed-by: Alistair Francis --- 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 */