]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/unix/sysv/linux/sh/sysdep.h
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / sh / sysdep.h
index f0be37edc8f86933581462df70d63ec15771162d..52e77c9913cfdc6c8b366b1f7949546649d23e3b 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004,
-   2005,2006   Free Software Foundation, Inc.
+/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
    Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 #ifndef _LINUX_SH_SYSDEP_H
 #define _LINUX_SH_SYSDEP_H 1
 
 /* There is some commonality.  */
+#include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/sh/sysdep.h>
 #include <tls.h>
 
 # if RTLD_PRIVATE_ERRNO
 #  define SYSCALL_ERROR_HANDLER        \
        neg r0,r1; \
+       mov r12,r2; \
+       cfi_register (r12, r2); \
        mov.l 0f,r12; \
        mova 0f,r0; \
        add r0,r12; \
        mov.l 1f,r0; \
        mov.l r1,@(r0,r12); \
+       mov r2,r12; \
+       cfi_restore (r12); \
        bra .Lpseudo_end; \
         mov _IMM1,r0; \
        .align 2; \
 
 # elif defined _LIBC_REENTRANT
 
-#  if USE___THREAD
-#   ifndef NOT_IN_libc
-#    define SYSCALL_ERROR_ERRNO __libc_errno
-#   else
-#    define SYSCALL_ERROR_ERRNO errno
-#   endif
-#   define SYSCALL_ERROR_HANDLER \
+#  if IS_IN (libc)
+#   define SYSCALL_ERROR_ERRNO __libc_errno
+#  else
+#   define SYSCALL_ERROR_ERRNO errno
+#  endif
+#  define SYSCALL_ERROR_HANDLER \
        neg r0,r1; \
        mov r12,r2; \
+       cfi_register (r12, r2); \
        mov.l 0f,r12; \
        mova 0f,r0; \
        add r0,r12; \
        stc gbr, r4; \
        mov.l @(r0,r12),r0; \
        mov r2,r12; \
+       cfi_restore (r12); \
        add r4,r0; \
        mov.l r1,@r0; \
        bra .Lpseudo_end; \
        .align 2; \
      0: .long _GLOBAL_OFFSET_TABLE_; \
      1: .long SYSCALL_ERROR_ERRNO@GOTTPOFF
-#  else
-#   define SYSCALL_ERROR_HANDLER \
-       neg r0,r1; \
-       mov.l r14,@-r15; \
-       cfi_adjust_cfa_offset (4); \
-       cfi_rel_offset (r14, 0); \
-       mov.l r12,@-r15; \
-       cfi_adjust_cfa_offset (4); \
-       cfi_rel_offset (r12, 0); \
-       mov.l r1,@-r15; \
-       cfi_adjust_cfa_offset (4); \
-       cfi_rel_offset (r1, 0); \
-       mov.l 0f,r12; \
-       mova 0f,r0; \
-       add r0,r12; \
-       sts.l pr,@-r15; \
-       cfi_adjust_cfa_offset (4); \
-       cfi_rel_offset (pr, 0); \
-       mov r15,r14; \
-       cfi_def_cfa_register (r14); \
-       mov.l 1f,r1; \
-       bsrf r1; \
-         nop; \
-     2: mov r14,r15; \
-       lds.l @r15+,pr; \
-       mov.l @r15+,r1; \
-       mov.l r1,@r0; \
-       mov.l @r15+,r12; \
-       mov.l @r15+,r14; \
-       bra .Lpseudo_end; \
-        mov _IMM1,r0; \
-       .align 2; \
-     0: .long _GLOBAL_OFFSET_TABLE_; \
-     1: .long PLTJMP(C_SYMBOL_NAME(__errno_location))-(2b-.)
-/* A quick note: it is assumed that the call to `__errno_location' does
-   not modify the stack!  */
-#  endif
 # else
 /* Store (-r0) into errno through the GOT.  */
 #  define SYSCALL_ERROR_HANDLER                                                      \
        neg r0,r1; \
        mov r12,r2; \
+       cfi_register (r12, r2); \
        mov.l 0f,r12; \
        mova 0f,r0; \
        add r0,r12; \
        mov.l 1f,r0; \
        mov.l @(r0,r12),r0; \
        mov r2,r12; \
+       cfi_restore (r12); \
        mov.l r1,@r0; \
        bra .Lpseudo_end; \
         mov _IMM1,r0; \
     unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args);             \
     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0))         \
       {                                                                       \
-        __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));                   \
-        resultvar = 0xffffffff;                                               \
+       __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));                   \
+       resultvar = 0xffffffff;                                               \
       }                                                                       \
     (int) resultvar; })
 
     asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD                              \
                  : "=z" (resultvar)                                          \
                  : "r" (r3) ASMFMT_##nr                                      \
-                 : "memory");                                                \
+                 : "memory", "t");                                           \
                                                                              \
     (int) resultvar; })
 
 #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
   ({                                                                         \
     unsigned long int resultvar;                                             \
-    register long int r3 asm ("%r3") = (name);                               \
+    register long int r3 asm ("%r3") = (name);                               \
     SUBSTITUTE_ARGS_##nr(args);                                                      \
                                                                              \
     asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD                              \
                  : "=z" (resultvar)                                          \
                  : "r" (r3) ASMFMT_##nr                                      \
-                 : "memory");                                                \
+                 : "memory", "t");                                           \
                                                                              \
     (int) resultvar; })
 
 #endif /* __ASSEMBLER__ */
 
 /* Pointer mangling support.  */
-#if defined NOT_IN_libc && defined IS_IN_rtld
+#if IS_IN (rtld)
 /* We cannot use the thread descriptor because in ld.so we use setjmp
    earlier than the descriptor is initialized.  Using a global variable
    is too complicated here since we have no PC-relative addressing mode.  */