From patchwork Fri Sep 30 22:03:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 610974 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1764963pvb; Fri, 30 Sep 2022 15:05:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Yq62P2cKTiI78jML2rj/spc9z5/mDKMwJBNw7lphBwWSQJHCzDXF+c3ccj7x9ZpAlX0fB X-Received: by 2002:ad4:5c8b:0:b0:4aa:8a44:8810 with SMTP id o11-20020ad45c8b000000b004aa8a448810mr8826008qvh.4.1664575524182; Fri, 30 Sep 2022 15:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664575524; cv=none; d=google.com; s=arc-20160816; b=oGkFjDIwpD+efsBnPFiomE12AL6LhqaVjiBHSzd+6r1R8uJ/1gWwqyrIBLSY3dxCdq Fd7AfMwsZB3GTY9ceSegCzYfbHkcNaY91bpsdP0/R8hDU0gqfAiEexvkrehr6iR+kdox vdNVXXHTYRjAepUug2JdDfxIuejNxhV40xtMj8Fn0GOduKS/cWwz0CiGDXzJABwdQ71D 4EY8eEJDTPp3zUDaKflRXWOuMYTatD1ksVeDBoNV2uuqgutaDSFCRmpKviYLFCYCBQm/ 0hN85kb7/cI11AmT3V06kv8FTNnhEM0rG7x/4FvI3EcPQlQhzyKSthjS4Zc6LKIWSVs7 pF5Q== 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=6YmhwBNEkuM0BFWCxU5vS57JWawvJkZaQY6laYf14Ok=; b=cnxJBfn04tZ8AnmYWPEF/KT0/UlRWFn62eqDC4ffQA0mC5hzlFnrS0Yyb6G6O44Oo0 pfEIlZci7E+v7j/BPkx73YUo5PaGdnQZhE9ccvWtk7ipVM5rMZvdfSp5uEh0IHVMlsV6 C0TrrCMDtZ0stsqf2U61R3cpZNAkZV0O6+9CvUfSZxxvmkiewrCv+djiCRhAz7zKBzwV alQLWJQKFF2lRzAAc6piWVd8RECWXPvwBC6UNrCBDC4NFSAETWTFvuR8bJA4jRYXkyNf N9OVDpGGaChGgLtiiwbghgcuAqZ1xQ7v6DsyuIaVENq7KIAnGQl6zahph7P/WCN9k/8V wKQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="A68L/Obd"; 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 9-20020a05621420a900b004990f3b13f4si1687726qvd.531.2022.09.30.15.05.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Sep 2022 15:05:24 -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="A68L/Obd"; 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]:45528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeO8J-0001jD-Lj for patch@linaro.org; Fri, 30 Sep 2022 18:05:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeO6S-0001h4-C1 for qemu-devel@nongnu.org; Fri, 30 Sep 2022 18:03:28 -0400 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]:45024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oeO6Q-0002Y3-Km for qemu-devel@nongnu.org; Fri, 30 Sep 2022 18:03:28 -0400 Received: by mail-qt1-x82c.google.com with SMTP id f26so3490394qto.11 for ; Fri, 30 Sep 2022 15:03:26 -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=6YmhwBNEkuM0BFWCxU5vS57JWawvJkZaQY6laYf14Ok=; b=A68L/ObdFP6GjSRgWpsuqYmjyX51OOHTpW6pCITLPNViOwdQBlGdiRuKpzm+nFy3db qFa0WxYCV02yQ+1I1Bp6wuYsSxF6+5WDDFkYqMR0VVgN7HWL7Ng3SNaNC8LpqOw8oB+W 8ZNONEEuX2N6ZgelRQZZ9o5mzRQVG0XYbNxHIsxWqMG6eZLy7oG+Jr8OlMgOby7ZQ+HE VH90pA/Phawd3qZPgTYgkOfvVY7nz4cifO6owrNaALsWle8l5xihMvhXgmhUSJeQiFQQ ksR7XMZjmh1wokfGvSU8i3w5suB95BgDPiuv/GQC+N56qIOzkjSigKx+pm4n8mWvwStf cHiQ== 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=6YmhwBNEkuM0BFWCxU5vS57JWawvJkZaQY6laYf14Ok=; b=g20Yby2q4zJbgMCCEp8a1n4/djDF6yjemxbSrOeUyKeID/Swg/CkRkzs+CAllOsxLp IgPpDAAGD3mF7okRzHbVAMngmd4VqBCpTRpNl9b2vfjkpLBzVaQBaKkGv/fzFsykHeIn bjB8IX3SCff9nbYHAeEHv7YLbA7Se/hC/LIdFDye+itDhHWbRDLiuBzxYlZVqNtbx/7Q MMBmu+Q7p7PBbaFz5/u+YZoWfbxeGFmRhscURM356T00x8e8SxGD93iuQoalwVTEVeS9 gKGzRVANhLOa8JoA9ZCQKit8ycWqMOmVjicpaoaI+z/ZbasvZ4dG+gaQ9TdOUz9lI7gy 5ZLQ== X-Gm-Message-State: ACrzQf0oeyr8Ic5ROKBWvcr7w/BqvWTgV1ovBtgaJxIq7/RX5Mxon/j4 RG9TCe+LUj/EMm4Segxp5qh06AdzPQF9Ag== X-Received: by 2002:ac8:4e94:0:b0:35d:5266:ac9c with SMTP id 20-20020ac84e94000000b0035d5266ac9cmr8860915qtp.177.1664575405971; Fri, 30 Sep 2022 15:03:25 -0700 (PDT) Received: from stoup.. ([2605:ef80:80a1:5a60:d0d7:468b:5667:114b]) by smtp.gmail.com with ESMTPSA id o15-20020a05620a22cf00b006bb78d095c5sm3196055qki.79.2022.09.30.15.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 15:03:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v5 5/9] target/arm: Remove gen_exception_internal_insn pc argument Date: Fri, 30 Sep 2022 15:03:08 -0700 Message-Id: <20220930220312.135327-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220930220312.135327-1-richard.henderson@linaro.org> References: <20220930220312.135327-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::82c; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x82c.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" In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Since we always pass dc->pc_curr, fold the arithmetic to zero displacement. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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 2621b3b36a..005fd767fb 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 excp) { - gen_a64_update_pc(s, pc - s->pc_curr); + gen_a64_update_pc(s, 0); gen_exception_internal(excp); s->base.is_jmp = DISAS_NORETURN; } @@ -2219,7 +2219,7 @@ static void disas_exc(DisasContext *s, uint32_t insn) * Secondly, "HLT 0xf000" is the A64 semihosting syscall instruction. */ if (semihosting_enabled(s->current_el == 0) && imm16 == 0xf000) { - gen_exception_internal_insn(s, s->pc_curr, EXCP_SEMIHOST); + gen_exception_internal_insn(s, EXCP_SEMIHOST); } else { unallocated_encoding(s); } diff --git a/target/arm/translate.c b/target/arm/translate.c index f9d3128656..e0b1d415a2 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 excp) { gen_set_condexec(s); - gen_update_pc(s, pc - s->pc_curr); + gen_update_pc(s, 0); gen_exception_internal(excp); s->base.is_jmp = DISAS_NORETURN; } @@ -1173,7 +1173,7 @@ static inline void gen_hlt(DisasContext *s, int imm) */ if (semihosting_enabled(s->current_el != 0) && (imm == (s->thumb ? 0x3c : 0xf000))) { - gen_exception_internal_insn(s, s->pc_curr, EXCP_SEMIHOST); + gen_exception_internal_insn(s, EXCP_SEMIHOST); return; } @@ -6560,7 +6560,7 @@ static bool trans_BKPT(DisasContext *s, arg_BKPT *a) if (arm_dc_feature(s, ARM_FEATURE_M) && semihosting_enabled(s->current_el == 0) && (a->imm == 0xab)) { - gen_exception_internal_insn(s, s->pc_curr, EXCP_SEMIHOST); + gen_exception_internal_insn(s, EXCP_SEMIHOST); } else { gen_exception_bkpt_insn(s, syn_aa32_bkpt(a->imm, false)); } @@ -8766,7 +8766,7 @@ static bool trans_SVC(DisasContext *s, arg_SVC *a) if (!arm_dc_feature(s, ARM_FEATURE_M) && semihosting_enabled(s->current_el == 0) && (a->imm == semihost_imm)) { - gen_exception_internal_insn(s, s->pc_curr, EXCP_SEMIHOST); + gen_exception_internal_insn(s, EXCP_SEMIHOST); } else { gen_update_pc(s, curr_insn_len(s)); s->svc_imm = a->imm;