From patchwork Tue Aug 23 22:05:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 599486 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp2739817mae; Tue, 23 Aug 2022 15:12:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR4/qMezbOvIlUMmENR6iaAgCntdUijKsDY7Oggel6XdhrCFYfZGjKSi2h6oznfabZwVipfT X-Received: by 2002:a05:6214:2a81:b0:473:af82:9a95 with SMTP id jr1-20020a0562142a8100b00473af829a95mr22125548qvb.44.1661292765169; Tue, 23 Aug 2022 15:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661292765; cv=none; d=google.com; s=arc-20160816; b=nyKENxZpqK/EM9PKXqYoHfxfQTvAz04wGD/9rMSwafjINPJVlN9oXnISx5S0ei9fj/ /Bkn+vH0i7b8xgs1iayNhHsD1AW1rQXEnGD+emlWOdXd5Q4e9FxJOR1DYzfCgy4AbDhg neL5kUhN2BUmlb4afMD2Zrbsam+c+2nc3weeEoy0Nv7QPpSwoBsLkVAgXi3YY8Hpc7+P fQddupu2jXl7xRMns96Kl43pHXtWT1PhX49lxGVOEHllyL7jGtpQ5zZ4rznQ9rUZnPky SS+ODSI3g121CoWu6qiLD65NwOUZ7yNkiWrhgSbQiakUsjqY6hKYJYU/H5QSAXBniCrV OtiQ== 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=0us2HEtKgR52Ufls0QpDVmZ2OHpEKlg+TkewEl0z8N75qknTd9XRCFOd6BwOUbaAb3 be3r9KcHd7B5l+MBSgop8AIsSBxYVQq7R8/5d4Xws1lqjkPl4inxjo6I5JQbjGKDSF+m acMpsoZAqAZoOH1OPezlyG5xzcyfVhgfYmZWcoC7To3Q/O9IhvFhfiJ0U2cvAQFy6/Ir lEn7gEf2zMUeK+mS+kwNfSNf49+KIOL8AsbUMaAqU3+UKCW8rQZl8QBVz46tUANfta33 8aWW0nFqVbq5YfuG2mtM+SZJlgIpQQe18ZDinEDKImicI8BxG/zXQifbRIVmQts+PbPZ oS8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yGIKUWsK; 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 gw1-20020a0562140f0100b004748cf3c9ecsi6986885qvb.504.2022.08.23.15.12.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Aug 2022 15:12:45 -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=yGIKUWsK; 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]:56132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQc8a-0002t3-OH for patch@linaro.org; Tue, 23 Aug 2022 18:12:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQc20-0008PL-Nq for qemu-devel@nongnu.org; Tue, 23 Aug 2022 18:05:56 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:40868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQc1z-0001Qa-5L for qemu-devel@nongnu.org; Tue, 23 Aug 2022 18:05:56 -0400 Received: by mail-pg1-x529.google.com with SMTP id w13so8330558pgq.7 for ; Tue, 23 Aug 2022 15:05:54 -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=yGIKUWsKPQ3TTiar5jk9exsCX38lMJBYtzHYv9TLHMcvTR92YDmxRrGf7Zu26j/tQP bfHmR1bs3MccPRow5DXJikZhqSykOZVZanJEyPpXANINrh37xyV96n0+QLow5m8G5pJe mloWsq+YIIxqnfVfzUVxCk23coNwk4YYUrJT2CCNRgx1HzVAh0CLsrq7MN+gs9FiCaMh hKuJ7GOLb5w5fi/yVph6AKjE0hL1MmXA+kNizcpTcYXvVkJwEZtpaQYcAqsPeIgKvk/K 1KjdObiGaYyinHcO/8P3GmTFO2kf2Dfv0u0qPn4OYfifD6RZm0MKLMkBvQzL2+L9ne80 NQSQ== 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=wP5YZykq80P5i1eInbRWpW4TTbvQMPvijpPG7YDo4zg9unf9J+IAygZlmMzsfDAtHD 5giIEF/3iqsb0YijKxfNTNlyyaaVaasNUOKvF46/+uXs/gcpYf3LPE6rni6Jd7O16YZk +FtN8D6Lw/eq7oLNWIGOef7XFg/b19g5nItRkzoGHphR1LTTyiEaQmMf3kBX803y7eu2 81f2vUeUSR3Y7WmeUU+deC2kqpiJjKTqr1RFBRx70WJAGl78LC0huMNyON+lk06CajQX qQ/YtGhSWCvjPfYpFimNTGKAjHhWckOjhweh4rpJ97d8C436222HlZqaftzJipN32ZPO ajJA== X-Gm-Message-State: ACgBeo1eQ+XRT+1yYUJUfD6SAXX2c7qZMUSC/5vz9Ks0sInXjayQCtr9 fag2FqYd56UmEGgHGgDvs3WUeWnwUcJ1VQ== X-Received: by 2002:a05:6a00:1947:b0:536:6730:7d33 with SMTP id s7-20020a056a00194700b0053667307d33mr15358415pfk.10.1661292352824; Tue, 23 Aug 2022 15:05:52 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:46f9:77b4:ec0a:c2d9]) by smtp.gmail.com with ESMTPSA id n12-20020a170902f60c00b0017292073839sm11020974plg.178.2022.08.23.15.05.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 15:05:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: iii@linux.ibm.com, laurent@vivier.eu, alex.bennee@linaro.org, Alistair Francis Subject: [PATCH v7 07/20] accel/tcg: Introduce is_same_page() Date: Tue, 23 Aug 2022 15:05:29 -0700 Message-Id: <20220823220542.1993395-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220823220542.1993395-1-richard.henderson@linaro.org> References: <20220823220542.1993395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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 */