From nobody Mon Feb 9 20:35:27 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; 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 1493106994107568.6150799851289; Tue, 25 Apr 2017 00:56:34 -0700 (PDT) Received: from localhost ([::1]:47567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vKr-0001V0-1P for importer@patchew.org; Tue, 25 Apr 2017 03:56:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIq-0008Ra-9r for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIo-0000pG-SB for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:28 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:51193) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000hY-Ic; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8749921F3A; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 23C4024774; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=vCS VxhpgXscLs0zC043DB4MTBaK2RULIqjmCh6CYfAw=; b=jB8HlCw0p+Kqen/8QXR k0/cLyOCEx2oyjI085s5GOupwEGBNh0Hvgdyzraa9iQDyAzDOazsGbj1in1dxuix Y3FErvkR2D038+i+Ar3D3aZYmWN4NiXg6jRq0GRdBDhUrYeVQAvtl3fNJCG2xUFE I0439713K1dVVfKD4U75GFS4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=vCSVxhpgXscLs0zC043DB4MTBaK2RULIqjmCh6CYf Aw=; b=N4gBKmiWA/2oJhT9nYLYaWDHFNnH7UPVBf4aaJtawoagAj2ImaJ7AoRyQ 4NV2Q1KxzsrA2hLulpxEm7p6xfmwKGI9l6WoNZ1D2U+QsLT+QeFeb1joz39Q2+FM uxTLXFhrGz/12f62mu0I2/BUeWjxXt/V0FufycmPjPT4rKZA/zdq7uhcCzoqSDhD +ljuGdwR5jKj39dxO07mRK72ta8leysC7L9KW1Nk44FM8ShqTIWzciyJvWbpVByN v5nlRrqSDtj9oGK0RGR8vmltORQa0nMUhUE0C6maXoICtOcl/Q1KhBdsDPDXvcBN 5MeaEYKdRyKYYtTkxvV9Mql1XWyeQ== X-ME-Sender: X-Sasl-enc: AXHflI/728IFJACD3t5rtHWprVzUq/D0sPaU5F1VjIJR 1493106845 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:56 -0400 Message-Id: <1493106839-10438-11-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 10/13] target/i386: introduce gen_jr() helper to jump to register 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This helper will be used by subsequent commits. Signed-off-by: Emilio G. Cota --- target/i386/translate.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 1d1372f..445082b 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 +gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf, TCGv jr) { gen_update_cc_op(s); =20 @@ -2530,6 +2532,16 @@ static void gen_eob_worker(DisasContext *s, bool inh= ibit, bool recheck_tf) tcg_gen_exit_tb(0); } else if (s->tf) { gen_helper_single_step(cpu_env); + } else if (jr) { + TCGv vaddr =3D tcg_temp_new(); + TCGv_ptr ptr =3D tcg_temp_new_ptr(); + + tcg_gen_ld_tl(vaddr, cpu_env, offsetof(CPUX86State, segs[R_CS].bas= e)); + tcg_gen_add_tl(vaddr, vaddr, jr); + gen_helper_lookup_tb_ptr(ptr, cpu_env, vaddr); + tcg_temp_free(vaddr); + tcg_gen_goto_ptr(ptr); + tcg_temp_free_ptr(ptr); } else { tcg_gen_exit_tb(0); } @@ -2540,13 +2552,19 @@ static void gen_eob_worker(DisasContext *s, bool in= hibit, bool recheck_tf) If INHIBIT, set HF_INHIBIT_IRQ_MASK if it isn't already set. */ static void gen_eob_inhibit_irq(DisasContext *s, bool inhibit) { - gen_eob_worker(s, inhibit, false); + gen_eob_worker(s, inhibit, false, NULL); } =20 /* End of block, resetting the inhibit irq flag. */ static void gen_eob(DisasContext *s) { - gen_eob_worker(s, false, false); + gen_eob_worker(s, false, false, NULL); +} + +/* Jump to register */ +static void gen_jr(DisasContext *s, TCGv dest) +{ + gen_eob_worker(s, false, false, dest); } =20 /* generate a jump to eip. No segment change must happen before as a @@ -7131,7 +7149,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, /* TF handling for the syscall insn is different. The TF bit is c= hecked after the syscall insn completes. This allows #DB to not be generated after one has entered CPL0 if TF is set in FMASK. */ - gen_eob_worker(s, false, true); + gen_eob_worker(s, false, true, NULL); break; case 0x107: /* sysret */ if (!s->pe) { @@ -7146,7 +7164,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, checked after the sysret insn completes. This allows #DB to= be generated "as if" the syscall insn in userspace has just completed. */ - gen_eob_worker(s, false, true); + gen_eob_worker(s, false, true, NULL); } break; #endif --=20 2.7.4