From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HaIAj-0003bQ-98 for qemu-devel@nongnu.org; Sat, 07 Apr 2007 17:10:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HaIAg-0003ZK-JV for qemu-devel@nongnu.org; Sat, 07 Apr 2007 17:10:07 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HaIAg-0003Z0-G4 for qemu-devel@nongnu.org; Sat, 07 Apr 2007 17:10:06 -0400 Received: from nz-out-0506.google.com ([64.233.162.236]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HaI72-0007oI-Gq for qemu-devel@nongnu.org; Sat, 07 Apr 2007 17:06:20 -0400 Received: by nz-out-0506.google.com with SMTP id i11so1860857nzi for ; Sat, 07 Apr 2007 14:06:19 -0700 (PDT) Message-ID: Date: Sat, 7 Apr 2007 16:06:19 -0500 From: "Atif Hashmi" Subject: Re: [Qemu-devel] Re: Detecting an assembly instruction in QEMU In-Reply-To: <83a4d4ca0704060515l172d6f9ep59b6467c6e49f250@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_19806_30534643.1175979979081" References: <83a4d4ca0704060515l172d6f9ep59b6467c6e49f250@mail.gmail.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ------=_Part_19806_30534643.1175979979081 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Eduardo, I really appreciate your help but there is a small think that I need to ask you. In target-i386/translate.c, there are many variants of mov i.e. case 0x89: /* mov Gv, Ev */ case 0xc7: /* mov Ev, Iv */ case 0x8b: /* mov Ev, Gv */ case 0x8e: /* mov seg, Gv */ which one do you think will be called when "mov %eax, %eax" instruction is translated. I printed the value of modrm inside the case 0x89 but the value remains the same whether I use %eax or %ebx. Secondly, How can I extract the source and destination registers from modrm. I will really appreciate your help. Thanks, Atif On 4/6/07, Eduardo Felipe wrote: > > Hi, > > Your should create a new helper function in \target-i386\helper.c to > perform whatever you want QEMU to do when movl %eax,%eax is found. > > To invoke that function create a new opcode in \target-i386\op.c. That > opcode should only call your helper function. > > Finally, modify \target-i386\translate.c to generate your opcode when movl > %eax,%eax is translated. Look for the string 0x89, you can find out target > and source registers of the move operation from variable modrm, so only %eax > is considered. > > Regards, > Eduardo > > > ------=_Part_19806_30534643.1175979979081 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Eduardo,

I really appreciate your help but there is a small think that I need to ask you.

In target-i386/translate.c, there are many variants of mov i.e.
 case 0x89: /* mov Gv, Ev */
 case 0xc7: /* mov Ev, Iv */
 case 0x8b: /* mov Ev, Gv */
 case 0x8e: /* mov seg, Gv */

which one do you think will be called when "mov %eax, %eax" instruction is translated.
I printed the value of modrm inside the case 0x89 but the value remains the same whether I use %eax or %ebx.

Secondly, How can I extract the source and destination registers from modrm.

I will really appreciate your help.

Thanks,
Atif


On 4/6/07, Eduardo Felipe <edusaper@gmail.com> wrote:
Hi,

Your should create a new helper function in \target-i386\helper.c to perform whatever you want QEMU to do when movl %eax,%eax is found.

To invoke that function create a new opcode in \target-i386\op.c. That opcode should only call your helper function.

Finally, modify \target-i386\translate.c to generate your opcode when movl %eax,%eax is translated. Look for the string 0x89, you can find out target and source registers of the move operation from variable modrm, so only %eax is considered.

Regards,
Eduardo



------=_Part_19806_30534643.1175979979081--