From patchwork Thu Oct 20 12:21:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 616761 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp292846pvb; Thu, 20 Oct 2022 07:18:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6whrBcHoj6abcRvqN62O9dC2AhGhCOzyk9DCeO7GJ33NzTj83xW5+figDdP/djbjdLb1Yh X-Received: by 2002:a05:620a:28cc:b0:6ee:78fe:c519 with SMTP id l12-20020a05620a28cc00b006ee78fec519mr9112646qkp.345.1666275497941; Thu, 20 Oct 2022 07:18:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666275497; cv=none; d=google.com; s=arc-20160816; b=Og/l3qFkOiBmeBG8lI8stIkgpssJDtIeRPZzAmEJ2wWIr6nAkbWHSwiiiUsZD/81uK 4RZA7J5p+MsoaPjxghwFBK8e8FbfDOrCcUY3rOYM4HPFAqDSHsdciMXZS8IUUMxW3Gp4 R6cGFmRFSEsJGIN7KiO6IQlpiTMUGZg93lJUgEeAL5iLcS3HmjuLtYfCVTYOma4oFuPr GI8eqZ8jykd8pqN7wEYcGT9nTZcDvNuAqamXzVvAcZ75W190DP4bY3WuGW0m+Q3kNHgZ 0iLOr5W+2JlwqxhbHUqT0V7p44LfAcGlak+FmNUQZSkQ56KTg5JLfDPy9SPZSpfj9K/W 3zNg== 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:to:from :dkim-signature; bh=/Mtkmedf+4E4gXxJIPDJOU9Xjw/x7DGKKan8I+smfhM=; b=CFN+W0ZS3XEM5fQzEcBlK/CUDZEOsiRhaow7o/SuUPm3bQEbE2WlkRpqpoNqWDYpnv A3xZizRjPkzX3bNHR8mfGVLA8upEVs8LVb9iWcb/Cq6dy2xUP/jITG+3x9Rdo8ktMOY1 s4ZwZbclU+abx81oBay4a/U+CuiFoQqnD2z8XHrmcLVwQOjcj2BCKcYYR1ryFFbgVaHq saO9NRQCuEoHTHEDLDvW5j0jWYvtuTtHTyaBl9BCqrODJFl2vIh0fCIhDd7OzWV+OsJw pnu7zFwKLFtvxuy+n3GGJS/0/gytqpnbpd3AbgVwSAISn97aFMBzEeW5nDxIpf5a0p6f 5dsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RC6QCfCg; 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 o4-20020a0562140e4400b0049935df9b2dsi10511545qvc.359.2022.10.20.07.18.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Oct 2022 07:18:17 -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=RC6QCfCg; 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]:38434 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olWNE-0000Bc-9Q for patch@linaro.org; Thu, 20 Oct 2022 10:18:16 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olW7t-0001kL-RP for patch@linaro.org; Thu, 20 Oct 2022 10:02:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olUZJ-0001au-Pi for qemu-devel@nongnu.org; Thu, 20 Oct 2022 08:23:00 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:36402) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1olUYy-00013i-8z for qemu-devel@nongnu.org; Thu, 20 Oct 2022 08:22:31 -0400 Received: by mail-wr1-x42a.google.com with SMTP id j7so34137331wrr.3 for ; Thu, 20 Oct 2022 05:22:10 -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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=/Mtkmedf+4E4gXxJIPDJOU9Xjw/x7DGKKan8I+smfhM=; b=RC6QCfCgkRpz97j9SGrN4vfjPqztdLjApCGAA88EzqrLxrNuoVywBRhQ7vBuTzO8Hp dIacHIsqY1w+fmrJnZojKQvseLoIeoBPiadRO7sJmGPweVBZwkmo180ocklRL2SwBImE MgCnlAQrw1p/e08KTtsqYGxQrEQoqqPnpkzU1pGBKSmF62lBQQiwEDnanw6tIWBRlPwa 1JDXwigGuRI9+Ng7jfhZ0QJQXmpdrHDjxckLiMuRn17vWL5MJPue+LgOr4cxyFss6tA0 rkSc3hBKdyN2oz5VUtBGP39D2BOAOfVkeQsNUXv/k3s6IOzJBoQ3pEEacPOEYPATs/gR /nHg== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/Mtkmedf+4E4gXxJIPDJOU9Xjw/x7DGKKan8I+smfhM=; b=I18wLTsxkEjMIs8hay3LJe0Srrc8A7uF69xoMOGAmTQT2FvSOtVjRzIbvZTsVzSLvh y4tb1cw3n+wxxu5azUBWzU9EMfoeQzsW5BEEvzoCf6EFJM+FI1B2a/9RImNAZ/ktqrNB K0h39MGcojxEB15g7i3M+sOglIb+mc7X/8j6kgC58u/agKvGq3pxJkidbSgCBCbBGFeD C79WJn/uFTf7TN5dBtmtXpbo/8DgT089dTm80CXr3+e7xFD58rhBNqoi8U+dCo1vBGCg aDCRQ1JuJ7yTCIozfwSJyaY23/gc+U7SAeIi7PuLDckT1Rsj1GLtQl60jgJ24fmiRPua PGIg== X-Gm-Message-State: ACrzQf1Rx5NHrhrEv/WgSnJi2/SwcfEV1VAWZLt9iIjNecmq10X+W4oP yqaPZH/E+qDNiLug+F2Ga+zSBfbIVCKJEA== X-Received: by 2002:a5d:64e4:0:b0:22e:3d49:91e0 with SMTP id g4-20020a5d64e4000000b0022e3d4991e0mr8035848wri.87.1666268528521; Thu, 20 Oct 2022 05:22:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t15-20020a5d49cf000000b00230c9d427f9sm16520192wrs.53.2022.10.20.05.22.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 05:22:07 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/24] target/arm: Introduce curr_insn_len Date: Thu, 20 Oct 2022 13:21:37 +0100 Message-Id: <20221020122146.3177980-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221020122146.3177980-1-peter.maydell@linaro.org> References: <20221020122146.3177980-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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" From: Richard Henderson A simple helper to retrieve the length of the current insn. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-id: 20221020030641.2066807-2-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 af5d4a7086f..90bf7c57fc6 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 bd5ae27d090..94cc1e4b775 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 2f72afe019a..5752b7af5cb 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -6650,7 +6650,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 { @@ -9812,8 +9812,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.