Move VGA_GET_REAL_{STACK,FRAME}_PTR into vg_symtab2.c.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3729 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/amd64/core_arch.h b/coregrind/amd64/core_arch.h
index b5c2395..eb94bce 100644
--- a/coregrind/amd64/core_arch.h
+++ b/coregrind/amd64/core_arch.h
@@ -65,16 +65,6 @@
#define VGA_STACK_FRAME_RET(rbp) (((UWord*)rbp)[1])
#define VGA_STACK_FRAME_NEXT(rbp) (((UWord*)rbp)[0])
-// Get stack pointer and frame pointer
-#define VGA_GET_REAL_STACK_PTR(lval) do { \
- asm("movq %%rsp, %0" : "=r" (lval)); \
-} while (0)
-
-#define VGA_GET_REAL_FRAME_PTR(lval) do { \
- asm("movq %%rbp, %0" : "=r" (lval)); \
-} while (0)
-
-
/* ---------------------------------------------------------------------
Architecture-specific part of a ThreadState
------------------------------------------------------------------ */
diff --git a/coregrind/vg_mylibc.c b/coregrind/vg_mylibc.c
index 5611142..6224418 100644
--- a/coregrind/vg_mylibc.c
+++ b/coregrind/vg_mylibc.c
@@ -906,6 +906,23 @@
Assertery.
------------------------------------------------------------------ */
+#if defined(VGP_x86_linux)
+# define GET_REAL_SP_AND_FP(sp, fp) \
+ asm("movl %%esp, %0;" \
+ "movl %%ebp, %1;" \
+ : "=r" (sp),\
+ "=r" (fp));
+#elif defined(VGP_amd64_linux)
+# define GET_REAL_SP_AND_FP(sp, fp) \
+ asm("movq %%rsp, %0;" \
+ "movl %%rbp, %1;" \
+ : "=r" (sp),\
+ "=r" (fp));
+#else
+# error Unknown platform
+#endif
+
+
/* Fake up an ExeContext which is of our actual real CPU state, so we
can print a stack trace. This isn't terribly useful in the case
where we were killed by a signal, since we just get a backtrace
@@ -920,8 +937,7 @@
ThreadId tid = VG_(get_lwp_tid)(VG_(gettid)());
ThreadState *tst = VG_(get_ThreadState)(tid);
- VGA_GET_REAL_STACK_PTR(sp);
- VGA_GET_REAL_FRAME_PTR(fp);
+ GET_REAL_SP_AND_FP(sp, fp);
stacktop = tst->os_state.valgrind_stack_base +
tst->os_state.valgrind_stack_szB;
diff --git a/coregrind/x86/core_arch.h b/coregrind/x86/core_arch.h
index cac4e40..26c06d4 100644
--- a/coregrind/x86/core_arch.h
+++ b/coregrind/x86/core_arch.h
@@ -65,15 +65,6 @@
#define VGA_STACK_FRAME_RET(ebp) (((UInt*)ebp)[1])
#define VGA_STACK_FRAME_NEXT(ebp) (((UInt*)ebp)[0])
-// Get stack pointer and frame pointer
-#define VGA_GET_REAL_STACK_PTR(esp) do { \
- asm("movl %%esp, %0" : "=r" (esp)); \
-} while (0)
-
-#define VGA_GET_REAL_FRAME_PTR(ebp) do { \
- asm("movl %%ebp, %0" : "=r" (ebp)); \
-} while (0)
-
//extern const Char VG_(helper_wrapper_before)[]; /* in dispatch.S */
//extern const Char VG_(helper_wrapper_return)[]; /* in dispatch.S */