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 ---*/
/*--------------------------------------------------------------------*/
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 );