|
From: <sv...@va...> - 2005-07-20 10:15:41
|
Author: sewardj
Date: 2005-07-20 11:15:34 +0100 (Wed, 20 Jul 2005)
New Revision: 1282
Log:
Implement LOOP disp8 (0xE2).
Modified:
trunk/priv/guest-amd64/toIR.c
Modified: trunk/priv/guest-amd64/toIR.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/priv/guest-amd64/toIR.c 2005-07-20 09:23:13 UTC (rev 1281)
+++ trunk/priv/guest-amd64/toIR.c 2005-07-20 10:15:34 UTC (rev 1282)
@@ -619,9 +619,13 @@
static Bool haveF3 ( Prefix pfx ) {
return toBool((pfx & PFX_F3) > 0);
}
+
static Bool have66 ( Prefix pfx ) {
return toBool((pfx & PFX_66) > 0);
}
+static Bool haveASO ( Prefix pfx ) {
+ return toBool((pfx & PFX_ASO) > 0);
+}
=20
/* Return True iff pfx has 66 set and F2 and F3 clear */
static Bool have66noF2noF3 ( Prefix pfx )
@@ -11523,11 +11527,28 @@
//..=20
//.. //-- case 0xE0: /* LOOPNE disp8 */
//.. //-- case 0xE1: /* LOOPE disp8 */
-//.. //-- case 0xE2: /* LOOP disp8 */
-//.. //-- /* Again, the docs say this uses ECX/CX as a count depen=
ding on
-//.. //-- the address size override, not the operand one. Sinc=
e we
-//.. //-- don't handle address size overrides, I guess that mea=
ns
-//.. //-- ECX. */
+ case 0xE2: /* LOOP disp8 */
+ /* The docs say this uses RCX/ECX as a count depending on
+ the address size override, not the operand one. Since we
+ don't handle address size overrides, I guess that means
+ RCX. */
+ if (!haveF3(pfx) && !haveF2(pfx) && !have66(pfx) && !haveASO(pfx))=
{
+ /* RCX--; if (RCX !=3D 0) goto d64; */
+ d64 =3D guest_RIP_curr_instr + getSDisp8(delta) + 2; delta++;
+ DIP("loop 0x%llx\n", (ULong)d64);
+ putIReg64(R_RCX, binop(Iop_Sub64, getIReg64(R_RCX), mkU64(1)) )=
;
+ stmt( IRStmt_Exit(=20
+ binop(Iop_CmpNE64,getIReg64(R_RCX),mkU64(0)),=20
+ Ijk_Boring,=20
+ IRConst_U64(d64)=20
+ ));
+ dres.whatNext =3D Dis_StopHere;
+ irbb->next =3D mkU64(guest_RIP_curr_instr + 2);
+ irbb->jumpkind =3D Ijk_Boring;
+ break;
+ }
+ goto decode_failure;
+
//.. //-- d32 =3D (eip+1) + getSDisp8(eip); eip++;
//.. //-- t1 =3D newTemp(cb);
//.. //-- uInstr2(cb, GET, 4, ArchReg, R_ECX, TempReg, t1);
|