From patchwork Fri Apr 30 01:15:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 429735 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp2109335jao; Thu, 29 Apr 2021 18:28:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTubMkkczin33nai4fy4eRXU/9HLzFmLGd9boP6wZiRzaouXjXDGBQs+hPt9XsOtdB0Ka9 X-Received: by 2002:aca:5c44:: with SMTP id q65mr2105606oib.12.1619746103892; Thu, 29 Apr 2021 18:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619746103; cv=none; d=google.com; s=arc-20160816; b=FF8XrOda1KWu4CKTbD8vVaP1trmIg4Kdd8LFTACfOzsun+AZoNAEFcUeNXxj74wR5b nGMRjGpo6LazpXukChSKU7Y2SkmXoI9cP6zB7z65MGkeaQVrijMaC1336fxnpa57oQfz zHY7LYOZ3C6bUiKumOe3X+/YWjD72dGgqq5KDA0f179w3OrcOE+XR2qcLZQ9aaOYZgYB 67R7sWn+//ci4NqmCmj4UO1yBVDpJWRWPEMKajajPdVenv8VHMNJ4ciq+Qh2OL23iIwC c62551089DbXbdHMP8ScPoHYG8fMpS46UDuqHuebXD3uTZ0NaYpzp+1xWjlvOYuY2LlL aQxg== 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=jt6WDlTVZ95m5Svb67/E+vHr02oKATGFQUbtmFvmoVU=; b=rwZNkBOMc0ljy5EBet3CF5gHI0x9kV+2Z1MQ7Sf+MF0uwT7v4x07cE5/7YbIGUFzo5 8sbR8MOEtq4SDYBoiqgszd2KDkRQZASs75zR1SrD6oaKaEPPdS71n5Zfz97VgyWAlBds Uk3At1unoUtKyjuRK2PZBPGhqzI6/suLfgN2+p6ZlEB09bGppv5JdB+m/kFKJczJKr62 lAdl2F75XEsdTWFz4W3Svr340q358FgR4ErxcMMtTp6gQm/2AzbPrLQLzLGjgWGsWCzV lGOLBbl7V4nYmmtLQqnL5wGyrWfNcvzJCmT5Zab+kjog9bdnUaB5Vp/gWRqc4Ct2NDzZ R6ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NOVOgnWW; 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=fail (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 d24si2168623oti.304.2021.04.29.18.28.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Apr 2021 18:28:23 -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=@linaro.org header.s=google header.b=NOVOgnWW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcHx8-0006Xw-AL for patch@linaro.org; Thu, 29 Apr 2021 21:28:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcHlO-00035p-Mz for qemu-devel@nongnu.org; Thu, 29 Apr 2021 21:16:15 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:38836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcHl5-0007VY-Ah for qemu-devel@nongnu.org; Thu, 29 Apr 2021 21:16:14 -0400 Received: by mail-pg1-x530.google.com with SMTP id i14so3864522pgk.5 for ; Thu, 29 Apr 2021 18:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jt6WDlTVZ95m5Svb67/E+vHr02oKATGFQUbtmFvmoVU=; b=NOVOgnWW3ffgAEJaN82rP2fiN343BOGcF5WvNrqVFJIUAxyQXEAGv24HXv15GHTseN f6E0w4TPDVqiwBQmbiLGhmOaPNo3tp93kXStHruzAQmY36OVJBR9jUMdlKqDxXEi8fC3 iUWgXqqYtEvD1L9NiDDd6y8UfddpL3WY0iXeov4LcbbTowVKiSP1r/nTnBUnk5m2AYEg T4B6BY5VYWGS39sEZp6bgpO6TFD34ezMS2ARts5FEKoOdlo1nV2qwWSRlb2nXDH5ojNP 0J3wh0uhcZa6nmH2c/n4qyXvQC3qYTNHwkp1459CUqL80ErD8UVV5sdLRhy2Fmf/lrHU A8lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jt6WDlTVZ95m5Svb67/E+vHr02oKATGFQUbtmFvmoVU=; b=rryLL8rtEL6TztDMvn2GmKO7I3+ASzmYdc0BhzatAg234VwcdMYyqWoHB23I232xbL VbNe7biqwqdJ0EGb4foCOPwSVtCAgqIbm/QQ3dV+jkufJB1ZZO33PzXEPIPan3/dQ9Kz sBxZo7jmZTEsj6BeI315dctqtBAY9EXLIQ4qKcUlonp4zBm0W1CJMTWpvHJ86a332OmT RkGOvFb/AyrlxLxBYNwh9lljGGc3y2z7ONnE+GBqWbrP2q1XnwAAIGdH6RrTVcTPMbYn fv+1ulKdbrsTyj+T3ywntB1558dghKjsW/EG0TcplTuWphicbZeBB+ulheo0aXrx/VQd 55pA== X-Gm-Message-State: AOAM533IkasQIbyUyYP579DvWn6j/M+IQPDzrpR27RexE8BhLqqOY3dt 2ERce0qs2wDhTkW+afY62LqAVHBfzA/3DA== X-Received: by 2002:a65:6147:: with SMTP id o7mr2344172pgv.157.1619745349423; Thu, 29 Apr 2021 18:15:49 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id 1sm161277pjx.46.2021.04.29.18.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Apr 2021 18:15:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 07/30] target/ppc: Move DISAS_NORETURN setting into gen_exception* Date: Thu, 29 Apr 2021 18:15:20 -0700 Message-Id: <20210430011543.1017113-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210430011543.1017113-1-richard.henderson@linaro.org> References: <20210430011543.1017113-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f4bug@amsat.org, luis.pires@eldorado.org.br, qemu-ppc@nongnu.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- v3: Retain an exit from translator loop for ctx->exception. Do not emit code for single-step or ppc_tr_tb_stop for NORETURN. --- target/ppc/translate.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) -- 2.25.1 Reviewed-by: Luis Pires diff --git a/target/ppc/translate.c b/target/ppc/translate.c index ebe5afe7ae..3607cc12f3 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -262,7 +262,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) @@ -279,7 +280,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, @@ -291,7 +293,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; } /* @@ -337,6 +340,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) @@ -8037,7 +8041,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 @@ -8067,18 +8070,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); } @@ -8089,14 +8093,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) {