From patchwork Fri Sep 30 22:03:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 610973 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1764958pvb; Fri, 30 Sep 2022 15:05:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4UHO3Y5/PmNuxExtwZXgG85KC6sM1MJ6mJ7C4lNCSiLeSoYsd1bUv+DkAG0/CPCz+NGZKa X-Received: by 2002:ac8:5b53:0:b0:35b:a603:6cdf with SMTP id n19-20020ac85b53000000b0035ba6036cdfmr8744312qtw.357.1664575523961; Fri, 30 Sep 2022 15:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664575523; cv=none; d=google.com; s=arc-20160816; b=sXAVDuxucHRFKl4x3tjX61UYRl6so9Fvwq6g0Cr6xdSXj5EOf4KSqCgh83gnEndK+I lOnI1vuUeWVer/3Ds/6Q3WMFzNjWO8HYvZzc4VCdu+l1bh8ECJ1yVNPAYLmpzeJlF+vq XB4E1y9eVis4Cnz9xHZ7aICb3AxvRAA8TNkxTkyJysG/BwEoxsy8Y0OtsHI+hvgr9O8N PEM8EWlH8iZOkjAm3+R+0H74eyyuToF6QXcQ/J1jNJoMj3jCDtWC6ATsTxXeSzocA62S nh9Zo1ki37j1Kfv28Ptij6DveMJgUUQNP+H5kpz+BAD/dILWBR356FogHHl7+HsvZ+tx 7Ezw== 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=apBe+xOEG/yN097g7gF2sx0rQ+06LZSBxstARnEgFm4=; b=fQUP9O+J/+foYGoR5MkNY3U8e09GYaMYaMuDsuZzCns0aIl0W8ciibL1hZpraVP71U pFD/K4ZgOrClfDhWqQ+97PARNLHbKcmadczKmtt60JaOL6UxR/mu8sqQRFJePZKSqHPB yhQ2bwyYVmIX+rGEAdP3BFdi+nHn3H9BRLguROoJrECt3VaSpulFIMJwlQJHEKG2ja3G n6PgbHBjBLupuw9qEDYrwvGSHbOyTg36d3KbZx0a0+ahNohvkEZMfVSKFSpvkEck2lOU ZitmquOsan4EreaP0bc4D18tcmBfkN3awEFlhXXdaDzFwv9P+t7pUwJwGq01gOC6LpQx MKTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PkzGp7ke; 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 c14-20020ad45aee000000b004ac24871ae8si1671630qvh.575.2022.09.30.15.05.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Sep 2022 15:05:23 -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=PkzGp7ke; 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]:45522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeO8J-0001hY-FC for patch@linaro.org; Fri, 30 Sep 2022 18:05:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeO6M-0001fD-R6 for qemu-devel@nongnu.org; Fri, 30 Sep 2022 18:03:22 -0400 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]:45024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oeO6K-0002Y3-5C for qemu-devel@nongnu.org; Fri, 30 Sep 2022 18:03:22 -0400 Received: by mail-qt1-x82c.google.com with SMTP id f26so3490268qto.11 for ; Fri, 30 Sep 2022 15:03:19 -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:subject:date; bh=apBe+xOEG/yN097g7gF2sx0rQ+06LZSBxstARnEgFm4=; b=PkzGp7kePNj8r+lMIpFGsMPF+hyb1SSdTxbLdFYByhPXNQ6QuVSDPrKO5v9qU11Vfy 3y/J5gLqIN5XkIm1x27tvd2dZMiijM+BNaCbcnOHpWw4Lke9D/jOB1BlxgCpr4AbriJt gjl3bn9ybOdrhFJsGIOu/UvMAeMewFhjITFfx4aaKO2ibG/QuOUS+O4laaXUrjGBMXV2 huem5IqxS5w5Q0zNTTrIcZvjsJfMaJruttQU2HFr/3ZKGA3CqwIm/nS0s/nWF0FTXkI/ jQArGPT34AFW2l01EAUIIGjcR0yul/qiswK2h0pkkvENo6E0L9ZIun7fEdE24RqVLF3G mMVQ== 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 :subject:date; bh=apBe+xOEG/yN097g7gF2sx0rQ+06LZSBxstARnEgFm4=; b=EM5g99CD1XxQBRZrRZZqiE6Lsh/mLDZkwwOSR64KpdICSMJK/e/fIwNo95ii6L7X0p raKPcfaN773qyllCSbHbzelStn0/Im+T1SaYw10mAnJkjNYk8rXMrGgSrGOP6BE8H6cT P5RDzap3654o0RWH9rEnA3pRGiypDl5ILevUWVBLjdzWnmJbPFBlihE3f63wT57q8/fE /+eJmwJQJnowKC+6+yLMF+KVBI7goWVq2dzezlXVw5qDWZTN+lVejyVU3M/KwOsbdGP1 7OEmxBc3dZqct+wuCrZHvVF0he6w121Lv73wng0W4dEsBZ2XkWEgzTuGgDfRgfd0tbBo YMWw== X-Gm-Message-State: ACrzQf20ng5kwG3ctFypbKPy5wIvJHmkuOzpr/CpZFpftpUQ1HI7vgVI i0EMFxp+azKWVGwrGjgH/JhdhIPkf0v7wQ== X-Received: by 2002:ac8:5990:0:b0:35c:b943:1cde with SMTP id e16-20020ac85990000000b0035cb9431cdemr8811081qte.239.1664575398997; Fri, 30 Sep 2022 15:03:18 -0700 (PDT) Received: from stoup.. ([2605:ef80:80a1:5a60:d0d7:468b:5667:114b]) by smtp.gmail.com with ESMTPSA id o15-20020a05620a22cf00b006bb78d095c5sm3196055qki.79.2022.09.30.15.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 15:03:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v5 1/9] target/arm: Introduce curr_insn_len Date: Fri, 30 Sep 2022 15:03:04 -0700 Message-Id: <20220930220312.135327-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220930220312.135327-1-richard.henderson@linaro.org> References: <20220930220312.135327-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::82c; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x82c.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.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" A simple helper to retrieve the length of the current insn. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/translate.h | 5 +++++ target/arm/translate-vfp.c | 2 +- target/arm/translate.c | 5 ++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index af5d4a7086..90bf7c57fc 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -226,6 +226,11 @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn) s->insn_start = NULL; } +static inline int curr_insn_len(DisasContext *s) +{ + return s->base.pc_next - s->pc_curr; +} + /* is_jmp field values */ #define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */ /* CPU state was modified dynamically; exit to main loop for interrupts. */ diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index bd5ae27d09..94cc1e4b77 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -242,7 +242,7 @@ static bool vfp_access_check_a(DisasContext *s, bool ignore_vfp_enabled) if (s->sme_trap_nonstreaming) { gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_smetrap(SME_ET_Streaming, - s->base.pc_next - s->pc_curr == 2)); + curr_insn_len(s) == 2)); return false; } diff --git a/target/arm/translate.c b/target/arm/translate.c index 5aaccbbf71..42e11102f7 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -6654,7 +6654,7 @@ static ISSInfo make_issinfo(DisasContext *s, int rd, bool p, bool w) /* ISS not valid if writeback */ if (p && !w) { ret = rd; - if (s->base.pc_next - s->pc_curr == 2) { + if (curr_insn_len(s) == 2) { ret |= ISSIs16Bit; } } else { @@ -9817,8 +9817,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) /* nothing more to generate */ break; case DISAS_WFI: - gen_helper_wfi(cpu_env, - tcg_constant_i32(dc->base.pc_next - dc->pc_curr)); + gen_helper_wfi(cpu_env, tcg_constant_i32(curr_insn_len(dc))); /* * The helper doesn't necessarily throw an exception, but we * must go back to the main loop to check for interrupts anyway.