From nobody Mon Feb 9 19:05:13 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 1500112084410112.41769961962109; Sat, 15 Jul 2017 02:48:04 -0700 (PDT) Received: from localhost ([::1]:41321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dWJgA-0007n9-Mk for importer@patchew.org; Sat, 15 Jul 2017 05:48:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dWJbH-0003YL-4S for qemu-devel@nongnu.org; Sat, 15 Jul 2017 05:43:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dWJbG-0003Bv-0x for qemu-devel@nongnu.org; Sat, 15 Jul 2017 05:42:59 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:34579) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dWJbF-0003Bj-PP for qemu-devel@nongnu.org; Sat, 15 Jul 2017 05:42:57 -0400 Received: by mail-pf0-x242.google.com with SMTP id c24so13734652pfe.1 for ; Sat, 15 Jul 2017 02:42:57 -0700 (PDT) Received: from bigtime.twiddle.net (rrcs-173-197-98-123.west.biz.rr.com. [173.197.98.123]) by smtp.gmail.com with ESMTPSA id c63sm27368589pfk.79.2017.07.15.02.42.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Jul 2017 02:42:55 -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=wwCYZXiHrg9w0eaYio5ZyAUvIB1FH9ld5+bP3Xy8kaI=; b=PtB430MX5Zu+rxaQxLoqELTS+m0I3KP5ZjU6XPNs1Lalg6Bb9WqWPrP6S3FMTSfFXi IdqkwDpwhzDQyejiGQ6IeUaKhm/xt6XwwspXlU6qq/IipYInQvKe7CCPNmElGJehhGdh XUGfJIk1AccG1Xw2WyUnOySBfPzWKx8eXfsoiqKLO0pj3DtTE9fo78criDVsF9cWONX0 kY5rtRqgj8IAnTE4CzfrLZRGBqO4RJ18o9/Qk4ftpzEiamxQ3stsvraLpTBuPzTNFPal C+SvAraUB148B0rlUQAghqRkQ9ylInNVEsRDNPpfCuoaDBUW7Z6kT5+5zOU0L3WkmYlT BuGQ== 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=wwCYZXiHrg9w0eaYio5ZyAUvIB1FH9ld5+bP3Xy8kaI=; b=GAqpeHx1w+O6+CpP6YZxAUgMzHhRMJ/fk3MTC0zZTOwNC5WzTmo79tRSAsCEal7xsa oohvOI2XjiwM5Mf6Od+jw8atResdjLikgTt9l6WVEOHb6Km1UYi+n80Iu8ddDa03v3YH CZCboNlwnlc+KNVsl8ovMH9xXqCNyBsNEcZ/UKF+h6nX/+kmIZT1lH9LCUa/51zS0hXL Gt0Y2vFOQC18T6W4GRRRrIT+gqyOvfekcqfsaHFMBOMAQoXsDClZ4RQbJ9EKFwneFru+ 4LCDLz+UKSDT5YjuyTX29g5Hu1J/qqL5wwJL7lRndWc5c1SuEeFPj5CLHAoUlHlBzNTx ounQ== X-Gm-Message-State: AIVw1130rwIYxIqyh7y9Pau7gtVwhTLx4o1WK/pYv2oQ6MYd/zDi4erh cEqu3oR0TeEwxUNnk/k= X-Received: by 10.84.215.157 with SMTP id l29mr3854667pli.177.1500111776475; Sat, 15 Jul 2017 02:42:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 14 Jul 2017 23:42:12 -1000 Message-Id: <20170715094243.28371-4-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170715094243.28371-1-rth@twiddle.net> References: <20170715094243.28371-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::242 Subject: [Qemu-devel] [PATCH v14 03/34] 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: pbonzini@redhat.com, cota@braap.org, alex.bennee@linaro.org, vilanova@ac.upc.edu, crosthwaite.peter@gmail.com 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" 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. Signed-off-by: Richard Henderson Reviewed-by: Emilio G. Cota --- 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 cab9e32..3ffbf1b 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); @@ -6942,7 +6944,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 */ @@ -7187,7 +7189,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: @@ -7370,7 +7372,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.9.4