VG_(printf)("\n\t\tamd-prefetch (%s)\n", nameIReg(4,reg) );
}
-/*----------------------------------------------------*/
-/*--- Helper offset -> addr translation ---*/
-/*----------------------------------------------------*/
-
-/* Finds the baseBlock offset of a tool-specified helper.
- * Searches through compacts first, then non-compacts. */
-Int VG_(helper_offset)(Addr a)
-{
- UInt i;
- Char buf[100];
-
- for (i = 0; i < VG_(n_compact_helpers); i++)
- if (VG_(compact_helper_addrs)[i] == a)
- return VG_(compact_helper_offsets)[i];
- for (i = 0; i < VG_(n_noncompact_helpers); i++)
- if (VG_(noncompact_helper_addrs)[i] == a)
- return VG_(noncompact_helper_offsets)[i];
-
- /* Shouldn't get here */
- VG_(get_fnname) ( a, buf, 100 );
-
- VG_(printf)(
- "\nCouldn't find offset of helper from its address (%p: %s).\n"
- "A helper function probably used hasn't been registered?\n\n", a, buf);
-
- VG_(printf)(" compact helpers: ");
- for (i = 0; i < VG_(n_compact_helpers); i++)
- VG_(printf)("%p ", VG_(compact_helper_addrs)[i]);
-
- VG_(printf)("\n non-compact helpers: ");
- for (i = 0; i < VG_(n_noncompact_helpers); i++)
- VG_(printf)("%p ", VG_(noncompact_helper_addrs)[i]);
-
- VG_(printf)("\n");
- VG_(skin_panic)("Unfound helper");
-}
-
/*----------------------------------------------------*/
/*--- Instruction synthesisers ---*/
/*----------------------------------------------------*/
}
/* Call the function - may trash all flags */
- VG_(synth_call) ( False, VG_(helper_offset) ( fn ), False, FlagsEmpty, FlagsOSZACP );
+ VG_(synth_call) ( False, VG_(helper_offset) ( fn ), False,
+ FlagsEmpty, FlagsOSZACP );
/* Clear any args from stack */
if (0 != stack_used) {
extern UInt VG_(baseBlock)[VG_BASEBLOCK_WORDS];
-
/* -----------------------------------------------------
Read-write parts of baseBlock.
-------------------------------------------------- */
extern Int VGOFF_(helper_undefined_instruction);
-/* For storing extension-specific helpers, determined at runtime. The addr
- * and offset arrays together form a (addr, offset) map that allows a
- * helper's baseBlock offset to be computed from its address. It's done
- * like this so CCALL_M_Ns and other helper calls can use the function
- * address rather than having to much around with offsets. */
-extern UInt VG_(n_compact_helpers);
-extern UInt VG_(n_noncompact_helpers);
-
-extern Addr VG_(compact_helper_addrs) [];
-extern Int VG_(compact_helper_offsets)[];
-
-extern Addr VG_(noncompact_helper_addrs) [];
-extern Int VG_(noncompact_helper_offsets)[];
-
#endif /* ndef __VG_INCLUDE_H */
#define MAX_COMPACT_HELPERS 8
#define MAX_NONCOMPACT_HELPERS 50
-UInt VG_(n_compact_helpers) = 0;
-UInt VG_(n_noncompact_helpers) = 0;
-
-Addr VG_(compact_helper_addrs) [MAX_COMPACT_HELPERS];
-Int VG_(compact_helper_offsets)[MAX_COMPACT_HELPERS];
-Addr VG_(noncompact_helper_addrs) [MAX_NONCOMPACT_HELPERS];
-Int VG_(noncompact_helper_offsets)[MAX_NONCOMPACT_HELPERS];
+/* For storing tool-specific helpers, determined at runtime. The addr
+ * and offset arrays together form a (addr, offset) map that allows a
+ * helper's baseBlock offset to be computed from its address. It's done
+ * like this so CCALLs can use the function address rather than having to
+ * muck around with offsets. */
+static UInt VG_(n_compact_helpers) = 0;
+static UInt VG_(n_noncompact_helpers) = 0;
+static Addr VG_(compact_helper_addrs) [MAX_COMPACT_HELPERS];
+static Int VG_(compact_helper_offsets)[MAX_COMPACT_HELPERS];
+static Addr VG_(noncompact_helper_addrs) [MAX_NONCOMPACT_HELPERS];
+static Int VG_(noncompact_helper_offsets)[MAX_NONCOMPACT_HELPERS];
/* This is the actual defn of baseblock. */
UInt VG_(baseBlock)[VG_BASEBLOCK_WORDS];
VG_(noncompact_helper_addrs));
}
+// Finds the baseBlock offset of a tool-specified helper.
+// Searches through compacts first, then non-compacts.
+Int VG_(helper_offset)(Addr a)
+{
+ UInt i;
+ Char buf[100];
+
+ for (i = 0; i < VG_(n_compact_helpers); i++)
+ if (VG_(compact_helper_addrs)[i] == a)
+ return VG_(compact_helper_offsets)[i];
+ for (i = 0; i < VG_(n_noncompact_helpers); i++)
+ if (VG_(noncompact_helper_addrs)[i] == a)
+ return VG_(noncompact_helper_offsets)[i];
+
+ /* Shouldn't get here */
+ VG_(get_fnname) ( a, buf, 100 );
+
+ VG_(printf)(
+ "\nCouldn't find offset of helper from its address (%p: %s).\n"
+ "A helper function probably used hasn't been registered?\n\n", a, buf);
+
+ VG_(printf)(" compact helpers: ");
+ for (i = 0; i < VG_(n_compact_helpers); i++)
+ VG_(printf)("%p ", VG_(compact_helper_addrs)[i]);
+
+ VG_(printf)("\n non-compact helpers: ");
+ for (i = 0; i < VG_(n_noncompact_helpers); i++)
+ VG_(printf)("%p ", VG_(noncompact_helper_addrs)[i]);
+
+ VG_(printf)("\n");
+ VG_(skin_panic)("Unfound helper");
+}
+
/*====================================================================*/
/*=== Setup pointercheck ===*/