From patchwork Thu Oct 6 03:38:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 612868 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1201373pvb; Wed, 5 Oct 2022 20:44:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/OUrdSMhM/ipUhR6zQB6/Jb77V3zL8MG8EHmZKYwjadGxZhgrEg7B61pj0MCDGunklqSp X-Received: by 2002:ac8:5c05:0:b0:35c:bacf:2f55 with SMTP id i5-20020ac85c05000000b0035cbacf2f55mr2041360qti.538.1665027872457; Wed, 05 Oct 2022 20:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665027872; cv=none; d=google.com; s=arc-20160816; b=tbqP4r1/UVLfwoWRTRi7+PMibxRXOm8xLpWQQXtMX+wZwsSQTB7PbFycyKTqUpxH7D QXN9DN6ZRMxZX2OrFym7ICmMXfxKwxvTu2Ny6VRIWL+rbpPOdEJnP2CscAehd1UL+OpW q1TZ/CLgpQxnNwpJgrvFVBM6phwbeVBaTN4ExEKFPMMcAej5JrZltmOxLRVkV5HGUSTO q0PNaNF1FKaohpFZaqk8+UnO39iA52LuNWoYYKK38aTem9b9qiodMUeHEca9x7kcqHBK 7n/f448WJw8g7Hv8WF2Wi4xG9ccfwRiJ/11rOr5hYmKnoGSK1FOW5DfpQXJ/O30Vp/vD vX7g== 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=P5g9LsbVGatEdzxl/n8RSiITJc/1DaK7gqTPsWt4QYVyWYYq+Lwd8F1guQaTbJ27LB xaSHjAEojUpahyv5WOyiwRG5Bo0qdOpbvivrzc3fdJShqL6qyoydHMvXNaxxwkw2nefy 6C70izzSim+hB9x+y8kdu/XPMdedfklJaa7sXLSz5PfpCmnP0N5snYZvZ1NSe1pMPCDk /F9VF5OKtNH/6lWkeQzhAVweCcyaLANm+YIkOzt2mCJNep6zuvesNNpyHj37kQrou9DA y3KE53A+ASNLtea7P5kePAr4S1acO2DQdUhd+9OgwhsfeKaBeI/OABgGruo5QgVJNmM9 g9vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZM23Fyhg; 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 z125-20020a379783000000b006ce73206109si6640835qkd.712.2022.10.05.20.44.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Oct 2022 20:44:32 -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=ZM23Fyhg; 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]:52716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogHoG-0001OP-0S for patch@linaro.org; Wed, 05 Oct 2022 23:44:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogHit-00032s-4h for qemu-devel@nongnu.org; Wed, 05 Oct 2022 23:38:59 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:43875) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogHip-0002u9-V0 for qemu-devel@nongnu.org; Wed, 05 Oct 2022 23:38:57 -0400 Received: by mail-pl1-x62c.google.com with SMTP id z20so555057plb.10 for ; Wed, 05 Oct 2022 20:38:49 -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=ZM23Fyhg+rzcP0voVzKaW06aK/aMM2HZkml+J0N0D84Tiv+Xw0ag4HI5xzcYmUCMRl 1oEjyrnGROuOkdlsZcPJ3jDGXQsJzqKrWRJ69P9Ay6D0ln4EurhCBA8mE5BqcX/jtOou DQjh1WItNvyuY+/J2zTr27/elDZeCRBuoARQisTbRSJFC6eSmK+vs1PKQFVYMW4xJzaI JvuR26GLmc/z23MIHt7z4QGYb5puvHW9VpXDjjjFTXckkZaZgzDKpcfQ5G0gYy01wmpW p1Z6nazIm6zcKLhz/spW/4xOFj+YRuJMwYz7dlfcvoQ+sw3VLs14ehhbHyeXn49fj7B8 65vA== 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=r7F69ASHWGSMlXyV1gUpj9geehi9GK9ph1XB3NVOkFwFCBHR0yEtK8ws0xdVg7u+Fg 7HO7Q7a0LsUXy8BJ8YyNhcszvUtCNrPqpXbsfaKQQjR4tvXW25/YVb63Xjv0TJ0SJzB+ FIADyvQGGhWvFDdU+ZhzPO94pMFiSiFj7ZTzWiX/HtLgVyQStZKIHI/W8799GMKUnszF FopepY33PR9qQQlu05V53JnQ3XZAae6NoJWI05R4LXUqH8SGhFvjnlY1LJtvzbH2iDxg ZjC04sjhnJp92Z305ociYUl5CAATsDuM+20JtQZ9w9CaT1XFtarc8QBUUMwdxCvKVcfq z69g== X-Gm-Message-State: ACrzQf2QxW44lmpPmAAN5tMpVKd1nkdJWwssyBraqZVTrOVXJLjunsZl AgsAvokQAvCyIbhHTMeA3PzmHhxXfe/VlA== X-Received: by 2002:a17:902:b942:b0:178:be25:203f with SMTP id h2-20020a170902b94200b00178be25203fmr2474122pls.101.1665027528568; Wed, 05 Oct 2022 20:38:48 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:9ad0:4307:7d39:bb61]) by smtp.gmail.com with ESMTPSA id t11-20020a63534b000000b0043014f9a4c9sm539831pgl.93.2022.10.05.20.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 20:38:48 -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 v6 1/9] target/arm: Introduce curr_insn_len Date: Wed, 5 Oct 2022 20:38:38 -0700 Message-Id: <20221006033846.1178422-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006033846.1178422-1-richard.henderson@linaro.org> References: <20221006033846.1178422-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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.