]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/x86_64/stackinfo.h
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / x86_64 / stackinfo.h
index ea1e489f4e5f58ded477a70175c7534827b8188c..8ae7781d427f40ceb8006554cfb91bf5db0ee08b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2021 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
@@ -13,7 +13,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 /* This file contains a bit of information about the stack allocation
    of the processor.  */
 
 #include <elf.h>
 
+#ifdef __ILP32__
+# define RSP_REG "esp"
+#else
+# define RSP_REG "rsp"
+#endif
+
 /* On x86_64 the stack grows down.  */
 #define _STACK_GROWS_DOWN      1
 
    for which they need to act as barriers as well, hence the additional
    (unnecessary) parameters.  */
 #define stackinfo_get_sp() \
-  ({ void *p__; asm volatile ("mov %%" RSP_LP ", %0" : "=r" (p__)); p__; })
+  ({ void *p__; asm volatile ("mov %%" RSP_REG ", %0" : "=r" (p__)); p__; })
 #define stackinfo_sub_sp(ptr) \
   ({ ptrdiff_t d__;                                            \
-     asm volatile ("sub %%" RSP_LP " , %0" : "=r" (d__) : "0" (ptr));  \
+     asm volatile ("sub %%" RSP_REG " , %0" : "=r" (d__) : "0" (ptr)); \
      d__; })
 
 #endif /* stackinfo.h */