|
From: <sv...@va...> - 2005-07-07 13:12:07
|
Author: sewardj
Date: 2005-07-07 14:12:04 +0100 (Thu, 07 Jul 2005)
New Revision: 1265
Log:
Fix bits and pieces needed to make self-checking-translations work
on amd64.
Modified:
trunk/priv/guest-generic/bb_to_IR.c
trunk/priv/host-amd64/hdefs.c
trunk/priv/host-amd64/isel.c
Modified: trunk/priv/guest-generic/bb_to_IR.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-generic/bb_to_IR.c 2005-07-07 12:26:36 UTC (rev 1264=
)
+++ trunk/priv/guest-generic/bb_to_IR.c 2005-07-07 13:12:04 UTC (rev 1265=
)
@@ -43,7 +43,7 @@
=20
/* Forwards .. */
__attribute((regparm(2)))
-static UInt genericg_compute_adler32 ( HWord addr, UInt len );
+static UInt genericg_compute_adler32 ( HWord addr, HWord len );
=20
=20
/* Disassemble a complete basic block, starting at guest_IP_start,=20
@@ -336,7 +336,7 @@
&genericg_compute_adler32,
mkIRExprVec_2(=20
mkIRExpr_HWord( (HWord)guest_code ),=20
- IRExpr_Const(IRConst_U32(len2check))
+ mkIRExpr_HWord( (HWord)len2check )
)
),
IRExpr_Const(IRConst_U32(adler32))
@@ -365,7 +365,7 @@
once for every use of a self-checking translation, so it needs to
be as fast as possible. */
__attribute((regparm(2)))
-static UInt genericg_compute_adler32 ( HWord addr, UInt len )
+static UInt genericg_compute_adler32 ( HWord addr, HWord len )
{
UInt s1 =3D 1;
UInt s2 =3D 0;
Modified: trunk/priv/host-amd64/hdefs.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/host-amd64/hdefs.c 2005-07-07 12:26:36 UTC (rev 1264)
+++ trunk/priv/host-amd64/hdefs.c 2005-07-07 13:12:04 UTC (rev 1265)
@@ -2589,6 +2589,9 @@
case Ijk_NoDecode:
*p++ =3D 0xBD;
p =3D emit32(p, VEX_TRC_JMP_NODECODE); break;
+ case Ijk_TInval:
+ *p++ =3D 0xBD;
+ p =3D emit32(p, VEX_TRC_JMP_TINVAL); break;
case Ijk_Ret:
case Ijk_Call:
case Ijk_Boring:
Modified: trunk/priv/host-amd64/isel.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/host-amd64/isel.c 2005-07-07 12:26:36 UTC (rev 1264)
+++ trunk/priv/host-amd64/isel.c 2005-07-07 13:12:04 UTC (rev 1265)
@@ -1576,14 +1576,20 @@
vassert(ty =3D=3D e->Iex.CCall.retty);
=20
/* be very restrictive for now. Only 64-bit ints allowed
- for args, and 64 bits for return type. */
- if (e->Iex.CCall.retty !=3D Ity_I64)
+ for args, and 64 or 32 bits for return type. */
+ if (e->Iex.CCall.retty !=3D Ity_I64 && e->Iex.CCall.retty !=3D Ity=
_I32)
goto irreducible;
=20
/* Marshal args, do the call. */
doHelperCall( env, False, NULL, e->Iex.CCall.cee, e->Iex.CCall.arg=
s );
=20
- addInstr(env, mk_iMOVsd_RR(hregAMD64_RAX(), dst));
+ /* Move to dst, and zero out the top 32 bits if the result type is
+ Ity_I32. Probably overkill, but still .. */
+ if (e->Iex.CCall.retty =3D=3D Ity_I64)
+ addInstr(env, mk_iMOVsd_RR(hregAMD64_RAX(), dst));
+ else
+ addInstr(env, AMD64Instr_MovZLQ(hregAMD64_RAX(), dst));
+
return dst;
}
=20
|