From nobody Mon May 6 00:02:30 2024 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 1523027079227983.4084784069119; Fri, 6 Apr 2018 08:04:39 -0700 (PDT) Received: from localhost ([::1]:33078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Sue-0003Z1-Hx for importer@patchew.org; Fri, 06 Apr 2018 11:04:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Re1-0000CJ-Du for qemu-devel@nongnu.org; Fri, 06 Apr 2018 09:43:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Rdy-0003uo-8z for qemu-devel@nongnu.org; Fri, 06 Apr 2018 09:43:09 -0400 Received: from forward103j.mail.yandex.net ([5.45.198.246]:49922) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f4Rdx-0003uC-NT for qemu-devel@nongnu.org; Fri, 06 Apr 2018 09:43:06 -0400 Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward103j.mail.yandex.net (Yandex) with ESMTP id 2962E34C5460; Fri, 6 Apr 2018 16:43:02 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback3g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 2a0RaCZw7j-h1Um3enc; Fri, 06 Apr 2018 16:43:02 +0300 Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id cyK0yrsVit-h0vmjXJh; Fri, 06 Apr 2018 16:43:00 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kitsu.me; s=mail; t=1523022182; bh=Uj8VNHTnn68Enonr2H3m8Li12ap+4/L7J81wTu17JGI=; h=From:To:Cc:Subject:Date:Message-Id; b=noe0N10CMMlD8/21R7Ko8ve4et7eJMiWD15DklteHdcUZUXu77+zwJuV75mNwOTTn S/CJm4hVS3bOYq3X7tt+Kil6lmQapDdhQZSdv6nEmGPm2V0auk5CNYSpcEvJu/JnPK jjeI49Xt2cx77bEzEmsHiB1k01WOJ/0zsu/AnuYg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kitsu.me; s=mail; t=1523022180; bh=Uj8VNHTnn68Enonr2H3m8Li12ap+4/L7J81wTu17JGI=; h=From:To:Cc:Subject:Date:Message-Id; b=ng8flwR/NkC72ElBAh0pgC0Udrj4DZtjdKLZ1iiKqiJnaKYhK+0pdm1Dh8BiHmUg0 ZoI4tABB4K8Km9n8SvbQhB3ORQnM9BdQm1LPix9hhMkGvTbyNhsB1FLEwhI/vIQ4Zu H9XIoLzNBhdeIdsJ/7eEQWGiiOapL/Cb0DgxZA0U= Authentication-Results: smtp4p.mail.yandex.net; dkim=pass header.i=@kitsu.me From: Eugene Minibaev To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 16:41:52 +0300 Message-Id: <20180406134152.17181-1-mail@kitsu.me> X-Mailer: git-send-email 2.16.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 5.45.198.246 X-Mailman-Approved-At: Fri, 06 Apr 2018 11:02:51 -0400 Subject: [Qemu-devel] [PATCH] Add missing bit for SSE instr in VEX decoding 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, ehabkost@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (found 2 invalid signatures) 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" Signed-off-by: Eugene Minibaev --- It seems that x86 vector instructions encoded in VEX are not properly decoded because of missing bit, here is the example: IN: 0x08048060: c5 f9 6f c1 vmovdqa %xmm1, %xmm0 0x08048064: b8 01 00 00 00 movl $1, %eax 0x08048069: bb 00 00 00 00 movl $0, %ebx 0x0804806e: cd 80 int $0x80 OUT: [size=3D191] 0x604370c0: 41 8b 6e ec movl -0x14(%r14), %ebp 0x604370c4: 85 ed testl %ebp, %ebp 0x604370c6: 0f 8c a9 00 00 00 jl 0x60437175 0x604370cc: 41 8b 6e 08 movl 8(%r14), %ebp 0x604370d0: 0f b7 ed movzwl %bp, %ebp 0x604370d3: 49 8b fe movq %r14, %rdi 0x604370d6: 8b f5 movl %ebp, %esi 0x604370d8: e8 24 7f cd ff callq 0x6010f001 0x604370dd: 41 8b 6e 18 movl 0x18(%r14), %ebp 0x604370e1: 65 67 0f b7 6d 00 movzwl %gs:(%ebp), %ebp 0x604370e7: 41 8b 5e 08 movl 8(%r14), %ebx 0x604370eb: 0f b7 db movzwl %bx, %ebx 0x604370ee: 49 8b fe movq %r14, %rdi 0x604370f1: 8b f3 movl %ebx, %esi 0x604370f3: 8b d5 movl %ebp, %edx 0x604370f5: e8 b1 06 cd ff callq 0x601077ab 0x604370fa: 41 8b 6e 38 movl 0x38(%r14), %ebp 0x604370fe: d1 e5 shll $1, %ebp 0x60437100: 41 8b 5e 18 movl 0x18(%r14), %ebx ... 0x6043716b: ba 02 00 00 00 movl $2, %edx =20 0x60437170: e8 20 8d cb ff callq 0x600efe95 =20 0x60437175: b8 43 70 43 60 movl $0x60437043, %eax 0x6043717a: e9 99 fe ff ff jmp 0x60437018 =20 =20 qemu: uncaught target signal 11 (Segmentation fault) - core dumped make: *** [Makefile:6: run] Segmentation fault (core dumped) --- target/i386/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 0135415d92..e2ce7e4061 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -4564,7 +4564,7 @@ static target_ulong disas_insn(DisasContext *s, CPUSt= ate *cpu) rex_r =3D (~vex2 >> 4) & 8; if (b =3D=3D 0xc5) { vex3 =3D vex2; - b =3D x86_ldub_code(env, s); + b =3D x86_ldub_code(env, s) | 0x100; } else { #ifdef TARGET_X86_64 s->rex_x =3D (~vex2 >> 3) & 8; --=20 2.16.3