From owner-svn-src-all@FreeBSD.ORG Tue Sep 17 16:06:07 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 97FD6C1E; Tue, 17 Sep 2013 16:06:07 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 845602F04; Tue, 17 Sep 2013 16:06:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8HG67VI032545; Tue, 17 Sep 2013 16:06:07 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8HG67Ot032544; Tue, 17 Sep 2013 16:06:07 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201309171606.r8HG67Ot032544@svn.freebsd.org> From: Neel Natu Date: Tue, 17 Sep 2013 16:06:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255638 - head/sys/amd64/vmm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Sep 2013 16:06:07 -0000 Author: neel Date: Tue Sep 17 16:06:07 2013 New Revision: 255638 URL: http://svnweb.freebsd.org/changeset/base/255638 Log: Fix a bug in decoding an instruction that has an SIB byte as well as an immediate operand. The presence of an SIB byte in decoding the ModR/M field would cause 'imm_bytes' to not be set to the correct value. Fix this by initializing 'imm_bytes' independent of the ModR/M decoding. Reported by: grehan@ Approved by: re@ Modified: head/sys/amd64/vmm/vmm_instruction_emul.c Modified: head/sys/amd64/vmm/vmm_instruction_emul.c ============================================================================== --- head/sys/amd64/vmm/vmm_instruction_emul.c Tue Sep 17 15:19:26 2013 (r255637) +++ head/sys/amd64/vmm/vmm_instruction_emul.c Tue Sep 17 16:06:07 2013 (r255638) @@ -701,12 +701,6 @@ decode_modrm(struct vie *vie) break; } - /* Figure out immediate operand size (if any) */ - if (vie->op.op_flags & VIE_OP_F_IMM) - vie->imm_bytes = 4; - else if (vie->op.op_flags & VIE_OP_F_IMM8) - vie->imm_bytes = 1; - done: vie_advance(vie); @@ -822,6 +816,12 @@ decode_immediate(struct vie *vie) int32_t signed32; } u; + /* Figure out immediate operand size (if any) */ + if (vie->op.op_flags & VIE_OP_F_IMM) + vie->imm_bytes = 4; + else if (vie->op.op_flags & VIE_OP_F_IMM8) + vie->imm_bytes = 1; + if ((n = vie->imm_bytes) == 0) return (0);