about summary refs log tree commit diff
path: root/sysdeps/s390/s390-64
diff options
context:
space:
mode:
authorStefan Liebler <stli@linux.vnet.ibm.com>2014-11-13 10:44:42 +0100
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2014-11-13 10:44:42 +0100
commit53244a4e12797f10c028d2cf0e091330854c44e7 (patch)
tree5d507bb411c3c4c1131ead9d5eda8ab88fc69d22 /sysdeps/s390/s390-64
parent47df8251e8df7570d9581806113723aeb07dc35d (diff)
downloadglibc-53244a4e12797f10c028d2cf0e091330854c44e7.tar.gz
glibc-53244a4e12797f10c028d2cf0e091330854c44e7.tar.xz
glibc-53244a4e12797f10c028d2cf0e091330854c44e7.zip
S/390: Add SystemTap probes to longjmp and setjmp.
Diffstat (limited to 'sysdeps/s390/s390-64')
-rw-r--r--sysdeps/s390/s390-64/__longjmp.c23
-rw-r--r--sysdeps/s390/s390-64/setjmp.S4
2 files changed, 23 insertions, 4 deletions
diff --git a/sysdeps/s390/s390-64/__longjmp.c b/sysdeps/s390/s390-64/__longjmp.c
index 168ebf562b..e2b13f84ac 100644
--- a/sysdeps/s390/s390-64/__longjmp.c
+++ b/sysdeps/s390/s390-64/__longjmp.c
@@ -22,6 +22,7 @@
 #include <bits/setjmp.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <stap-probe.h>
 
 /* Jump to the position specified by ENV, causing the
    setjmp call there to return VAL, or 1 if VAL is 0.  */
@@ -42,7 +43,20 @@ __longjmp (__jmp_buf env, int val)
   register void *r1 __asm ("%r1") = (void *) env;
 #endif
   /* Restore registers and jump back.  */
-  asm volatile ("ld    %%f8,80(%1)\n\t"
+  asm volatile (
+		/* longjmp probe expects longjmp first argument, second
+		   argument and target address.  */
+#ifdef PTR_DEMANGLE
+		"lmg  %%r4,%%r5,64(%1)\n\t"
+		"xgr  %%r4,%2\n\t"
+		"xgr  %%r5,%2\n\t"
+		LIBC_PROBE_ASM (longjmp, 8@%1 -4@%0 8@%%r4)
+#else
+		LIBC_PROBE_ASM (longjmp, 8@%1 -4@%0 8@%%r14)
+#endif
+
+		/* restore fpregs  */
+		"ld    %%f8,80(%1)\n\t"
 		"ld    %%f9,88(%1)\n\t"
 		"ld    %%f10,96(%1)\n\t"
 		"ld    %%f11,104(%1)\n\t"
@@ -50,15 +64,16 @@ __longjmp (__jmp_buf env, int val)
 		"ld    %%f13,120(%1)\n\t"
 		"ld    %%f14,128(%1)\n\t"
 		"ld    %%f15,136(%1)\n\t"
+
+		/* restore gregs and return to jmp_buf target  */
 #ifdef PTR_DEMANGLE
 		"lmg  %%r6,%%r13,0(%1)\n\t"
-		"lmg  %%r4,%%r5,64(%1)\n\t"
-		"xgr  %%r4,%2\n\t"
-		"xgr  %%r5,%2\n\t"
 		"lgr  %%r15,%%r5\n\t"
+		LIBC_PROBE_ASM (longjmp_target, 8@%1 -4@%0 8@%%r4)
 		"br   %%r4"
 #else
 		"lmg  %%r6,%%r15,0(%1)\n\t"
+		LIBC_PROBE_ASM (longjmp_target, 8@%1 -4@%0 8@%%r14)
 		"br   %%r14"
 #endif
 		: : "r" (r2),
diff --git a/sysdeps/s390/s390-64/setjmp.S b/sysdeps/s390/s390-64/setjmp.S
index faa2784d17..03de2bf47e 100644
--- a/sysdeps/s390/s390-64/setjmp.S
+++ b/sysdeps/s390/s390-64/setjmp.S
@@ -22,6 +22,7 @@
 #define _SETJMP_H
 #include <bits/setjmp.h>
 #include <shlib-compat.h>
+#include <stap-probe.h>
 
 #if !defined IS_IN_rtld
 # if defined SHARED &&  SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)
@@ -53,6 +54,9 @@ END (__setjmp)
 
 ENTRY(__sigsetjmp)
 .Linternal_sigsetjmp:
+	/* setjmp probe expects sig/setjmp first argument (8@%r2), second
+	   argument (-8@%r3) and target address (8@%r14).  */
+	LIBC_PROBE (setjmp, 3, 8@%r2, -4@%r3, 8@%r14)
 #ifdef PTR_MANGLE
 	stmg   %r6,%r13,0(%r2)      /* Store registers in jmp_buf.  */
 	lgr    %r4,%r14