From patchwork Wed May 19 12:51:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 442407 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1308259jac; Wed, 19 May 2021 06:12:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBIliA3JefKLFi0ELiCU3sK8M8dK2iVzJVOO78f7zx76dA6YK8Xzaq7jz42N5qicgj5n/C X-Received: by 2002:a05:6e02:547:: with SMTP id i7mr1793196ils.281.1621429939450; Wed, 19 May 2021 06:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621429939; cv=none; d=google.com; s=arc-20160816; b=YZIqaUsEXN4hy3pAtvLoIFlX+L61cIL4J2V3kg7QUjUd2BBTOr1sDZFXikOTvS6LJj Lb6QBzaMAOt1MdyIYSiAvX9S8DYHMeJzyWxNRWnvGaH9eW67CybWr7SS6xI698g8n/m0 KeKcBxpPOa19AT7OX9f1gIYCSFoU2NN7LxeanIyscEMLBlFp4hRQryG97JDh4RPC1qIR 8WoHA0vZy63Oc04x7hKzfyrlAqgSLoXirV/Fe7KPyzLYWwNTC8zssDNMgAaJUnsniXu2 4voIC3DVPha7nDRHFyCMciswHWRhBjNthy4jXN1PgOBbOuLVRUkmI0nB5M0aEy1sowrB 3A5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=wzclvABPdWRClsn9nAXiEBmCC4Vcz1c4vBNkNXuD5w0=; b=igHFrCnHGwuGJIQxHTW54dt5LvcUxG+y3eSCP1MjQ9JiiA+CzzH7zmQ2/MaULtpiy4 3k1hqjbrEQZuL9c+1HInReY180qPGxDsRhboSZ+gJgZjMuzB/hAk5U8+mUwhcTNTwwgo ZVSIIoxUoDX99AcQFsMJp+xlDBbaxKozqzjZCQo6k0GtB7YT2KCUJQEPLsrnIF1Mh5Hj 344R4LLAsmHamxSl23ji1cp1/oD2xKH0wddDESh3pI1gnZeDgyRUnd0Z7Vqi/Kf//y4g i+KsIxa28ZSHZDwZSkXzfvqC04xgfElKhK1M3DIOfpXoW+fGtPbJZgLeCSlxIY4ny96E EfUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gibson.dropbear.id.au header.s=201602 header.b=gqpRfAV2; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p14si19272857jao.86.2021.05.19.06.12.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 May 2021 06:12:19 -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=fail header.i=@gibson.dropbear.id.au header.s=201602 header.b=gqpRfAV2; 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" Received: from localhost ([::1]:53572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljLzm-00057U-TF for patch@linaro.org; Wed, 19 May 2021 09:12:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljLgt-0000tQ-EK; Wed, 19 May 2021 08:52:47 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:33637) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljLgl-0001Fh-S6; Wed, 19 May 2021 08:52:42 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4FlXnd65Rnz9t0T; Wed, 19 May 2021 22:52:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1621428725; bh=YepioIO6fM+22aWQNVJNN/CrWq02C6DWs1hzecs1a84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqpRfAV2JQ1LBZCCvgl9BFAj8BM/+Zbc6k1/IAWVzOvvSduQQna1hlEBjxanlHuxO Qm/PO4C/6yYrVT8p/tUvZdGq1MwgP5DrOgtHSFUlE5/VS9zMAl48HlUuTUa+BVIAWd GW4MinpqwFf/cnaGot7yXVlTzLb4e5a+2PeV04HA= From: David Gibson To: peter.maydell@linaro.org, groug@kaod.org Subject: [PULL 18/48] target/ppc: Move DISAS_NORETURN setting into gen_exception* Date: Wed, 19 May 2021 22:51:18 +1000 Message-Id: <20210519125148.27720-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210519125148.27720-1-david@gibson.dropbear.id.au> References: <20210519125148.27720-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Received-SPF: pass client-ip=2401:3900:2:1::2; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, qemu-devel@nongnu.org, Luis Pires , qemu-ppc@nongnu.org, Matheus Ferst , David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson There are other valid settings for is_jmp besides DISAS_NEXT and DISAS_NORETURN, so eliminating that dichotomy from ppc_tr_translate_insn is helpful. Signed-off-by: Richard Henderson Reviewed-by: Luis Pires Signed-off-by: Matheus Ferst Message-Id: <20210512185441.3619828-4-matheus.ferst@eldorado.org.br> Signed-off-by: David Gibson --- target/ppc/translate.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) -- 2.31.1 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index d6a8a04380..ac0c0e5b2c 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -264,7 +264,8 @@ static void gen_exception_err(DisasContext *ctx, uint32_t excp, uint32_t error) gen_helper_raise_exception_err(cpu_env, t0, t1); tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); - ctx->exception = (excp); + ctx->exception = excp; + ctx->base.is_jmp = DISAS_NORETURN; } static void gen_exception(DisasContext *ctx, uint32_t excp) @@ -281,7 +282,8 @@ static void gen_exception(DisasContext *ctx, uint32_t excp) t0 = tcg_const_i32(excp); gen_helper_raise_exception(cpu_env, t0); tcg_temp_free_i32(t0); - ctx->exception = (excp); + ctx->exception = excp; + ctx->base.is_jmp = DISAS_NORETURN; } static void gen_exception_nip(DisasContext *ctx, uint32_t excp, @@ -293,7 +295,8 @@ static void gen_exception_nip(DisasContext *ctx, uint32_t excp, t0 = tcg_const_i32(excp); gen_helper_raise_exception(cpu_env, t0); tcg_temp_free_i32(t0); - ctx->exception = (excp); + ctx->exception = excp; + ctx->base.is_jmp = DISAS_NORETURN; } /* @@ -339,6 +342,7 @@ static void gen_debug_exception(DisasContext *ctx) t0 = tcg_const_i32(EXCP_DEBUG); gen_helper_raise_exception(cpu_env, t0); tcg_temp_free_i32(t0); + ctx->base.is_jmp = DISAS_NORETURN; } static inline void gen_inval_exception(DisasContext *ctx, uint32_t error) @@ -9183,7 +9187,6 @@ static bool ppc_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs, DisasContext *ctx = container_of(dcbase, DisasContext, base); gen_debug_exception(ctx); - dcbase->is_jmp = DISAS_NORETURN; /* * The address covered by the breakpoint must be included in * [tb->pc, tb->pc + tb->size) in order to for it to be properly @@ -9213,18 +9216,19 @@ static void ppc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) ok = decode_legacy(cpu, ctx, insn); if (!ok) { gen_invalid(ctx); - ctx->base.is_jmp = DISAS_NORETURN; } #if defined(DO_PPC_STATISTICS) handler->count++; #endif + /* Check trace mode exceptions */ if (unlikely(ctx->singlestep_enabled & CPU_SINGLE_STEP && (ctx->base.pc_next <= 0x100 || ctx->base.pc_next > 0xF00) && ctx->exception != POWERPC_SYSCALL && ctx->exception != POWERPC_EXCP_TRAP && - ctx->exception != POWERPC_EXCP_BRANCH)) { + ctx->exception != POWERPC_EXCP_BRANCH && + ctx->base.is_jmp != DISAS_NORETURN)) { uint32_t excp = gen_prep_dbgex(ctx); gen_exception_nip(ctx, excp, ctx->base.pc_next); } @@ -9235,14 +9239,20 @@ static void ppc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) opc3(ctx->opcode), opc4(ctx->opcode), ctx->opcode); } - ctx->base.is_jmp = ctx->exception == POWERPC_EXCP_NONE ? - DISAS_NEXT : DISAS_NORETURN; + if (ctx->base.is_jmp == DISAS_NEXT + && ctx->exception != POWERPC_EXCP_NONE) { + ctx->base.is_jmp = DISAS_TOO_MANY; + } } static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) { DisasContext *ctx = container_of(dcbase, DisasContext, base); + if (ctx->base.is_jmp == DISAS_NORETURN) { + return; + } + if (ctx->exception == POWERPC_EXCP_NONE) { gen_goto_tb(ctx, 0, ctx->base.pc_next); } else if (ctx->exception != POWERPC_EXCP_BRANCH) {