From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FF97606A325 for ; Tue, 1 Dec 2026 23:22:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=k+iKQcXc Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xYXAt-0001JE-6D; Tue, 01 Dec 2026 18:22:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYXAm-0001Hq-Pc for qemu-devel@nongnu.org; Tue, 01 Dec 2026 18:22:09 -0500 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYXAk-0004zm-Tk for qemu-devel@nongnu.org; Tue, 01 Dec 2026 18:22:08 -0500 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 3230C62247; Tue, 1 Dec 2026 23:22:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E29481F0182E; Tue, 1 Dec 2026 23:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796167325; bh=ozl/UUxCAoJGwGcYviu/XWOF9AbZAMKBlxbKoXiUTfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=k+iKQcXcjOxQnpZ50jwJPeLFi/HEbOFWM2pYBtuVG1lYr9hl+kUOKgbxIOMgI5Wvr vPn1vQmxwCK8R0IadecwqJk18iJr/HwV7qQM5lAPttEmHnA3k/gLkI8CcivUgSkpsU B2vWJzfrg5U8caaItwSRoQ6fF4GS5cJ9QOrMPWCONEkbUa90wCsXYkAZH+pHEvD/tV qKa6yn9/9kHCFORZ1d3XgfCNGqxHoY0HcO4OSsgW+/1kWIXAoA2mZioL6UzesNLniP XpIDsw2tJZrGqNvmywBeUnA1K1YJFvWvln74goYKznMjs0hhfLRMIk1Ff2REH5QCmo aQb3NuIGfA1tA== From: Helge Deller To: qemu-devel@nongnu.org Cc: "Kirill A . Korinsky" , Helge Deller Subject: [PULL for 11.2 4/4] target/hppa: Fix tcg_gen_goto_tb assertion Date: Wed, 2 Dec 2026 00:21:54 +0100 Message-ID: <20261201232154.3178-5-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261201232154.3178-1-deller@kernel.org> References: <20261201232154.3178-1-deller@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2600:3c04:e001:324:0:1991:8:25; envelope-from=deller@kernel.org; helo=tor.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: qemu development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-23.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_PASS,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: "Kirill A. Korinsky" On hppa a branch may generate three exits from one block, but qemu has only two slots; the third exit reused slot 0 and badaboom happened. Try to assign a unique slot to avoid the problem. Signed-off-by: Kirill A. Korinsky Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4835 Signed-off-by: Helge Deller --- target/hppa/translate.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index c8e2b13c8c..70bc7deabd 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -85,6 +85,7 @@ typedef struct DisasContext { uint32_t tb_flags; int mmu_idx; int privilege; + unsigned goto_tb_idx; uint32_t psw_xb; bool psw_n_nonzero; bool psw_b_next; @@ -791,7 +792,8 @@ static bool gen_illegal(DisasContext *ctx) static bool use_goto_tb(DisasContext *ctx, const DisasIAQE *f, const DisasIAQE *b) { - return (!iaqe_variable(f) && + return (ctx->goto_tb_idx <= TB_EXIT_IDXMAX && + !iaqe_variable(f) && (b == NULL || !iaqe_variable(b)) && translator_use_goto_tb(&ctx->base, ctx->iaoq_first + f->disp)); } @@ -808,11 +810,13 @@ static bool use_nullify_skip(DisasContext *ctx) & TARGET_PAGE_MASK) == 0); } -static void gen_goto_tb(DisasContext *ctx, int which, +static void gen_goto_tb(DisasContext *ctx, const DisasIAQE *f, const DisasIAQE *b) { install_iaq_entries(ctx, f, b); if (use_goto_tb(ctx, f, b)) { + unsigned which = ctx->goto_tb_idx++; + tcg_gen_goto_tb(which); tcg_gen_exit_tb(ctx->base.tb, which); } else { @@ -1960,7 +1964,7 @@ static bool do_dbranch(DisasContext *ctx, int64_t disp, if (use_nullify_skip(ctx)) { nullify_set(ctx, 0); store_psw_xb(ctx, 0); - gen_goto_tb(ctx, 0, &ctx->iaq_j, NULL); + gen_goto_tb(ctx, &ctx->iaq_j, NULL); ctx->base.is_jmp = DISAS_NORETURN; return true; } @@ -1975,17 +1979,17 @@ static bool do_dbranch(DisasContext *ctx, int64_t disp, if (is_n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); store_psw_xb(ctx, 0); - gen_goto_tb(ctx, 0, &ctx->iaq_j, NULL); + gen_goto_tb(ctx, &ctx->iaq_j, NULL); } else { nullify_set(ctx, is_n); store_psw_xb(ctx, PSW_B); - gen_goto_tb(ctx, 0, &ctx->iaq_b, &ctx->iaq_j); + gen_goto_tb(ctx, &ctx->iaq_b, &ctx->iaq_j); } nullify_end(ctx); nullify_set(ctx, 0); store_psw_xb(ctx, 0); - gen_goto_tb(ctx, 1, &ctx->iaq_b, NULL); + gen_goto_tb(ctx, &ctx->iaq_b, NULL); ctx->base.is_jmp = DISAS_NORETURN; } return true; @@ -2017,7 +2021,7 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, nullify_set(ctx, 0); store_psw_xb(ctx, 0); next = iaqe_incr(&ctx->iaq_b, 4); - gen_goto_tb(ctx, 0, &next, NULL); + gen_goto_tb(ctx, &next, NULL); } else { if (!n && ctx->null_lab) { gen_set_label(ctx->null_lab); @@ -2025,7 +2029,7 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, } nullify_set(ctx, n); store_psw_xb(ctx, 0); - gen_goto_tb(ctx, 0, &ctx->iaq_b, NULL); + gen_goto_tb(ctx, &ctx->iaq_b, NULL); } gen_set_label(taken); @@ -2037,11 +2041,11 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, if (n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); store_psw_xb(ctx, 0); - gen_goto_tb(ctx, 1, &next, NULL); + gen_goto_tb(ctx, &next, NULL); } else { nullify_set(ctx, n); store_psw_xb(ctx, PSW_B); - gen_goto_tb(ctx, 1, &ctx->iaq_b, &next); + gen_goto_tb(ctx, &ctx->iaq_b, &next); } /* Not taken: the branch itself was nullified. */ @@ -4970,7 +4974,7 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) && (ctx->null_cond.c == TCG_COND_NEVER || ctx->null_cond.c == TCG_COND_ALWAYS)) { nullify_set(ctx, ctx->null_cond.c == TCG_COND_ALWAYS); - gen_goto_tb(ctx, 0, f, b); + gen_goto_tb(ctx, f, b); break; } /* FALLTHRU */ -- 2.54.0