From nobody Tue Feb 10 13:36:31 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1619745760; cv=none; d=zohomail.com; s=zohoarc; b=Fjsm1D2fP0y1IN0ns5EF0/WEA1Kg/9PwRfR5Dp6xYERjRORqso74oPpWi4OkUFp0k8QLFnEogjuESZU24ni5Jr6sYFZks+Nwofa53ImXAG9ijP06Pf5IYNcpqiS27A5C/QEJWXFQHVcp20IVFTUwB77l6Tw+GJP5kjhGY4jMTIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619745760; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GtzxgNF32jBOW0rDu46zgnrIq+Tr4i7MyBybLCPP5F4=; b=ji80Ll2API7dpJnt6eNf+Hkx6H3rHhE/lC3xufLrFlmMuIGDrPs2jaCxmTCWyvoKP5MVJPKqOfige9NndixQ/Cgix+z9b4pPVgFiDJPEVH/IeTnURSCWGQg6AxfZwCqFxRg0WQL027+PXGRnBBRM1asFJPnnBQelhYBIN82G1u0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161974576062464.16770466490959; Thu, 29 Apr 2021 18:22:40 -0700 (PDT) Received: from localhost ([::1]:48166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcHrb-00017M-Ge for importer@patchew.org; Thu, 29 Apr 2021 21:22:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcHlL-00030o-SH for qemu-devel@nongnu.org; Thu, 29 Apr 2021 21:16:12 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:54844) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcHl5-0007XD-8k for qemu-devel@nongnu.org; Thu, 29 Apr 2021 21:16:11 -0400 Received: by mail-pj1-x102a.google.com with SMTP id t13so9516082pji.4 for ; Thu, 29 Apr 2021 18:15:52 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id 1sm161277pjx.46.2021.04.29.18.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Apr 2021 18:15:51 -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=GtzxgNF32jBOW0rDu46zgnrIq+Tr4i7MyBybLCPP5F4=; b=pVeWUI2yN7WtPNi2VOm/Oo874xvs4K82CUJ8V7aJbKlWDd2TzXcMSiY8p3iqseb5YB F4358xlolmbHkmEsNPjwRyqXU/OC+Yr5vZHYdYV0YYy1MGJt3MedY5KEuSTyCAxfegG2 MuYB7l55/yHnuWTxVEbzMfNgkclOHwilSLHb0+HfwgRo8LVo7W0L/jv56AhcaXPKpmcl 6okhB0SDfoMLgIit33Hhia/eKojCFKPWpX1cetzazSyYslHU2e2XYguFy9jaEYsBo8fc XS1ed64kH1wE0MK1LmqEqO5iCPWD71gz4EyCD3LuT92TrdEbxv4ai2od/Kqss6NVW0x1 zcKA== 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=GtzxgNF32jBOW0rDu46zgnrIq+Tr4i7MyBybLCPP5F4=; b=fv0GsxRGgVbAiYuFyRRp6//fNCsZM1LUZwa0LqQmguwJZn89Q4Zudb4D4tWys+3WTb 2LD8/DD6JRdeYPTYBwUSCxqdR6DxOBnE35ywYmdtZBxBcpt+1Tmba9BNeGn2VkcvWlgZ 9bb8G2MRJ2GH5ygTtGQaVPVqLqjZv/uE4G2v18EwMHKVDN7CG5brricmF2XJLFl1qAVj 8yI5R4QnYqfmOPhSU5rFaHNKIk028YNkVHDxsgc3IrzSRZiT/sE3SyQAFWrgxmLowtHR SATh2/bVlf6Ce1TpP7LxajgM5PApiHqhdPpx5qqAXUPH1by04N896R0TuZab5qIpJEba 0iqw== X-Gm-Message-State: AOAM533NDGesXBKrIuY8ABgSOdHLZbFcSPOoLMnZPHmy1Naal9SVWJL3 ybkzpXxeOJQnwrBLCH/ghdN7ButqmeRt9w== X-Google-Smtp-Source: ABdhPJzAzwwCRHG807FUZPE4bfoc7aIbPj3EpodkwUPL0q1Q7fnP/kX2QP41XS3PYDW2SqoiKNnWUA== X-Received: by 2002:a17:90b:b05:: with SMTP id bf5mr2848277pjb.123.1619745351990; Thu, 29 Apr 2021 18:15:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 11/30] target/ppc: Introduce DISAS_{EXIT,CHAIN}{,_UPDATE} Date: Thu, 29 Apr 2021 18:15:24 -0700 Message-Id: <20210430011543.1017113-12-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Rewrite ppc_tr_tb_stop to handle these new codes. Convert ctx->exception into these new codes at the end of ppc_tr_translate_insn, prior to pushing the change back throughout translate.c. Signed-off-by: Richard Henderson --- target/ppc/translate.c | 75 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 65 insertions(+), 10 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index b58e2ac8dc..7dbdf3d047 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -183,6 +183,11 @@ struct DisasContext { uint64_t insns_flags2; }; =20 +#define DISAS_EXIT DISAS_TARGET_0 /* exit to main loop, pc update= d */ +#define DISAS_EXIT_UPDATE DISAS_TARGET_1 /* exit to main loop, pc stale = */ +#define DISAS_CHAIN DISAS_TARGET_2 /* lookup next tb, pc updated */ +#define DISAS_CHAIN_UPDATE DISAS_TARGET_3 /* lookup next tb, pc stale */ + /* Return true iff byteswap is needed in a scalar memop */ static inline bool need_byteswap(const DisasContext *ctx) { @@ -8080,28 +8085,78 @@ static void ppc_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cs) opc3(ctx->opcode), opc4(ctx->opcode), ctx->opcode); } =20 - if (ctx->base.is_jmp =3D=3D DISAS_NEXT - && ctx->exception !=3D POWERPC_EXCP_NONE) { - ctx->base.is_jmp =3D DISAS_TOO_MANY; + if (ctx->base.is_jmp =3D=3D DISAS_NEXT) { + switch (ctx->exception) { + case POWERPC_EXCP_NONE: + break; + case POWERPC_EXCP_BRANCH: + ctx->base.is_jmp =3D DISAS_NORETURN; + break; + case POWERPC_EXCP_SYNC: + case POWERPC_EXCP_STOP: + ctx->base.is_jmp =3D DISAS_EXIT; + break; + default: + /* Every other ctx->exception should have set NORETURN. */ + g_assert_not_reached(); + } } } =20 static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) { DisasContext *ctx =3D container_of(dcbase, DisasContext, base); + DisasJumpType is_jmp =3D ctx->base.is_jmp; + target_ulong nip =3D ctx->base.pc_next; =20 - if (ctx->base.is_jmp =3D=3D DISAS_NORETURN) { + if (is_jmp =3D=3D DISAS_NORETURN) { + /* We have already exited the TB. */ return; } =20 - if (ctx->exception =3D=3D POWERPC_EXCP_NONE) { - gen_goto_tb(ctx, 0, ctx->base.pc_next); - } else if (ctx->exception !=3D POWERPC_EXCP_BRANCH) { - if (unlikely(ctx->base.singlestep_enabled)) { - gen_debug_exception(ctx); + /* Honor single stepping. */ + if (unlikely(ctx->base.singlestep_enabled)) { + switch (is_jmp) { + case DISAS_TOO_MANY: + case DISAS_EXIT_UPDATE: + case DISAS_CHAIN_UPDATE: + gen_update_nip(ctx, nip); + break; + case DISAS_EXIT: + case DISAS_CHAIN: + break; + default: + g_assert_not_reached(); } - /* Generate the return instruction */ + gen_debug_exception(ctx); + return; + } + + switch (is_jmp) { + case DISAS_TOO_MANY: + if (use_goto_tb(ctx, nip)) { + tcg_gen_goto_tb(0); + gen_update_nip(ctx, nip); + tcg_gen_exit_tb(ctx->base.tb, 0); + break; + } + /* fall through */ + case DISAS_CHAIN_UPDATE: + gen_update_nip(ctx, nip); + /* fall through */ + case DISAS_CHAIN: + tcg_gen_lookup_and_goto_ptr(); + break; + + case DISAS_EXIT_UPDATE: + gen_update_nip(ctx, nip); + /* fall through */ + case DISAS_EXIT: tcg_gen_exit_tb(NULL, 0); + break; + + default: + g_assert_not_reached(); } } =20 --=20 2.25.1