From: Nicholas Nethercote Date: Mon, 16 May 2005 21:16:44 +0000 (+0000) Subject: Move ThreadArchState into core.h and avoid duplication. X-Git-Tag: svn/VALGRIND_3_0_0~571 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c67331c7d662e84ebe5043c8793e32895c4806b;p=thirdparty%2Fvalgrind.git Move ThreadArchState into core.h and avoid duplication. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3747 --- diff --git a/coregrind/amd64/core_arch.h b/coregrind/amd64/core_arch.h index 515d3bf082..193a5ef75a 100644 --- a/coregrind/amd64/core_arch.h +++ b/coregrind/amd64/core_arch.h @@ -56,32 +56,6 @@ #define VGA_CLREQ_ARGS guest_RAX #define VGA_CLREQ_RET guest_RDX -/* --------------------------------------------------------------------- - Architecture-specific part of a ThreadState - ------------------------------------------------------------------ */ - -// Architecture-specific part of a ThreadState -// XXX: eventually this should be made abstract, ie. the fields not visible -// to the core... -typedef - struct { - /* --- BEGIN vex-mandated guest state --- */ - - /* Saved machine context. */ - VexGuestAMD64State vex; - - /* Saved shadow context. */ - VexGuestAMD64State vex_shadow; - - /* Spill area. */ - UChar vex_spill[LibVEX_N_SPILL_BYTES]; - - /* --- END vex-mandated guest state --- */ - } - ThreadArchState; - -typedef VexGuestAMD64State VexGuestArchState; - /* --------------------------------------------------------------------- Miscellaneous constants ------------------------------------------------------------------ */ diff --git a/coregrind/arm/core_arch.h b/coregrind/arm/core_arch.h index 3216187dc6..13ad9c81e0 100644 --- a/coregrind/arm/core_arch.h +++ b/coregrind/arm/core_arch.h @@ -36,7 +36,6 @@ #include "libvex.h" #include "libvex_guest_arm.h" - /* --------------------------------------------------------------------- Basic properties ------------------------------------------------------------------ */ @@ -62,36 +61,6 @@ #define VGA_CLREQ_ARGS guest_R0 #define VGA_CLREQ_RET guest_R0 -// Get stack pointer and frame pointer -#define VGA_GET_REAL_STACK_PTR(esp) do { \ - I_die_here; \ -} while (0) - -#define VGA_GET_REAL_FRAME_PTR(ebp) do { \ - I_die_here; \ -} while (0) - -/* --------------------------------------------------------------------- - Architecture-specific part of a ThreadState - ------------------------------------------------------------------ */ - -// Architecture-specific part of a ThreadState -// XXX: eventually this should be made abstract, ie. the fields not visible -// to the core... ?? -typedef struct { - /* Saved machine context. */ - VexGuestARMState vex; - - /* Saved shadow context. */ - VexGuestARMState vex_shadow; - - /* Spill area. */ - UChar vex_spill[LibVEX_N_SPILL_BYTES]; -} -ThreadArchState; - -typedef VexGuestARMState VexGuestArchState; - /* --------------------------------------------------------------------- Miscellaneous constants ------------------------------------------------------------------ */ diff --git a/coregrind/core.h b/coregrind/core.h index 59d7932006..824ac7d6c8 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -300,6 +300,36 @@ typedef } VgSchedReturnCode; + +#if defined(VGA_x86) + typedef VexGuestX86State VexGuestArchState; +#elif defined(VGA_x86) + typedef VexGuestAMD64State VexGuestArchState; +#elif defined(VGA_arm) + typedef VexGuestARMState VexGuestArchState; +#else +# error Unknown architecture +#endif + + +typedef + struct { + /* --- BEGIN vex-mandated guest state --- */ + + /* Saved machine context. */ + VexGuestArchState vex; + + /* Saved shadow context. */ + VexGuestArchState vex_shadow; + + /* Spill area. */ + UChar vex_spill[LibVEX_N_SPILL_BYTES]; + + /* --- END vex-mandated guest state --- */ + } + ThreadArchState; + + struct _ThreadState { /* ThreadId == 0 (and hence vg_threads[0]) is NEVER USED. The thread identity is simply the index in vg_threads[]. diff --git a/coregrind/x86/core_arch.h b/coregrind/x86/core_arch.h index 68f4faf1bb..a0816d684a 100644 --- a/coregrind/x86/core_arch.h +++ b/coregrind/x86/core_arch.h @@ -64,29 +64,6 @@ //extern const Char VG_(helper_breakpoint)[]; -/* --------------------------------------------------------------------- - Architecture-specific part of a ThreadState - ------------------------------------------------------------------ */ - -typedef - struct { - /* --- BEGIN vex-mandated guest state --- */ - - /* Saved machine context. */ - VexGuestX86State vex; - - /* Saved shadow context. */ - VexGuestX86State vex_shadow; - - /* Spill area. */ - UChar vex_spill[LibVEX_N_SPILL_BYTES]; - - /* --- END vex-mandated guest state --- */ - } - ThreadArchState; - -typedef VexGuestX86State VexGuestArchState; - /* --------------------------------------------------------------------- Miscellaneous constants ------------------------------------------------------------------ */