From owner-svn-src-head@FreeBSD.ORG Wed Jun 11 20:31:41 2014 Return-Path: Delivered-To: svn-src-head@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 ESMTPS id 98DF0EDE; Wed, 11 Jun 2014 20:31:41 +0000 (UTC) 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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 862A42279; Wed, 11 Jun 2014 20:31:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5BKVfR9081142; Wed, 11 Jun 2014 20:31:41 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5BKVfT7081141; Wed, 11 Jun 2014 20:31:41 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201406112031.s5BKVfT7081141@svn.freebsd.org> From: Xin LI Date: Wed, 11 Jun 2014 20:31:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267373 - head/sys/contrib/x86emu X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jun 2014 20:31:41 -0000 Author: delphij Date: Wed Jun 11 20:31:41 2014 New Revision: 267373 URL: http://svnweb.freebsd.org/changeset/base/267373 Log: Fix decoding of LEA when address-size prefix (67h) is present. This is loosly based on Xorg changeset f57bc0e by Christian Zander. Submitted by: Wolf Ramovsky via core (peter) MFC after: 2 weeks Modified: head/sys/contrib/x86emu/x86emu.c Modified: head/sys/contrib/x86emu/x86emu.c ============================================================================== --- head/sys/contrib/x86emu/x86emu.c Wed Jun 11 20:22:14 2014 (r267372) +++ head/sys/contrib/x86emu/x86emu.c Wed Jun 11 20:31:41 2014 (r267373) @@ -2151,21 +2151,24 @@ x86emuOp_mov_word_RM_SR(struct x86emu *e static void x86emuOp_lea_word_R_M(struct x86emu *emu) { - uint16_t *srcreg; uint32_t destoffset; -/* - * TODO: Need to handle address size prefix! - * - * lea eax,[eax+ebx*2] ?? - */ fetch_decode_modrm(emu); if (emu->cur_mod == 3) x86emu_halt_sys(emu); - srcreg = decode_rh_word_register(emu); destoffset = decode_rl_address(emu); - *srcreg = (uint16_t) destoffset; + if (emu->x86.mode & SYSMODE_PREFIX_ADDR) { + uint32_t *srcreg; + + srcreg = decode_rh_long_register(emu); + *srcreg = (uint32_t) destoffset; + } else { + uint16_t *srcreg; + + srcreg = decode_rh_word_register(emu); + *srcreg = (uint16_t) destoffset; + } } /*