From patchwork Sun Oct 16 22:09:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 615425 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1617060pvb; Sun, 16 Oct 2022 15:14:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5je5XvyNXNSUR60aQrp9+iG0ABxDb7Zd8IIv9SJ6KOYKgvGSzQ0JZEdbeynI7incWgfT5L X-Received: by 2002:ad4:5aee:0:b0:4b4:595:fb54 with SMTP id c14-20020ad45aee000000b004b40595fb54mr6335490qvh.5.1665958456418; Sun, 16 Oct 2022 15:14:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665958456; cv=none; d=google.com; s=arc-20160816; b=ZhnY6jvA028OReRrfR06ek6LCrJ2betwmb4HlpeNg+zBVWgyS4vUTKb+ZUxf5wBv17 5RjWOzfTHntCaqywuJ1m3K1qUjOihw9HflzOJ9azBwEizs0CvCceRY4vWjiLp8tb9yZi IM+gVT5HqDP838fTDh3Qykmrln0l9X56I2rxUtp1uxij3aOcJpa07mx7vjmPuzUjqWZW F81iNJpyi7MKX1M5vjIOp6j2UOHVDTcqO/tN1El4Vw45if2b65OJMpQAlUgMd16sx0py x0CwxOqmZjqFSzBK8MtUxhVWr3nFbzU8EH9JO6qhAlrtsdNtCU99XyvD7D+5nhnBNvne u+0Q== 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=8swKSgWeilWZrM/mNtFL8crpzMp47VFbNvAGDxXmm3Y=; b=0Wu/oN+SZKODmFv521KGfHfVXuQm36zc0s358+x3/a8ZDKyXC/wj1RQereDQaheHpR jFES139bohBSX9EYTCim6y0VjC3ngClfp2SjrK1ySV6edhcVPx6HZ2Lyz4Ki9bW+Xm0D QRPRfljnFuHd/YTmzkcn5TgV85A5RUY0UBRoKPhsO7IROdSPvbTRx4DeDZa4iYlsTuZa lwIqcg8YriMlfNuGreKRx3jymhKpZrybrCvCn5L4+G/onqD4eAfsKP+wi8BKAcD96EEH C7tpbz2vMBZ9BQGmybRTIZQc4BZ4ck114NwxGDWtujGDd0GKQVuodeNXJ8Q076jNVQqK 2KPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yTMJjJe/"; 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 f15-20020a05620a12ef00b006ee8443aa09si4483369qkl.180.2022.10.16.15.14.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 Oct 2022 15:14:16 -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="yTMJjJe/"; 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]:39352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okBte-0002Cv-Pm for patch@linaro.org; Sun, 16 Oct 2022 18:14:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okBpp-00029v-JC for qemu-devel@nongnu.org; Sun, 16 Oct 2022 18:10:17 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:51932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okBpn-0007fy-SP for qemu-devel@nongnu.org; Sun, 16 Oct 2022 18:10:17 -0400 Received: by mail-pj1-x1036.google.com with SMTP id cl1so9336213pjb.1 for ; Sun, 16 Oct 2022 15:10:15 -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 :message-id:reply-to; bh=8swKSgWeilWZrM/mNtFL8crpzMp47VFbNvAGDxXmm3Y=; b=yTMJjJe/EYbKfXpEjN9c6TI4KtLneOU3RUB9wxSByq1YMJxM3qoLvQm4TnVPtlxyIr q3KxjuJ0M6KWopgeRgEKkteFx0d7V7NApfX+XnfPOH2L54tUqd8zdNy5hyHTfuzQm2Fb fyYIFSGhA+J0+toeLQQD8chk8uiFm92wRV3/ue323VfSJzE5bdd2pylALWLfanw8oBnD +AIH42koVMgObKOylHXANHpiktNu88FwYE7FVmvI6rlVCShlA22B0puzdX5OAqdP45oj 9UV6e6OGI8Q2vT/ggtyASoszM4NMqfXbHFwIHzX2DwB5Ftbo8UJ4gtipU6DctOKPX4YL FafQ== 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:message-id:reply-to; bh=8swKSgWeilWZrM/mNtFL8crpzMp47VFbNvAGDxXmm3Y=; b=sasO4Ooy27F6J56Qu9pqp/1OvI257JJel2UeA0x3a3wPdireKLciTPbVgo8zQ9cMax G6Pc8VGu5o7N+y+TSPGlT0MXpbuTKQeUYGPMzzM50vZbMb6Q1MnJEbbTVP5SkhGeeatd oIPROOOy3KtyJyvfoCu5GaNrNeproZVojI6Edypl9XL3v2dM7Tpgfp8Ysg+uYYQBt3+s bYCql5TUkv/VAqbaTOcEgPRxkh41mJZ0A73taTQwmHnGSiR0qAevr2rCtFzn1zoZJvht x+x/gFwiMgPX3wGpcyIwp3ejHJAOSyOlYhrAFXTM7EsG1/16LYfK5umspOpwYeoqOHZy 4WQg== X-Gm-Message-State: ACrzQf2CXhUqOa4j0U6lxeUjRO7TMfVmGiWIPQYO4oDZlYbrVMqWzU29 /5nELwfXSMsa/p9WFWofeU5IS7mvTt+cdobk X-Received: by 2002:a17:90b:2705:b0:20a:b4fa:f624 with SMTP id px5-20020a17090b270500b0020ab4faf624mr10077840pjb.124.1665958214378; Sun, 16 Oct 2022 15:10:14 -0700 (PDT) Received: from localhost.localdomain ([149.135.10.35]) by smtp.gmail.com with ESMTPSA id z18-20020aa79592000000b0053e2b61b714sm5454751pfj.114.2022.10.16.15.10.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Oct 2022 15:10:13 -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 v7 1/9] target/arm: Introduce curr_insn_len Date: Mon, 17 Oct 2022 08:09:24 +1000 Message-Id: <20221016220932.274260-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221016220932.274260-1-richard.henderson@linaro.org> References: <20221016220932.274260-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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=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. 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 2f72afe019..5752b7af5c 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.