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 */
That's true. I forgot the fact that mov %eax,%eax can be both:
0x89 0xC0
0x8B 0xC0
It's up to the compiler to choose which one to use.
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.
modrm is the byte following the 0x89 or 0x8B opcode. After