From: Nicholas Nethercote Date: Mon, 24 Feb 2003 10:32:51 +0000 (+0000) Subject: Added a useful skin instrumentation function. X-Git-Tag: svn/VALGRIND_1_9_4~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=48b80f224938cfca99f6828d60ccae72adc731aa;p=thirdparty%2Fvalgrind.git Added a useful skin instrumentation function. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1433 --- diff --git a/coregrind/vg_instrument.c b/coregrind/vg_instrument.c index 80dd5f0564..6bb425f92b 100644 --- a/coregrind/vg_instrument.c +++ b/coregrind/vg_instrument.c @@ -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 ---*/ /*--------------------------------------------------------------------*/ diff --git a/include/vg_skin.h b/include/vg_skin.h index 43702fa9b0..44643941f8 100644 --- a/include/vg_skin.h +++ b/include/vg_skin.h @@ -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 );