/* Forwards .. */
__attribute((regparm(2)))
-static UInt genericg_compute_adler32 ( HWord addr, UInt len );
+static UInt genericg_compute_adler32 ( HWord addr, HWord len );
/* Disassemble a complete basic block, starting at guest_IP_start,
&genericg_compute_adler32,
mkIRExprVec_2(
mkIRExpr_HWord( (HWord)guest_code ),
- IRExpr_Const(IRConst_U32(len2check))
+ mkIRExpr_HWord( (HWord)len2check )
)
),
IRExpr_Const(IRConst_U32(adler32))
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 = 1;
UInt s2 = 0;
vassert(ty == e->Iex.CCall.retty);
/* be very restrictive for now. Only 64-bit ints allowed
- for args, and 64 bits for return type. */
- if (e->Iex.CCall.retty != Ity_I64)
+ for args, and 64 or 32 bits for return type. */
+ if (e->Iex.CCall.retty != Ity_I64 && e->Iex.CCall.retty != Ity_I32)
goto irreducible;
/* Marshal args, do the call. */
doHelperCall( env, False, NULL, e->Iex.CCall.cee, e->Iex.CCall.args );
- 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 == Ity_I64)
+ addInstr(env, mk_iMOVsd_RR(hregAMD64_RAX(), dst));
+ else
+ addInstr(env, AMD64Instr_MovZLQ(hregAMD64_RAX(), dst));
+
return dst;
}