|
From: Julian S. <js...@ac...> - 2016-10-22 05:16:19
|
On 21/10/16 23:26, Jakub Beránek wrote: > Hello, > > is it possible to pass more than 3 parameters to (dirty) helper calls > during instrumentation? Yes. amd64 (64-bit x86) supports up to 6 word sized args and x86 (32-bit x86) supports at least 5. Look for the call to x86g_calculate_condition made in VEX/priv/guest_x86_toIR.c. > When I used VG_REGPARM(4), Valgrind crashed on assert that requires the > regparm count to be >=0 and <= 3 (I understand why is it so, it's probably > hard to pass more than 3 parameters in registers on x86 etc.). VG_REGPARM says how many args are to be passed in registers on x86-ELF, up to a maximum of 3. You can't set it higher than 3. That doesn't mean that you can't pass more than 3 args, though. > I tried instead to create a vector of several integers and add it to the > argument vector, but Valgrind didn't like that either (it crashed during > ppIRExpr). Yes, that won't work. You need to create a single flat vector containing all the args you want. If you want this to work on all platforms, I think you need to keep to a maximum of 4 word-sized args, since at least for arm32, the back end only knows how to generate code for calls with at most 4 word sized args. J |