Added a useful skin instrumentation function.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1433
This commit is contained in:
Nicholas Nethercote 2003-02-24 10:32:51 +00:00
parent cf515e3eef
commit 48b80f2249
2 changed files with 14 additions and 1 deletions

View File

@ -84,6 +84,15 @@ void VG_(set_global_var)(UCodeBlock* cb, Addr globvar_ptr, UInt val)
uInstr2(cb, STORE, 4, TempReg, t_val, TempReg, t_gv);
}
void VG_(set_global_var_tempreg)(UCodeBlock* cb, Addr globvar_ptr, UInt t_val)
{
Int t_gv = newTemp(cb);
uInstr2(cb, MOV, 4, Literal, 0, TempReg, t_gv);
uLiteral(cb, globvar_ptr);
uInstr2(cb, STORE, 4, TempReg, t_val, TempReg, t_gv);
}
/*--------------------------------------------------------------------*/
/*--- end vg_instrument.c ---*/
/*--------------------------------------------------------------------*/

View File

@ -812,9 +812,13 @@ extern void VG_(call_helper_2_0) ( UCodeBlock* cb, Addr f, UInt arg1, UInt arg2,
UInt regparms_n);
/* One way around the 3-arg C function limit is to pass args via global
* variables... ugly, but it works. */
* variables... ugly, but it works. This one puts a literal in there. */
extern void VG_(set_global_var) ( UCodeBlock* cb, Addr globvar_ptr, UInt val);
/* This one puts the contents of a TempReg in the global variable. */
extern void VG_(set_global_var_tempreg) ( UCodeBlock* cb, Addr globvar_ptr,
UInt t_val);
/* ------------------------------------------------------------------ */
/* Allocating/freeing basic blocks of UCode */
extern UCodeBlock* VG_(setup_UCodeBlock) ( UCodeBlock* cb );