S/390: Add SystemTap probes to longjmp and setjmp.
[glibc.git] / sysdeps / s390 / s390-64 / setjmp.S
blob03de2bf47ec72ea5b41637d3627501403be53279
1 /* setjmp for 64 bit S/390, ELF version.
2    Copyright (C) 2001-2014 Free Software Foundation, Inc.
3    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4    This file is part of the GNU C Library.
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, see
18    <http://www.gnu.org/licenses/>.  */
20 #include <sysdep.h>
21 #define _ASM
22 #define _SETJMP_H
23 #include <bits/setjmp.h>
24 #include <shlib-compat.h>
25 #include <stap-probe.h>
27 #if !defined IS_IN_rtld
28 # if defined SHARED &&  SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)
29         /* we need a unique name in case of symbol versioning.  */
30 #  define __sigsetjmp __v1__sigsetjmp
31 # endif /* if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)  */
32 #endif /* !defined IS_IN_rtld  */
34         /* We include the BSD entry points here as well but we make
35            them weak.  */
36 ENTRY (setjmp)
37         .weak C_SYMBOL_NAME (setjmp)
38         lghi   %r3,1                /* Second argument of one.  */
39         j      .Linternal_sigsetjmp /* Branch relativ to __sigsetjmp.  */
40 END (setjmp)
42         /* Binary compatibility entry point.  */
43 ENTRY(_setjmp)
44         .weak  C_SYMBOL_NAME (_setjmp)
45         slgr   %r3,%r3              /* Second argument of zero.  */
46         j      .Linternal_sigsetjmp /* Branch relativ to __sigsetjmp.  */
47 END (_setjmp)
48 libc_hidden_def (_setjmp)
50 ENTRY(__setjmp)
51         slgr   %r3,%r3              /* Second argument of zero.  */
52         j      .Linternal_sigsetjmp /* Branch relativ to __sigsetjmp.  */
53 END (__setjmp)
55 ENTRY(__sigsetjmp)
56 .Linternal_sigsetjmp:
57         /* setjmp probe expects sig/setjmp first argument (8@%r2), second
58            argument (-8@%r3) and target address (8@%r14).  */
59         LIBC_PROBE (setjmp, 3, 8@%r2, -4@%r3, 8@%r14)
60 #ifdef PTR_MANGLE
61         stmg   %r6,%r13,0(%r2)      /* Store registers in jmp_buf.  */
62         lgr    %r4,%r14
63         lgr    %r5,%r15
64         PTR_MANGLE (%r4, %r1)
65         PTR_MANGLE2 (%r5, %r1)
66         stmg   %r4,%r5,64(%r2)
67 #else
68         stmg   %r6,%r15,0(%r2)      /* Store registers in jmp_buf.  */
69 #endif
70         std    %f8,80(%r2)
71         std    %f9,88(%r2)
72         std    %f10,96(%r2)
73         std    %f11,104(%r2)
74         std    %f12,112(%r2)
75         std    %f13,120(%r2)
76         std    %f14,128(%r2)
77         std    %f15,136(%r2)
78 #ifdef IS_IN_rtld
79         /* In ld.so we never save the signal mask.  */
80         lghi   %r2,0
81         br     %r14
82 #elif defined PIC
83         jg     __sigjmp_save@PLT    /* Branch to PLT of __sigsetjmp.  */
84 #else
85         jg     __sigjmp_save
86 #endif
87 END (__sigsetjmp)
89 #if !defined IS_IN_rtld
90 # if defined SHARED &&  SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)
91 /* In glibc release 2.19 new versions of setjmp-functions were introduced,
92    but were reverted before 2.20. Thus both versions are the same function.  */
94 #  undef __sigsetjmp
96 weak_alias (setjmp, __v1setjmp);
97 weak_alias (setjmp, __v2setjmp);
98 versioned_symbol (libc, __v1setjmp, setjmp, GLIBC_2_0);
99 compat_symbol (libc, __v2setjmp, setjmp, GLIBC_2_19);
101 weak_alias (_setjmp, __v1_setjmp);
102 weak_alias (_setjmp, __v2_setjmp);
103 versioned_symbol (libc, __v1_setjmp, _setjmp, GLIBC_2_0);
104 compat_symbol (libc, __v2_setjmp, _setjmp, GLIBC_2_19);
106 strong_alias (__v1__sigsetjmp, __v2__sigsetjmp);
107 versioned_symbol (libc, __v1__sigsetjmp, __sigsetjmp, GLIBC_2_0);
108 compat_symbol (libc, __v2__sigsetjmp, __sigsetjmp, GLIBC_2_19);
109 # endif /* if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)  */
110 #endif /* if !defined IS_IN_rtld  */