m68k: define stackinfo_get_sp, stackinfo_sub_sp
authorAndreas Schwab <schwab@linux-m68k.org>
Tue, 1 Nov 2011 15:03:29 +0000 (16:03 +0100)
committerAndreas Schwab <schwab@linux-m68k.org>
Tue, 1 Nov 2011 17:35:32 +0000 (18:35 +0100)
ChangeLog.m68k
sysdeps/m68k/stackinfo.h

index 09de159..42dcf75 100644 (file)
@@ -1,3 +1,8 @@
+2011-11-01  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * sysdeps/m68k/stackinfo.h (stackinfo_get_sp, stackinfo_sub_sp):
+       Define.
+
 2011-10-26  Andreas Schwab  <schwab@linux-m68k.org>
 
        * sysdeps/m68k/m680x0/fpu/math_private.h: New file.
index b44d4d0..bcfdb12 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2010, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
    is present, but it is presumed absent.  */
 #define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
 
+/* Access to the stack pointer.  */
+#define stackinfo_get_sp() \
+  ({ void *p__; asm volatile ("move.l %%sp, %0" : "=r" (p__)); p__; })
+#define stackinfo_sub_sp(ptr) \
+  ({ ptrdiff_t d__;                                            \
+     asm volatile ("sub.l %%sp, %0" : "=r" (d__) : "0" (ptr)); \
+     d__; })
+
 #endif /* stackinfo.h */