From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TL892-00074x-UE for qemu-devel@nongnu.org; Mon, 08 Oct 2012 03:52:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TL88z-00073k-2O for qemu-devel@nongnu.org; Mon, 08 Oct 2012 03:52:56 -0400 Received: from fe01x03-cgp.akado.ru ([77.232.31.164]:52900 helo=akado.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TL88y-00073I-RG for qemu-devel@nongnu.org; Mon, 08 Oct 2012 03:52:52 -0400 Date: Mon, 8 Oct 2012 11:52:30 +0400 (MSK) From: malc In-Reply-To: <50720C75.30109@FreeBSD.org> Message-ID: References: <50720C75.30109@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Subject: Re: [Qemu-devel] bug in popcnt emulation with some register operand(s)? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andriy Gapon Cc: qemu-devel@nongnu.org On Mon, 8 Oct 2012, Andriy Gapon wrote: > > I am running Qemu (plain, no kvm, etc) on an AMD 10h machine that > provides popcnt instruction. Qemu advertises availability of pocnt > to a guest as well. What I see in the guest that popcnt > 0x20(%r12),%r8 instruction actually placed its result into %rax. > With %rdi and %rax operands the instruction worked fine though. > > Does following work? diff --git a/target-i386/translate.c b/target-i386/translate.c index e896abf..c36cc3e 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -7818,7 +7818,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) goto illegal_op; modrm = cpu_ldub_code(cpu_single_env, s->pc++); - reg = ((modrm >> 3) & 7); + reg = ((modrm >> 3) & 7) | rex_r; if (s->prefix & PREFIX_DATA) ot = OT_WORD; -- mailto:av1474@comtv.ru