]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
PowerPC makecontext
authorAlan Modra <amodra@gmail.com>
Sat, 17 Aug 2013 09:06:45 +0000 (18:36 +0930)
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Fri, 15 Nov 2013 17:30:42 +0000 (11:30 -0600)
http://sourceware.org/ml/libc-alpha/2013-08/msg00092.html

Use conditional form of branch and link to avoid destroying the cpu
link stack used to predict blr return addresses.

* sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S: Use
conditional form of branch and link when obtaining pc.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Likewise.

ChangeLog
sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S

index 2e6eb849d501f4abe25b58c18ed9b62424226df8..696a340db1ee5b6f1799236cd9122a05aa39bd6e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-10-04  Alan Modra  <amodra@gmail.com>
+
+       * sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S: Use
+       conditional form of branch and link when obtaining pc.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Likewise.
+
 2013-10-04  Alan Modra  <amodra@gmail.com>
 
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S: Use
index 95902b13f97b1f1b1877a9889d2019da846f1306..70e3c976266441a9cbc6ccbf4c4af87f5553040f 100644 (file)
@@ -47,7 +47,9 @@ ENTRY(__makecontext)
 #ifdef PIC
        mflr    r0
        cfi_register(lr,r0)
-       bl      1f
+       /* Use this conditional form of branch and link to avoid destroying
+          the cpu link stack used to predict blr return addresses.  */
+       bcl     20,31,1f
 1:     mflr    r6
        addi    r6,r6,L(exitcode)-1b
        mtlr    r0
@@ -136,7 +138,9 @@ ENTRY(__novec_makecontext)
 #ifdef PIC
        mflr    r0
        cfi_register(lr,r0)
-       bl      1f
+       /* Use this conditional form of branch and link to avoid destroying
+          the cpu link stack used to predict blr return addresses.  */
+       bcl     20,31,1f
 1:     mflr    r6
        addi    r6,r6,L(novec_exitcode)-1b
        mtlr    r0
index 4a1666938308106b863472ee3c18c9a02ed94278..32fc47c3f3d161c6259369776ed5a8cbae0e9d9c 100644 (file)
@@ -124,8 +124,10 @@ L(noparms):
 
   /* If the target function returns we need to do some cleanup.  We use a
      code trick to get the address of our cleanup function into the link
-     register.  Do not add any code between here and L(exitcode).  */
-  bl  L(gotexitcodeaddr);
+     register.  Do not add any code between here and L(exitcode).
+     Use this conditional form of branch and link to avoid destroying
+     the cpu link stack used to predict blr return addresses.  */
+  bcl  20,31,L(gotexitcodeaddr);
 
        /* This is the helper code which gets called if a function which
           is registered with 'makecontext' returns.  In this case we