|
From: <sv...@va...> - 2005-05-11 22:45:50
|
Author: njn
Date: 2005-05-11 23:45:48 +0100 (Wed, 11 May 2005)
New Revision: 3667
Modified:
trunk/coregrind/core.h
trunk/coregrind/vg_main.c
trunk/coregrind/vg_translate.c
Log:
Moved Vex's arch/subarch detection out of main() into VG_(translate)()'s
init routine. This meant that VG_(vex_arch) and VG_(vex_subarch) could b=
e
made local to VG_(translate)().
Modified: trunk/coregrind/core.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/core.h 2005-05-11 22:36:07 UTC (rev 3666)
+++ trunk/coregrind/core.h 2005-05-11 22:45:48 UTC (rev 3667)
@@ -776,10 +776,6 @@
/* Stats ... */
extern void VG_(print_scheduler_stats) ( void );
=20
-/* Indicates what arch and subarch we are running on. */
-extern VexArch VG_(vex_arch);
-extern VexSubArch VG_(vex_subarch);
-
/* 64-bit counter for the number of basic blocks done. */
extern ULong VG_(bbs_done);
=20
Modified: trunk/coregrind/vg_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/vg_main.c 2005-05-11 22:36:07 UTC (rev 3666)
+++ trunk/coregrind/vg_main.c 2005-05-11 22:45:48 UTC (rev 3667)
@@ -153,11 +153,7 @@
Char** VG_(client_argv);
Char** VG_(client_envp);
=20
-/* Indicates what arch and subarch we are running on. */
-VexArch VG_(vex_arch) =3D VexArch_INVALID;
-VexSubArch VG_(vex_subarch) =3D VexSubArch_INVALID;
=20
-
/* ---------------------------------------------------------------------
Running stuff =20
------------------------------------------------------------------ */
@@ -2627,30 +2623,6 @@
VG_TDICT_CALL(tool_post_clo_init);
=20
//--------------------------------------------------------------
- // Determine CPU architecture and subarchitecture
- // p: none
- //--------------------------------------------------------------
- VG_(debugLog)(1, "main", "Check CPU arch/subarch\n");
- { Bool ok =3D VGA_(getArchAndSubArch)(
- & VG_(vex_arch), & VG_(vex_subarch) );
- if (!ok) {
- VG_(printf)("\n");
- VG_(printf)("valgrind: fatal error: unsupported CPU.\n");
- VG_(printf)(" Supported CPUs are:\n");
- VG_(printf)(" * x86 with SSE state (Pentium II or above, "
- "AMD Athlon or above)\n");
- VG_(printf)("\n");
- VG_(exit)(1);
- }
- if (VG_(clo_verbosity) > 2) {
- VG_(message)(Vg_DebugMsg,=20
- "Host CPU: arch =3D %s, subarch =3D %s",
- LibVEX_ppVexArch( VG_(vex_arch) ),
- LibVEX_ppVexSubArch( VG_(vex_subarch) ) );
- }
- }
-
- //--------------------------------------------------------------
// Build segment map (all segments)
// p: shadow/redzone segments
// p: setup_client_stack() [for 'sp_at_startup']
Modified: trunk/coregrind/vg_translate.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/vg_translate.c 2005-05-11 22:36:07 UTC (rev 3666)
+++ trunk/coregrind/vg_translate.c 2005-05-11 22:45:48 UTC (rev 3667)
@@ -342,7 +342,6 @@
VG_(tdict).track_die_mem_stack );
}
=20
-
Bool VG_(translate) ( ThreadId tid,=20
Addr64 orig_addr,
Bool debugging_translation,
@@ -355,11 +354,32 @@
Segment* seg;
VexGuestExtents vge;
=20
+ /* Indicates what arch and subarch we are running on. */
+ static VexArch vex_arch =3D VexArch_INVALID;
+ static VexSubArch vex_subarch =3D VexSubArch_INVALID;
+
/* Make sure Vex is initialised right. */
VexTranslateResult tres;
static Bool vex_init_done =3D False;
=20
if (!vex_init_done) {
+ Bool ok =3D VGA_(getArchAndSubArch)( &vex_arch, &vex_subarch );
+ if (!ok) {
+ VG_(printf)("\n");
+ VG_(printf)("valgrind: fatal error: unsupported CPU.\n");
+ VG_(printf)(" Supported CPUs are:\n");
+ VG_(printf)(" * x86 with SSE state (Pentium II or above, "
+ "AMD Athlon or above)\n");
+ VG_(printf)("\n");
+ VG_(exit)(1);
+ }
+ if (VG_(clo_verbosity) > 2) {
+ VG_(message)(Vg_DebugMsg,=20
+ "Host CPU: arch =3D %s, subarch =3D %s",
+ LibVEX_ppVexArch ( vex_arch ),
+ LibVEX_ppVexSubArch( vex_subarch ) );
+ }
+
LibVEX_Init ( &failure_exit, &log_bytes,=20
1, /* debug_paranoia */=20
False, /* valgrind support */
@@ -446,8 +466,8 @@
tl_assert2(VG_(tdict).tool_instrument,
"you forgot to set VgToolInterface function 'tool_instrume=
nt'");
tres =3D LibVEX_Translate (=20
- VG_(vex_arch), VG_(vex_subarch),
- VG_(vex_arch), VG_(vex_subarch),
+ vex_arch, vex_subarch,
+ vex_arch, vex_subarch,
(UChar*)ULong_to_Ptr(orig_addr),=20
(Addr64)orig_addr,=20
chase_into_ok,
|