{"id":810691,"url":"http://patchwork.ozlabs.org/api/1.2/patches/810691/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170906160612.22769-3-richard.henderson@linaro.org/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.2/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170906160612.22769-3-richard.henderson@linaro.org>","list_archive_url":null,"date":"2017-09-06T16:05:42","name":"[PULL,02/32] target/i386: Use generic DISAS_* enumerators","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"140e66236ee66456f486e3f7147be17e8fe72e77","submitter":{"id":72104,"url":"http://patchwork.ozlabs.org/api/1.2/people/72104/?format=json","name":"Richard Henderson","email":"richard.henderson@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170906160612.22769-3-richard.henderson@linaro.org/mbox/","series":[{"id":1847,"url":"http://patchwork.ozlabs.org/api/1.2/series/1847/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1847","date":"2017-09-06T16:05:41","name":"[PULL,01/32] tcg: Add generic DISAS_NORETURN","version":1,"mbox":"http://patchwork.ozlabs.org/series/1847/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810691/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810691/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"QP4/mR22\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xnT4K5CDZz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 02:07:13 +1000 (AEST)","from localhost ([::1]:36958 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dpcr9-0008NO-MB\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 12:07:11 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:41542)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <richard.henderson@linaro.org>) id 1dpcqL-0008MH-5d\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:27 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <richard.henderson@linaro.org>) id 1dpcqI-0001V2-IS\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:21 -0400","from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]:34779)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <richard.henderson@linaro.org>)\n\tid 1dpcqI-0001UB-At\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:18 -0400","by mail-pf0-x22c.google.com with SMTP id m1so13484072pfk.1\n\tfor <qemu-devel@nongnu.org>; Wed, 06 Sep 2017 09:06:18 -0700 (PDT)","from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net.\n\t[97.126.108.236]) by smtp.gmail.com with ESMTPSA id\n\tt65sm262863pfk.59.2017.09.06.09.06.15\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 06 Sep 2017 09:06:16 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=oktER+wQnBzv+YFYPe9eDSwDzOT9j+VLlJ0DA6KaCfc=;\n\tb=QP4/mR22W97tNZeuIsjeUS1wcN5dzNYXiM02/CctYzMSO/pc6R24rnx0DqBLLKCl7J\n\txo9bGZegILi3ytnnim1C2qT0XXzzKOEtsZAB0d3G0USXTFnGO7tnlTRybZcQH0Qa3lUM\n\tJ8ZDNgb26Yr/yGQagGS1PjnKcFe7JRnoy2u7c=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=oktER+wQnBzv+YFYPe9eDSwDzOT9j+VLlJ0DA6KaCfc=;\n\tb=dOF9rxo9uwpUsAXJpCB+tFMScme/FIEEbcpLu+HsMHcuv9OA6GiDOIXUoJlZf1tNt0\n\t4wVW8mgEGZXGa+hBxYWOuRBCT248toxFd7Dq2xubUKpteRcnjtPJ2ky5GA1AMGqYVNcF\n\tZvZckUFIZJ6+OBoP4WwTIxqJp8JTXhDEADa5t3Kvp2BzxLiiAbK21VD9vjCusUHbCRPY\n\tjNdL6H52w8Q4CmQsFUO697Zy3jTOi0zMbXX3+Wjzgo2cp3oOafKCJXWGVnupS3QpRFy1\n\tO3Daf2AhK1DApHKIJqN2zTmWP2u0A5FPV6xBWygAt4SvlIFZb4bE5dKuCwT2YehNm6ay\n\tsVoA==","X-Gm-Message-State":"AHPjjUhPHeKLDjyOeR8S5QyR9uoCL0MZ1bHVOkCyjwC3phxvQOBNqho8\n\tghQ6btVXaAJKtbZmJC7vSQ==","X-Google-Smtp-Source":"ADKCNb5HrxweZeF6botC2mBMtGXtfgFqKHrEz080ysQfRMWWPwkAAVGSZ/NtVMc1XnRr5JIaHXdSWQ==","X-Received":"by 10.99.126.84 with SMTP id o20mr8271426pgn.137.1504713976979; \n\tWed, 06 Sep 2017 09:06:16 -0700 (PDT)","From":"Richard Henderson <richard.henderson@linaro.org>","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\n\trecognized.","X-Received-From":"2607:f8b0:400e:c00::22c","Subject":"[Qemu-devel] [PULL 02/32] target/i386: Use generic DISAS_*\n\tenumerators","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"peter.maydell@linaro.org, Richard Henderson <rth@twiddle.net>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"From: Richard Henderson <rth@twiddle.net>\n\nThis target is not sophisticated in its use of cleanups at the\nend of the translation loop.  For the most part, any condition\nthat exits the TB is dealt with by emitting the exiting opcode\nright then and there.  Therefore the only is_jmp indicator that\nis needed is DISAS_NORETURN.\n\nFor two stack segment modifying cases, we have not yet exited\nthe TB (therefore DISAS_NORETURN feels wrong), but intend to exit.\nThe caller of gen_movl_seg_T0 currently checks for any non-zero\nvalue, therefore DISAS_TOO_MANY seems acceptable for that usage.\n\nReviewed-by: Emilio G. Cota <cota@braap.org>\nSigned-off-by: Richard Henderson <rth@twiddle.net>\n---\n target/i386/translate.c | 28 +++++++++++++++-------------\n 1 file changed, 15 insertions(+), 13 deletions(-)","diff":"diff --git a/target/i386/translate.c b/target/i386/translate.c\nindex 5fdadf98cf..26e8002433 100644\n--- a/target/i386/translate.c\n+++ b/target/i386/translate.c\n@@ -31,6 +31,7 @@\n #include \"trace-tcg.h\"\n #include \"exec/log.h\"\n \n+#define DISAS_TOO_MANY 5\n \n #define PREFIX_REPZ   0x01\n #define PREFIX_REPNZ  0x02\n@@ -2153,6 +2154,7 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)\n         tcg_gen_goto_tb(tb_num);\n         gen_jmp_im(eip);\n         tcg_gen_exit_tb((uintptr_t)s->tb + tb_num);\n+        s->is_jmp = DISAS_NORETURN;\n     } else {\n         /* jump to another page */\n         gen_jmp_im(eip);\n@@ -2173,7 +2175,6 @@ static inline void gen_jcc(DisasContext *s, int b,\n \n         gen_set_label(l1);\n         gen_goto_tb(s, 1, val);\n-        s->is_jmp = DISAS_TB_JUMP;\n     } else {\n         l1 = gen_new_label();\n         l2 = gen_new_label();\n@@ -2243,12 +2244,14 @@ static void gen_movl_seg_T0(DisasContext *s, int seg_reg)\n            because ss32 may change. For R_SS, translation must always\n            stop as a special handling must be done to disable hardware\n            interrupts for the next instruction */\n-        if (seg_reg == R_SS || (s->code32 && seg_reg < R_FS))\n-            s->is_jmp = DISAS_TB_JUMP;\n+        if (seg_reg == R_SS || (s->code32 && seg_reg < R_FS)) {\n+            s->is_jmp = DISAS_TOO_MANY;\n+        }\n     } else {\n         gen_op_movl_seg_T0_vm(seg_reg);\n-        if (seg_reg == R_SS)\n-            s->is_jmp = DISAS_TB_JUMP;\n+        if (seg_reg == R_SS) {\n+            s->is_jmp = DISAS_TOO_MANY;\n+        }\n     }\n }\n \n@@ -2420,7 +2423,7 @@ static void gen_exception(DisasContext *s, int trapno, target_ulong cur_eip)\n     gen_update_cc_op(s);\n     gen_jmp_im(cur_eip);\n     gen_helper_raise_exception(cpu_env, tcg_const_i32(trapno));\n-    s->is_jmp = DISAS_TB_JUMP;\n+    s->is_jmp = DISAS_NORETURN;\n }\n \n /* Generate #UD for the current instruction.  The assumption here is that\n@@ -2458,7 +2461,7 @@ static void gen_interrupt(DisasContext *s, int intno,\n     gen_jmp_im(cur_eip);\n     gen_helper_raise_interrupt(cpu_env, tcg_const_i32(intno),\n                                tcg_const_i32(next_eip - cur_eip));\n-    s->is_jmp = DISAS_TB_JUMP;\n+    s->is_jmp = DISAS_NORETURN;\n }\n \n static void gen_debug(DisasContext *s, target_ulong cur_eip)\n@@ -2466,7 +2469,7 @@ static void gen_debug(DisasContext *s, target_ulong cur_eip)\n     gen_update_cc_op(s);\n     gen_jmp_im(cur_eip);\n     gen_helper_debug(cpu_env);\n-    s->is_jmp = DISAS_TB_JUMP;\n+    s->is_jmp = DISAS_NORETURN;\n }\n \n static void gen_set_hflag(DisasContext *s, uint32_t mask)\n@@ -2541,7 +2544,7 @@ do_gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf, TCGv jr)\n     } else {\n         tcg_gen_exit_tb(0);\n     }\n-    s->is_jmp = DISAS_TB_JUMP;\n+    s->is_jmp = DISAS_NORETURN;\n }\n \n static inline void\n@@ -2580,7 +2583,6 @@ static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num)\n     set_cc_op(s, CC_OP_DYNAMIC);\n     if (s->jmp_opt) {\n         gen_goto_tb(s, tb_num, eip);\n-        s->is_jmp = DISAS_TB_JUMP;\n     } else {\n         gen_jmp_im(eip);\n         gen_eob(s);\n@@ -6943,7 +6945,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,\n             gen_update_cc_op(s);\n             gen_jmp_im(pc_start - s->cs_base);\n             gen_helper_pause(cpu_env, tcg_const_i32(s->pc - pc_start));\n-            s->is_jmp = DISAS_TB_JUMP;\n+            s->is_jmp = DISAS_NORETURN;\n         }\n         break;\n     case 0x9b: /* fwait */\n@@ -7188,7 +7190,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,\n             gen_update_cc_op(s);\n             gen_jmp_im(pc_start - s->cs_base);\n             gen_helper_hlt(cpu_env, tcg_const_i32(s->pc - pc_start));\n-            s->is_jmp = DISAS_TB_JUMP;\n+            s->is_jmp = DISAS_NORETURN;\n         }\n         break;\n     case 0x100:\n@@ -7371,7 +7373,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,\n             gen_helper_vmrun(cpu_env, tcg_const_i32(s->aflag - 1),\n                              tcg_const_i32(s->pc - pc_start));\n             tcg_gen_exit_tb(0);\n-            s->is_jmp = DISAS_TB_JUMP;\n+            s->is_jmp = DISAS_NORETURN;\n             break;\n \n         case 0xd9: /* VMMCALL */\n","prefixes":["PULL","02/32"]}