about summary refs log tree commit diff
path: root/sysdeps/arm/setjmp.S
diff options
context:
space:
mode:
authorWill Newton <will.newton@linaro.org>2014-01-27 09:01:03 +0000
committerWill Newton <will.newton@linaro.org>2014-02-25 10:07:04 +0000
commit80a56cc3ee45d4a2a1c3ec5e67ff359a7b380fb6 (patch)
tree7929367afdfbb5ccd9b062812aa9180e46cf8dcb /sysdeps/arm/setjmp.S
parent3ea0f74e1d5a376eaa2905d4fe60fc0cca95e42f (diff)
downloadglibc-80a56cc3ee45d4a2a1c3ec5e67ff359a7b380fb6.tar.gz
glibc-80a56cc3ee45d4a2a1c3ec5e67ff359a7b380fb6.tar.xz
glibc-80a56cc3ee45d4a2a1c3ec5e67ff359a7b380fb6.zip
ARM: Add SystemTap probes to longjmp and setjmp.
Now the ARM port implements pointer encryption for jmpbufs, gdb needs
a SystemTap probe point in longjmp to determine the target PC of
a call to longjmp. This patch implements the probe point in longjmp
and a similar probe point in setjmp.

In order to have all the appropriate registers available to pass to the
probe this reorders the layout of jmpbuf, putting the sp and lr registers
at the start rather than the end, allowing them to be read and
written sequentially.

Tested on armv7, no new failures in the glibc testsuite and confirmed
that this fixes the gdb.base/longjmp.exp failures in the gdb testsuite.

ChangeLog:

2014-02-25  Will Newton  <will.newton@linaro.org>

	* sysdeps/arm/__longjmp.S: Include stap-probe.h.
	(__longjmp): Restore sp and lr before restoring callee
	saved registers.  Add longjmp and longjmp_target
	SystemTap probe point.
	* sysdeps/arm/bits/setjmp.h (__jmp_buf): Update comment.
	* sysdeps/arm/include/bits/setjmp.h (__JMP_BUF_SP):
	Define to zero to match jmpbuf layout.
	* sysdeps/arm/setjmp.S: Include stap-probe.h.
	(__sigsetjmp): Save sp and lr before saving callee
	saved registers.  Add setjmp SystemTap probe point.
Diffstat (limited to 'sysdeps/arm/setjmp.S')
-rw-r--r--sysdeps/arm/setjmp.S12
1 files changed, 9 insertions, 3 deletions
diff --git a/sysdeps/arm/setjmp.S b/sysdeps/arm/setjmp.S
index b0b45ed8da..5e55ca5061 100644
--- a/sysdeps/arm/setjmp.S
+++ b/sysdeps/arm/setjmp.S
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <sysdep.h>
+#include <stap-probe.h>
 #include <bits/setjmp.h>
 #include <rtld-global-offsets.h>
 #include <arm-features.h>
@@ -27,9 +28,11 @@ ENTRY (__sigsetjmp)
 #endif
 	mov	ip, r0
 
-	/* Save registers */
-	sfi_breg ip, \
-	stmia	\B!, JMP_BUF_REGLIST
+	/* setjmp probe expects sigsetjmp first argument (4@r0), second
+	   argument (-4@r1), and target address (4@r14), respectively.  */
+	LIBC_PROBE (setjmp, 3, 4@r0, -4@r1, 4@r14)
+
+	/* Save sp and lr */
 #ifdef PTR_MANGLE
 	mov	a4, sp
 	PTR_MANGLE2 (a4, a4, a3)
@@ -40,6 +43,9 @@ ENTRY (__sigsetjmp)
 	str	sp, [ip], #4
 	str	lr, [ip], #4
 #endif
+	/* Save registers */
+	sfi_breg ip, \
+	stmia	\B!, JMP_BUF_REGLIST
 
 #if !defined ARM_ASSUME_NO_IWMMXT || defined __SOFTFP__
 # define NEED_HWCAP 1