From nobody Tue Feb 10 05:45:49 2026 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.zohomail.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 150471410709973.84143162171324; Wed, 6 Sep 2017 09:08:27 -0700 (PDT) Received: from localhost ([::1]:36962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpcsL-0001Sq-Rn for importer@patchew.org; Wed, 06 Sep 2017 12:08:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpcqL-0008MH-5d for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpcqI-0001V2-IS for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:21 -0400 Received: from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]:34779) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dpcqI-0001UB-At for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:18 -0400 Received: by mail-pf0-x22c.google.com with SMTP id m1so13484072pfk.1 for ; Wed, 06 Sep 2017 09:06:18 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id t65sm262863pfk.59.2017.09.06.09.06.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Sep 2017 09:06:16 -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; bh=oktER+wQnBzv+YFYPe9eDSwDzOT9j+VLlJ0DA6KaCfc=; b=QP4/mR22W97tNZeuIsjeUS1wcN5dzNYXiM02/CctYzMSO/pc6R24rnx0DqBLLKCl7J xo9bGZegILi3ytnnim1C2qT0XXzzKOEtsZAB0d3G0USXTFnGO7tnlTRybZcQH0Qa3lUM J8ZDNgb26Yr/yGQagGS1PjnKcFe7JRnoy2u7c= 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; bh=oktER+wQnBzv+YFYPe9eDSwDzOT9j+VLlJ0DA6KaCfc=; b=dOF9rxo9uwpUsAXJpCB+tFMScme/FIEEbcpLu+HsMHcuv9OA6GiDOIXUoJlZf1tNt0 4wVW8mgEGZXGa+hBxYWOuRBCT248toxFd7Dq2xubUKpteRcnjtPJ2ky5GA1AMGqYVNcF ZvZckUFIZJ6+OBoP4WwTIxqJp8JTXhDEADa5t3Kvp2BzxLiiAbK21VD9vjCusUHbCRPY jNdL6H52w8Q4CmQsFUO697Zy3jTOi0zMbXX3+Wjzgo2cp3oOafKCJXWGVnupS3QpRFy1 O3Daf2AhK1DApHKIJqN2zTmWP2u0A5FPV6xBWygAt4SvlIFZb4bE5dKuCwT2YehNm6ay sVoA== X-Gm-Message-State: AHPjjUhPHeKLDjyOeR8S5QyR9uoCL0MZ1bHVOkCyjwC3phxvQOBNqho8 ghQ6btVXaAJKtbZmJC7vSQ== X-Google-Smtp-Source: ADKCNb5HrxweZeF6botC2mBMtGXtfgFqKHrEz080ysQfRMWWPwkAAVGSZ/NtVMc1XnRr5JIaHXdSWQ== X-Received: by 10.99.126.84 with SMTP id o20mr8271426pgn.137.1504713976979; Wed, 06 Sep 2017 09:06:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 09:05:42 -0700 Message-Id: <20170906160612.22769-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170906160612.22769-1-richard.henderson@linaro.org> References: <20170906160612.22769-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::22c Subject: [Qemu-devel] [PULL 02/32] target/i386: Use generic DISAS_* enumerators 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: peter.maydell@linaro.org, Richard Henderson 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" From: Richard Henderson This target is not sophisticated in its use of cleanups at the end of the translation loop. For the most part, any condition that exits the TB is dealt with by emitting the exiting opcode right then and there. Therefore the only is_jmp indicator that is needed is DISAS_NORETURN. For two stack segment modifying cases, we have not yet exited the TB (therefore DISAS_NORETURN feels wrong), but intend to exit. The caller of gen_movl_seg_T0 currently checks for any non-zero value, therefore DISAS_TOO_MANY seems acceptable for that usage. Reviewed-by: Emilio G. Cota Signed-off-by: Richard Henderson --- target/i386/translate.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 5fdadf98cf..26e8002433 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -31,6 +31,7 @@ #include "trace-tcg.h" #include "exec/log.h" =20 +#define DISAS_TOO_MANY 5 =20 #define PREFIX_REPZ 0x01 #define PREFIX_REPNZ 0x02 @@ -2153,6 +2154,7 @@ static inline void gen_goto_tb(DisasContext *s, int t= b_num, target_ulong eip) tcg_gen_goto_tb(tb_num); gen_jmp_im(eip); tcg_gen_exit_tb((uintptr_t)s->tb + tb_num); + s->is_jmp =3D DISAS_NORETURN; } else { /* jump to another page */ gen_jmp_im(eip); @@ -2173,7 +2175,6 @@ static inline void gen_jcc(DisasContext *s, int b, =20 gen_set_label(l1); gen_goto_tb(s, 1, val); - s->is_jmp =3D DISAS_TB_JUMP; } else { l1 =3D gen_new_label(); l2 =3D gen_new_label(); @@ -2243,12 +2244,14 @@ static void gen_movl_seg_T0(DisasContext *s, int se= g_reg) because ss32 may change. For R_SS, translation must always stop as a special handling must be done to disable hardware interrupts for the next instruction */ - if (seg_reg =3D=3D R_SS || (s->code32 && seg_reg < R_FS)) - s->is_jmp =3D DISAS_TB_JUMP; + if (seg_reg =3D=3D R_SS || (s->code32 && seg_reg < R_FS)) { + s->is_jmp =3D DISAS_TOO_MANY; + } } else { gen_op_movl_seg_T0_vm(seg_reg); - if (seg_reg =3D=3D R_SS) - s->is_jmp =3D DISAS_TB_JUMP; + if (seg_reg =3D=3D R_SS) { + s->is_jmp =3D DISAS_TOO_MANY; + } } } =20 @@ -2420,7 +2423,7 @@ static void gen_exception(DisasContext *s, int trapno= , target_ulong cur_eip) gen_update_cc_op(s); gen_jmp_im(cur_eip); gen_helper_raise_exception(cpu_env, tcg_const_i32(trapno)); - s->is_jmp =3D DISAS_TB_JUMP; + s->is_jmp =3D DISAS_NORETURN; } =20 /* Generate #UD for the current instruction. The assumption here is that @@ -2458,7 +2461,7 @@ static void gen_interrupt(DisasContext *s, int intno, gen_jmp_im(cur_eip); gen_helper_raise_interrupt(cpu_env, tcg_const_i32(intno), tcg_const_i32(next_eip - cur_eip)); - s->is_jmp =3D DISAS_TB_JUMP; + s->is_jmp =3D DISAS_NORETURN; } =20 static void gen_debug(DisasContext *s, target_ulong cur_eip) @@ -2466,7 +2469,7 @@ static void gen_debug(DisasContext *s, target_ulong c= ur_eip) gen_update_cc_op(s); gen_jmp_im(cur_eip); gen_helper_debug(cpu_env); - s->is_jmp =3D DISAS_TB_JUMP; + s->is_jmp =3D DISAS_NORETURN; } =20 static void gen_set_hflag(DisasContext *s, uint32_t mask) @@ -2541,7 +2544,7 @@ do_gen_eob_worker(DisasContext *s, bool inhibit, bool= recheck_tf, TCGv jr) } else { tcg_gen_exit_tb(0); } - s->is_jmp =3D DISAS_TB_JUMP; + s->is_jmp =3D DISAS_NORETURN; } =20 static inline void @@ -2580,7 +2583,6 @@ static void gen_jmp_tb(DisasContext *s, target_ulong = eip, int tb_num) set_cc_op(s, CC_OP_DYNAMIC); if (s->jmp_opt) { gen_goto_tb(s, tb_num, eip); - s->is_jmp =3D DISAS_TB_JUMP; } else { gen_jmp_im(eip); gen_eob(s); @@ -6943,7 +6945,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_pause(cpu_env, tcg_const_i32(s->pc - pc_start)); - s->is_jmp =3D DISAS_TB_JUMP; + s->is_jmp =3D DISAS_NORETURN; } break; case 0x9b: /* fwait */ @@ -7188,7 +7190,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_hlt(cpu_env, tcg_const_i32(s->pc - pc_start)); - s->is_jmp =3D DISAS_TB_JUMP; + s->is_jmp =3D DISAS_NORETURN; } break; case 0x100: @@ -7371,7 +7373,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, gen_helper_vmrun(cpu_env, tcg_const_i32(s->aflag - 1), tcg_const_i32(s->pc - pc_start)); tcg_gen_exit_tb(0); - s->is_jmp =3D DISAS_TB_JUMP; + s->is_jmp =3D DISAS_NORETURN; break; =20 case 0xd9: /* VMMCALL */ --=20 2.13.5