From nobody Fri Dec 19 20:13:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493753705696427.51204497074093; Tue, 2 May 2017 12:35:05 -0700 (PDT) Received: from localhost ([::1]:33342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5dZe-0003el-UA for importer@patchew.org; Tue, 02 May 2017 15:35:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5dOX-00021s-UT for qemu-devel@nongnu.org; Tue, 02 May 2017 15:23:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5dOW-0001on-Od for qemu-devel@nongnu.org; Tue, 02 May 2017 15:23:33 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:33023) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d5dOW-0001oZ-JK for qemu-devel@nongnu.org; Tue, 02 May 2017 15:23:32 -0400 Received: by mail-qk0-x243.google.com with SMTP id o85so22941788qkh.0 for ; Tue, 02 May 2017 12:23:32 -0700 (PDT) Received: from bigtime.twiddle.net.com ([2602:47:d954:1500:5e51:4fff:fe40:9c64]) by smtp.gmail.com with ESMTPSA id d65sm10664657qkc.53.2017.05.02.12.23.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 12:23:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=xnZ71bx9Vv9OjBHci2FVggBSPN2S+I5z9fCyDOCY5fM=; b=CFbj2+4ViM45NWzK2DtAOVVfzDgQRCbdP+3M7dlN+82P3mpPLhygBjMWQNEabE8e+i Kv/OcnPqVR37OUUGwp2NqWtfjBqbsc9YRKIRz/2R6dSadX8HJezXT3apoOfUZAdLKwSc I0H0yOhJADC+5jXAet4RgaKQIMhKh6zT4WKCIksezWTCkmIK7Eoa0FEsKysRvSBWNyY5 29Xd9NFmjKsgfdwkhZJlCAIHTdPwMTvVLRAJuBj02eUZ+ALMsOeWMyKF4v3x4jENQtp5 Y2QsrNpajtJjXG196WawHpOmXBewNzdK9Wq8y/om1NujuzwtTDPp6u4a0GGTlQMh693Y MFew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=xnZ71bx9Vv9OjBHci2FVggBSPN2S+I5z9fCyDOCY5fM=; b=Z5PLeQROcHcX8p9mg7DfQ2TAS8InuE3JcxXEQQozkz0CKfpiigmOb786RzMxLJHRoC cBXcjoV4vVM89/u+IubVIDT5bgpGkTeSDSb6MHapVmY2rlJ5isgNYGglosftuz1nYZYV z4DEK2ZQa+rYkFoNUoohGcJgCmjf60K7yEktJf51se/WJM5005OvJiGOH3qwDNTwOIh4 zs6Ap/m1yyfgpQtAXSYP/MsD+F6RUdJwDjPCGyV/JMDyK+9n1423EhQhhx7CeCmpf6hQ GkhfE/Ey7y7/i1RIiOAXEyJf/yS+O1zpWYe6BAZQl946rfJUHlFcX18Yif+o19UdMlC1 GeRA== X-Gm-Message-State: AN3rC/6vdyFLZkQBQ8AN75VzZU4ugoO+ZUU4aUYltqZ0gT6bNQMT+K9I lv59siKbeZEHnw== X-Received: by 10.55.128.1 with SMTP id b1mr27015219qkd.226.1493753012148; Tue, 02 May 2017 12:23:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 2 May 2017 12:22:55 -0700 Message-Id: <20170502192300.2124-21-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170502192300.2124-1-rth@twiddle.net> References: <20170502192300.2124-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::243 Subject: [Qemu-devel] [PATCH v6 20/25] target/alpha: Use tcg_gen_lookup_and_goto_ptr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/alpha/translate.c | 54 +++++++++++++++++++++++++++++++++++++++++---= ---- 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index df5d695..c2941ae 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -89,6 +89,9 @@ typedef enum { updated the PC for the next instruction to be executed. */ EXIT_PC_STALE, =20 + /* We are exiting the TB due to page crossing or space constraints. */ + EXIT_FALLTHRU, + /* We are ending the TB with a noreturn function call, e.g. longjmp. No following code will be executed. */ EXIT_NORETURN, @@ -455,11 +458,17 @@ static bool in_superpage(DisasContext *ctx, int64_t a= ddr) #endif } =20 +static bool use_exit_tb(DisasContext *ctx) +{ + return ((ctx->tb->cflags & CF_LAST_IO) + || ctx->singlestep_enabled + || singlestep); +} + static bool use_goto_tb(DisasContext *ctx, uint64_t dest) { /* Suppress goto_tb in the case of single-steping and IO. */ - if ((ctx->tb->cflags & CF_LAST_IO) - || ctx->singlestep_enabled || singlestep) { + if (unlikely(use_exit_tb(ctx))) { return false; } #ifndef CONFIG_USER_ONLY @@ -492,7 +501,12 @@ static ExitStatus gen_bdirect(DisasContext *ctx, int r= a, int32_t disp) return EXIT_GOTO_TB; } else { tcg_gen_movi_i64(cpu_pc, dest); - return EXIT_PC_UPDATED; + if (use_exit_tb(ctx)) { + return EXIT_PC_UPDATED; + } else { + tcg_gen_lookup_and_goto_ptr(cpu_pc); + return EXIT_GOTO_TB; + } } } =20 @@ -2421,7 +2435,12 @@ static ExitStatus translate_one(DisasContext *ctx, u= int32_t insn) if (ra !=3D 31) { tcg_gen_movi_i64(ctx->ir[ra], ctx->pc); } - ret =3D EXIT_PC_UPDATED; + if (use_exit_tb(ctx)) { + ret =3D EXIT_PC_UPDATED; + } else { + tcg_gen_lookup_and_goto_ptr(cpu_pc); + ret =3D EXIT_GOTO_TB; + } break; =20 case 0x1B: @@ -2677,7 +2696,12 @@ static ExitStatus translate_one(DisasContext *ctx, u= int32_t insn) tcg_gen_andi_i64(tmp, vb, 1); tcg_gen_st8_i64(tmp, cpu_env, offsetof(CPUAlphaState, pal_mode)); tcg_gen_andi_i64(cpu_pc, vb, ~3); - ret =3D EXIT_PC_UPDATED; + if (use_exit_tb(ctx)) { + ret =3D EXIT_PC_UPDATED; + } else { + tcg_gen_lookup_and_goto_ptr(cpu_pc); + ret =3D EXIT_GOTO_TB; + } break; #else goto invalid_opc; @@ -2978,7 +3002,7 @@ void gen_intermediate_code(CPUAlphaState *env, struct= TranslationBlock *tb) || num_insns >=3D max_insns || singlestep || ctx.singlestep_enabled)) { - ret =3D EXIT_PC_STALE; + ret =3D EXIT_FALLTHRU; } } while (ret =3D=3D NO_EXIT); =20 @@ -3000,8 +3024,24 @@ void gen_intermediate_code(CPUAlphaState *env, struc= t TranslationBlock *tb) tcg_gen_exit_tb(0); } break; + case EXIT_FALLTHRU: + if (ctx.singlestep_enabled) { + tcg_gen_movi_i64(cpu_pc, ctx.pc); + gen_excp_1(EXCP_DEBUG, 0); + } else if (use_exit_tb(&ctx)) { + tcg_gen_movi_i64(cpu_pc, ctx.pc); + tcg_gen_exit_tb(0); + } else if (use_goto_tb(&ctx, ctx.pc)) { + tcg_gen_goto_tb(0); + tcg_gen_movi_i64(cpu_pc, ctx.pc); + tcg_gen_exit_tb((uintptr_t)ctx.tb); + } else { + tcg_gen_movi_i64(cpu_pc, ctx.pc); + tcg_gen_lookup_and_goto_ptr(cpu_pc); + } + break; default: - abort(); + g_assert_not_reached(); } =20 gen_tb_end(tb, num_insns); --=20 2.9.3