|
|
147e83 |
# commit 0b2c2ace3601d5d59cf89130b16840e7f132f7a6
|
|
|
147e83 |
# Author: Alan Modra <amodra@gmail.com>
|
|
|
147e83 |
# Date: Sat Aug 17 18:36:45 2013 +0930
|
|
|
147e83 |
#
|
|
|
147e83 |
# PowerPC makecontext
|
|
|
147e83 |
# http://sourceware.org/ml/libc-alpha/2013-08/msg00092.html
|
|
|
147e83 |
#
|
|
|
147e83 |
# Use conditional form of branch and link to avoid destroying the cpu
|
|
|
147e83 |
# link stack used to predict blr return addresses.
|
|
|
147e83 |
#
|
|
|
147e83 |
# * sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S: Use
|
|
|
147e83 |
# conditional form of branch and link when obtaining pc.
|
|
|
147e83 |
# * sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Likewise.
|
|
|
147e83 |
#
|
|
|
147e83 |
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
|
|
|
147e83 |
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S 2014-05-28 12:25:49.000000000 -0500
|
|
|
147e83 |
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S 2014-05-28 12:25:51.000000000 -0500
|
|
|
147e83 |
@@ -47,7 +47,9 @@
|
|
|
147e83 |
#ifdef PIC
|
|
|
147e83 |
mflr r0
|
|
|
147e83 |
cfi_register(lr,r0)
|
|
|
147e83 |
- bl 1f
|
|
|
147e83 |
+ /* Use this conditional form of branch and link to avoid destroying
|
|
|
147e83 |
+ the cpu link stack used to predict blr return addresses. */
|
|
|
147e83 |
+ bcl 20,31,1f
|
|
|
147e83 |
1: mflr r6
|
|
|
147e83 |
addi r6,r6,L(exitcode)-1b
|
|
|
147e83 |
mtlr r0
|
|
|
147e83 |
@@ -136,7 +138,9 @@
|
|
|
147e83 |
#ifdef PIC
|
|
|
147e83 |
mflr r0
|
|
|
147e83 |
cfi_register(lr,r0)
|
|
|
147e83 |
- bl 1f
|
|
|
147e83 |
+ /* Use this conditional form of branch and link to avoid destroying
|
|
|
147e83 |
+ the cpu link stack used to predict blr return addresses. */
|
|
|
147e83 |
+ bcl 20,31,1f
|
|
|
147e83 |
1: mflr r6
|
|
|
147e83 |
addi r6,r6,L(novec_exitcode)-1b
|
|
|
147e83 |
mtlr r0
|
|
|
147e83 |
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
|
|
|
147e83 |
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S 2014-05-28 12:25:49.000000000 -0500
|
|
|
147e83 |
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S 2014-05-28 12:25:51.000000000 -0500
|
|
|
147e83 |
@@ -124,8 +124,10 @@
|
|
|
147e83 |
|
|
|
147e83 |
/* If the target function returns we need to do some cleanup. We use a
|
|
|
147e83 |
code trick to get the address of our cleanup function into the link
|
|
|
147e83 |
- register. Do not add any code between here and L(exitcode). */
|
|
|
147e83 |
- bl L(gotexitcodeaddr);
|
|
|
147e83 |
+ register. Do not add any code between here and L(exitcode).
|
|
|
147e83 |
+ Use this conditional form of branch and link to avoid destroying
|
|
|
147e83 |
+ the cpu link stack used to predict blr return addresses. */
|
|
|
147e83 |
+ bcl 20,31,L(gotexitcodeaddr);
|
|
|
147e83 |
|
|
|
147e83 |
/* This is the helper code which gets called if a function which
|
|
|
147e83 |
is registered with 'makecontext' returns. In this case we
|