From patchwork Mon Aug 22 23:23:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 599214 Delivered-To: patch@linaro.org Received: by 2002:a05:6918:5e84:b0:d4:ea33:5523 with SMTP id nd4csp2087078ysb; Mon, 22 Aug 2022 16:33:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR6CFNQsSQ84bhtUzqbFQJzLP6Re6/R2qEaNfm8PvfKGOQivnj7mHcslkbZX3PmcEB06CjuJ X-Received: by 2002:a05:620a:b04:b0:6ba:e707:b245 with SMTP id t4-20020a05620a0b0400b006bae707b245mr14158126qkg.418.1661211201116; Mon, 22 Aug 2022 16:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661211201; cv=none; d=google.com; s=arc-20160816; b=0UTVcHBzM6dFec/ytVqGs6U6XM9a4f1sSM+wUdP2OS6aoZHs6N9GtYeBalw3qbNquy eNPSxFXSNMVz1EZP7vcVfZgwmg5+QvXoos7mrEuJQ1YXYkbF+hfW8L9zREsnvMQB67uQ EUevqqDIckjsxKAkoc247krI2Nps17tAwfaH459+0PmcUjwKQKNiV/oWZH6UbeUVPzpx ywfrOtbsqbOgm26JFBoCN22n2cg0uyLQJ+0QDsDlQ+Fekp8L9LGajKGuR1RMsX3PH53r 38/nc7n+25H13dLwvce/E4Bwz75lJVeAku+BZ0lEHNgzXGo/Ys6z0h9r7FN6dkzf3cKp OZKQ== 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=sptqSn2q1MUxoiSJ0oXgREmv1FSN9FwBedSu534JEYA=; b=af7AT+7iu5EADiUEqzyYzCOcI3WGb55OdDJgP6MxaXrDO3EJIi8T/7N4EjGKiX4UNL e86qD6tCU8GAbOjcPm0Edzy+1+z+fNOiEBmOSy0yt84xKCifa01wvOthFDrUPBGXN5FG smAvQm6MZBr88/qUCQokioNEm/ZflQumYJbzow8c4qpb0WckFrbt/OvXnMsmsd9CWihD Sz66qaWyzNEDNzvsjqs5eBvI9/pRMhm3ORfb9O/V2TbrkgXcmSTDm1LiMUqaiPShw8m2 EUkUsS0rQm5V70RLEJB2Cybqb2EjyVPV4FagduBI4vCWCyLH3oaAB1+usegQ/5k1hgU9 Uikg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y4HA7aue; 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 bi6-20020a05620a318600b006b894b8cbd1si5411071qkb.632.2022.08.22.16.33.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Aug 2022 16:33:21 -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=Y4HA7aue; 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]:43774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQGv2-0002xE-M8 for patch@linaro.org; Mon, 22 Aug 2022 19:33:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGlz-0005jS-2p for qemu-devel@nongnu.org; Mon, 22 Aug 2022 19:24:00 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:46949) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGlx-0005ey-7G for qemu-devel@nongnu.org; Mon, 22 Aug 2022 19:23:58 -0400 Received: by mail-pj1-x102d.google.com with SMTP id o14-20020a17090a0a0e00b001fabfd3369cso12896490pjo.5 for ; Mon, 22 Aug 2022 16:23:55 -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=sptqSn2q1MUxoiSJ0oXgREmv1FSN9FwBedSu534JEYA=; b=Y4HA7aueTTLEjKrTksc2JhCldaozROqYR6Gx02urcSo8z+bmaYmwHNY6eVslVM5R2L dV7Awf/nQjTEoeBIeQhF159q8CAqUDZo7ez8TbHoIoKbAhaUA4ENU3y/PMhd/fcFi9TH hEP3l9hbzq1A57fXUzs9V5xbqjbeEn80m0g0QaXqMUaseNZSz6wHq5kF7ZYjLsX2prPX vCdFkydOP2UO9+HpNYz8/Tri4SV6n3ROQPYiomAOF73OMLAyd1+bYxI5N/EWhoCTMRAm GGb8eaTB8DMFZ2CKo/7TAJbrS8KnYB5rra5A8by9LaSraV4RdHGaLRCBja9DbedNol6z Q4mQ== 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=sptqSn2q1MUxoiSJ0oXgREmv1FSN9FwBedSu534JEYA=; b=Y077C/SYcrG3Zhf6XqX2ivpcViWEp9SJgO0aCSQcmoVuKA2wMtKfYjp9YliNWzS+zr i+AThCxCQ8s1xyftfGr6BH6L4hA/KPsolj1VfHCT+TFMoo7SgFYlewAw+QzXATTaCsuO jPXopYnxNLCM9oVfKFC4hX0yuZ6AAGUlDUFwZiy/gDGw6ApEM/eaOJkc/zG9RUM9488/ lWLBkQDd2768zgRiAe3W4HldA0SHM98fO8OFwYhEN0C35xh9EKqiXs18cgCsc7dk2S81 Q6ILmZ7isWVEgtzy1KnTBq6Joci3ANuQ/xWqtXEp/HztG4/cU+LfHAbzlHaxzCzvEB/0 C20Q== X-Gm-Message-State: ACgBeo2ss3IOaY1mlWQQ0CGfoziU7I0So7uffrVeI8Vd8sbksxKUjnDp au11pXljiLOW7KpAqovCPN+5PGzf6ny/zg== X-Received: by 2002:a17:90b:4b47:b0:1f7:2e06:5752 with SMTP id mi7-20020a17090b4b4700b001f72e065752mr584289pjb.187.1661210634918; Mon, 22 Aug 2022 16:23:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 16:23:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v3 13/17] target/arm: Change gen_exception_internal to work on displacements Date: Mon, 22 Aug 2022 16:23:34 -0700 Message-Id: <20220822232338.1727934-14-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::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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" In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 6 +++--- target/arm/translate.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 422ce9288d..b777742643 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -340,9 +340,9 @@ static void gen_exception_internal(int excp) gen_helper_exception_internal(cpu_env, tcg_constant_i32(excp)); } -static void gen_exception_internal_insn(DisasContext *s, uint64_t pc, int excp) +static void gen_exception_internal_insn(DisasContext *s, int pc_diff, int excp) { - gen_a64_update_pc(s, pc - s->pc_curr); + gen_a64_update_pc(s, pc_diff); gen_exception_internal(excp); s->base.is_jmp = DISAS_NORETURN; } @@ -2229,7 +2229,7 @@ static void disas_exc(DisasContext *s, uint32_t insn) break; } #endif - gen_exception_internal_insn(s, s->pc_curr, EXCP_SEMIHOST); + gen_exception_internal_insn(s, 0, EXCP_SEMIHOST); } else { unallocated_encoding(s); } diff --git a/target/arm/translate.c b/target/arm/translate.c index d441e31d3a..63a41ed438 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1078,10 +1078,10 @@ static inline void gen_smc(DisasContext *s) s->base.is_jmp = DISAS_SMC; } -static void gen_exception_internal_insn(DisasContext *s, uint32_t pc, int excp) +static void gen_exception_internal_insn(DisasContext *s, int pc_diff, int excp) { gen_set_condexec(s); - gen_update_pc(s, pc - s->pc_curr); + gen_update_pc(s, pc_diff); gen_exception_internal(excp); s->base.is_jmp = DISAS_NORETURN; } @@ -1175,7 +1175,7 @@ static inline void gen_hlt(DisasContext *s, int imm) s->current_el != 0 && #endif (imm == (s->thumb ? 0x3c : 0xf000))) { - gen_exception_internal_insn(s, s->pc_curr, EXCP_SEMIHOST); + gen_exception_internal_insn(s, 0, EXCP_SEMIHOST); return; } @@ -6565,7 +6565,7 @@ static bool trans_BKPT(DisasContext *s, arg_BKPT *a) !IS_USER(s) && #endif (a->imm == 0xab)) { - gen_exception_internal_insn(s, s->pc_curr, EXCP_SEMIHOST); + gen_exception_internal_insn(s, 0, EXCP_SEMIHOST); } else { gen_exception_bkpt_insn(s, syn_aa32_bkpt(a->imm, false)); } @@ -8773,7 +8773,7 @@ static bool trans_SVC(DisasContext *s, arg_SVC *a) !IS_USER(s) && #endif (a->imm == semihost_imm)) { - gen_exception_internal_insn(s, s->pc_curr, EXCP_SEMIHOST); + gen_exception_internal_insn(s, 0, EXCP_SEMIHOST); } else { gen_update_pc(s, curr_insn_len(s)); s->svc_imm = a->imm;