From: Nicholas N. <nj...@cs...> - 2006-12-30 23:49:59
|
On Sun, 31 Dec 2006, Tilman Sauerbeck wrote: > I need to pass the size of the written data type, too, so now the code > looks like this: > > static VG_REGPARM(2) void > trace_store(Addr addr, SizeT size, UInt value) { ... } > > ... > > IRType arg_ty = typeOfIRExpr(bbOut->tyenv, st->Ist.Store.data); > IExpr* addr_expr = st->Ist.Store.addr; > IExpr* size_expr = mkIRExpr_HWord(sizeofIRType(arg_ty)); > IExpr* data_expr = st->Ist.Store.data; > > unsafeIRDirty_0_N(/*regparms*/ 2, "trace_store", > VG_(fnptr_to_fnentry)(trace_store), > mkIRExprVec_3(addr_expr, size_expr, data_expr)); > > That created helper call is then added to the IRSB of course. > When I run that code, I get: > > vex: the `impossible' happened: > pushArg(x86): can't handle arg of this type > [...] > LibVEX called failure_exit(). > ==19009== at 0x3800136C: report_and_quit (m_libcassert.c:140) Args passed to C functions have to be word-sized. data_expr will not always be word-sized. I think you need to switch on the data_size and convert the value to word-size using the appropriate unary casts (16Uto32, etc). > Now when I adjust the code to _not_ pass "size_expr", thus reducing the > number of arguments to two, I get: > > vex: priv/host-x86/isel.c:510 (doHelperCall): Assertion `typeOfIRExpr(env->type_env, args[i]) == Ity_I32' failed. > > Any idea on that? Hmm, not sure about that one, again it's complaining that one of the arguments isn't 32 bits, but I'm not sure why. Nick |