From patchwork Mon Aug 22 23:23:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 599215 Delivered-To: patch@linaro.org Received: by 2002:a05:6918:5e84:b0:d4:ea33:5523 with SMTP id nd4csp2087452ysb; Mon, 22 Aug 2022 16:34:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR4897zkWkJuQoiqF4UJI8ml2VZS+tcB/W9QzHnotlZ5Rcn5vf/DbM19fGRzQ47WTGZbfbk4 X-Received: by 2002:a05:6214:2345:b0:473:a82c:34eb with SMTP id hu5-20020a056214234500b00473a82c34ebmr17744691qvb.9.1661211248272; Mon, 22 Aug 2022 16:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661211248; cv=none; d=google.com; s=arc-20160816; b=TJmiJrRipjxo6QzA+tFo0Ao8jay17phNQedqxW47Ub48gQPE4vH6gPAfp1Uc3uxb8S SoC4m1pHsASu1a2JtFfvLf9sDpGIC9uGlO4Y0FtxeV4bQdzKADqoAgA4MFL6BNsOHPoa iTRXAD4fVGu6qL3DQBVZvKjlhgWGXDiKAhWe+057iFJ/eALUDdM3rVGSneACFzovwihF UY6wEzFhv1BBcgHq5PzuYrz+m2cBtjySmqmoCgc8cKjfhKPmchZxCYzLx7t8tLbcpgtO uAsdCrTJpUHI4HwN+2hsIfbJwBKYU0VgZKpq4dyXGlMAlwijmwHlS+6tkCvZrMvurfxs 3/RQ== 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=qdoo/EFfZ9+xL61qXYRJd5BN7nP+QxbxeeGNggpMDL4=; b=y/GS1mfcYlhy43Go4SSt3rHDQJs1w5w7MRpdzVuDLHrYB9XbcNSvINIolCt0kLtH8O iHycptTSAAP/dLU4q8pZgR730hpRFrjwm6mffFmT9O98A3ziznuWxYpSzyWm+JCTWh43 77OwGhBCm92puu36Vnig8C7awyCQ+nsX48aLYDl5HNya1o3WYz1m8Y7yIoIhPSQqgl2V hzlVekC6GVY2ZKer74p2oGspiqsEsxdSVus86pDNDwa6ezb3bWJIurMN1uWC0spH7OvS bon4s/q4TTjUPVZio+arSyQ7VbEQIedsRxk5iuySMQRjwuBvKXFrAiTuskQSbr9nxrFT msBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tJAnrn5Z; 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 h4-20020a37b704000000b006bac01b4936si4630272qkf.402.2022.08.22.16.34.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Aug 2022 16:34:08 -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=tJAnrn5Z; 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]:43620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQGvj-0003qq-A3 for patch@linaro.org; Mon, 22 Aug 2022 19:34:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGlv-0005gI-IR for qemu-devel@nongnu.org; Mon, 22 Aug 2022 19:23:56 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:33379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGlr-0005cj-6w for qemu-devel@nongnu.org; Mon, 22 Aug 2022 19:23:55 -0400 Received: by mail-pg1-x534.google.com with SMTP id l64so10781541pge.0 for ; Mon, 22 Aug 2022 16:23:50 -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=qdoo/EFfZ9+xL61qXYRJd5BN7nP+QxbxeeGNggpMDL4=; b=tJAnrn5ZTXiXYB6yNHP6dyvDQbWcpH/vsECz03Ss4f1tFx86dkn5QD/DN7KcpVj86d HeBdAyFLwOPSAOyhA85stDhPVeJap5MLE4ZrurightZSCTCOZwNbuJAyLsDZugqGvs9S JSnTUWLoHDhvChgWMnhqYQxTcVIRQNMEOEkVcGS/KsIeWIIUIhMFxE8EiGfx/ANUlyFH QkJVirSAznGHzD2u5fxPSvVChHXjgWyQ+MKrHCDN/esfMN2UqHjhtMA99hhf1F2hXEhv zA1uBhzUoupSLC3NPj5SQDd0cEunnz92lI6X0lGEwrjzigBMrLpnryuIwI5theMOtkSI /eLw== 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=qdoo/EFfZ9+xL61qXYRJd5BN7nP+QxbxeeGNggpMDL4=; b=2jEdf+SBVhziz60kb0s/sq1ceJLgvBUp6qdaESxPB7FTafY6xbVJclsq3D8P52Mhd/ xXWfapoksqdCYaf6uhGHe8g9WbkvbN+ElIVh76X7zkhHsg9HFlsoUiT5Yl/N550HoDau 6sxRRvYhx4VoHTjuuHciFAx68I5+rqT8/LOi7EknkaVFfIkx8H0TTRNHdIcY2a5fo+V6 yHls295aflMW10WWGStMPJS7/lr2rkwh8t42sjM3hINQCBsmfM+CRlCvOpBd0fXLDGg8 mXkLHUm5MWsgTC36edMgnXHv2oxilQHxLEnD4oXFOfffIYA0tLv4zHdVLTlbLJUkMMaA yeuQ== X-Gm-Message-State: ACgBeo1BNe2K69vQaDENSaDqtq315ktY/oSFLaAU+53UcRdOWa9fktNK 84FKFNnGBvsoq2oetI01T/Na54SZoHR33A== X-Received: by 2002:a63:f4d:0:b0:41c:5b90:f643 with SMTP id 13-20020a630f4d000000b0041c5b90f643mr19164370pgp.537.1661210629852; Mon, 22 Aug 2022 16:23:49 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:c3f1:b74f:5edd:63af]) by smtp.gmail.com with ESMTPSA id k17-20020aa79731000000b0052d3899f8c2sm3809112pfg.4.2022.08.22.16.23.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 16:23:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v3 09/17] target/arm: Introduce curr_insn_len Date: Mon, 22 Aug 2022 16:23:30 -0700 Message-Id: <20220822232338.1727934-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220822232338.1727934-1-richard.henderson@linaro.org> References: <20220822232338.1727934-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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=unavailable 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. 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 9474e4b44b..638a051281 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -6660,7 +6660,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 { @@ -9825,8 +9825,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.