]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Arch-abstraction:
authorNicholas Nethercote <n.nethercote@gmail.com>
Sat, 11 Sep 2004 15:30:33 +0000 (15:30 +0000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Sat, 11 Sep 2004 15:30:33 +0000 (15:30 +0000)
- abstract out some inline asm

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2696

coregrind/vg_mylibc.c
coregrind/x86/core_arch.h

index ef39f73794c335751d313f1dce1e0f417abd9910..66b57d5e280a550b28e0daface9dd7c124609dc5 100644 (file)
@@ -1091,7 +1091,8 @@ static inline ExeContext *get_real_execontext(Addr ret)
    Addr esp, ebp;
    Addr stacktop, sigstack_low, sigstack_high;
 
-   asm("movl %%ebp, %0; movl %%esp, %1" : "=r" (ebp), "=r" (esp));
+   ARCH_GET_REAL_STACK_PTR(esp);
+   ARCH_GET_REAL_FRAME_PTR(ebp);
    stacktop = VG_(valgrind_last);
    VG_(get_sigstack_bounds)( &sigstack_low, &sigstack_high );
    if (esp >= sigstack_low && esp < sigstack_high)
index 425ff5b5b46379c1c9c5fa51c9057a57795d7f4a..00e154bad486d454c34dfdf461beef7600a93806 100644 (file)
 #define VGOFF_STACK_PTR                VGOFF_(m_esp)
 #define VGOFF_FRAME_PTR                VGOFF_(m_ebp)
 
+// Get stack pointer and frame pointer
+#define ARCH_GET_REAL_STACK_PTR(esp) do {   \
+   asm("movl %%esp, %0" : "=r" (esp));       \
+} while (0)
+
+#define ARCH_GET_REAL_FRAME_PTR(ebp) do {   \
+   asm("movl %%ebp, %0" : "=r" (ebp));       \
+} while (0)
+
+
 /* -----------------------------------------------------
    Read-write parts of baseBlock.
    -------------------------------------------------- */