From nobody Mon Feb 9 12:15:01 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.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 1493294689290145.27286924808232; Thu, 27 Apr 2017 05:04:49 -0700 (PDT) Received: from localhost ([::1]:60225 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iAA-0007X5-Fi for importer@patchew.org; Thu, 27 Apr 2017 08:04:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i60-00040k-NF for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i5z-0001VC-65 for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:28 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34223) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i5z-0001Un-0c for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:27 -0400 Received: by mail-wm0-x242.google.com with SMTP id z129so4092416wmb.1 for ; Thu, 27 Apr 2017 05:00:26 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:25 -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=kI3gdVgs1hYf33sJszhz18HtnhbQZWLfCJpJHDoKDMU=; b=BIxmYSxFzFt0vWz8bzEUUrHvo+4Ct6uQR24A/0/uxpARV7KdLvzTI3OmN9ki3w5p9x KzDRsqDk6GEfLCwQn6TWHXSuVc0sdM0QKOvSK15ZzJqR1ZYdKqLDYFPWY5RYZEk5J0mx N5crzbdaJo16U2xW80B/NA5vgZPZsuWCUbqjooRlpt88Tn4z3jttcyPWMdRIqFuhKJ+D GVjyCLKi99aDw/H31Lhq1Mofd47UhaDmlhiOGjPi7wc96SXvpzWYQqTRQPNnQiqhp5gi um38mrX8db82uQBjWhNYBZVMsStaps+ymsphLTPwcPEJghNSVPy2i35qzLWSLS0sYwcR DcAA== 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=kI3gdVgs1hYf33sJszhz18HtnhbQZWLfCJpJHDoKDMU=; b=T//bvhtEXVaAwCO1ypI6cSL+oqYI0z46ueh4lvkIXmG8Bf9DAgTcbuUD4vDZttbSyW y5jYJ5kV0OIv+ycCd9eQsrzAgX/5xSqaki3PdgmH2EwLLEogSmhXo2M/ftC1fzMx/7XB Ycglt7igCJXD1zQJh/osay/Ip9CSuiNzugyfbuTCw34Hd7+SmQatQIvay/ynNPdohtIr u7QOY2P5n9j+imgc7qjf7vq6AG1ATmbE6NCwFcv/V8iVGzpPjtYlAG21YKtyUt+JNkTt KlZTxkrgTuAI0kR5GkIIr0gNPAmp00jxbCbrh8H6wCpZ/FQW/KdnYuYYvIXinb4J3DSm Ej8w== X-Gm-Message-State: AN3rC/4SP+avHmyh9CW6OZRitNJcfu1LsGwBnCWIDglDwT0YhfRSx2ui 6Dy7QSIrnvttgA== X-Received: by 10.28.55.9 with SMTP id e9mr1958409wma.44.1493294425796; Thu, 27 Apr 2017 05:00:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:57 +0200 Message-Id: <20170427120006.20564-11-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH v5 10/19] target/i386: introduce gen_jr helper to generate 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" From: "Emilio G. Cota" This helper will be used by subsequent changes. Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-9-git-send-email-cota@braap.org> Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/i386/translate.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 1d1372f..f0e48dc 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -141,6 +141,7 @@ typedef struct DisasContext { } DisasContext; =20 static void gen_eob(DisasContext *s); +static void gen_jr(DisasContext *s, TCGv dest); static void gen_jmp(DisasContext *s, target_ulong eip); static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num); static void gen_op(DisasContext *s1, int op, TCGMemOp ot, int d); @@ -2509,7 +2510,8 @@ static void gen_bnd_jmp(DisasContext *s) If INHIBIT, set HF_INHIBIT_IRQ_MASK if it isn't already set. If RECHECK_TF, emit a rechecking helper for #DB, ignoring the state of S->TF. This is used by the syscall/sysret insns. */ -static void gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf) +static void +do_gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf, TCGv jr) { gen_update_cc_op(s); =20 @@ -2530,12 +2532,27 @@ static void gen_eob_worker(DisasContext *s, bool in= hibit, bool recheck_tf) tcg_gen_exit_tb(0); } else if (s->tf) { gen_helper_single_step(cpu_env); + } else if (!TCGV_IS_UNUSED(jr)) { + TCGv vaddr =3D tcg_temp_new(); + + tcg_gen_add_tl(vaddr, jr, cpu_seg_base[R_CS]); + tcg_gen_lookup_and_goto_ptr(vaddr); + tcg_temp_free(vaddr); } else { tcg_gen_exit_tb(0); } s->is_jmp =3D DISAS_TB_JUMP; } =20 +static inline void +gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf) +{ + TCGv unused; + + TCGV_UNUSED(unused); + do_gen_eob_worker(s, inhibit, recheck_tf, unused); +} + /* End of block. If INHIBIT, set HF_INHIBIT_IRQ_MASK if it isn't already set. */ static void gen_eob_inhibit_irq(DisasContext *s, bool inhibit) @@ -2549,6 +2566,12 @@ static void gen_eob(DisasContext *s) gen_eob_worker(s, false, false); } =20 +/* Jump to register */ +static void gen_jr(DisasContext *s, TCGv dest) +{ + do_gen_eob_worker(s, false, false, dest); +} + /* generate a jump to eip. No segment change must happen before as a direct call to the next block may occur */ static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num) --=20 2.9.3