This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PowerPC makecontext
- From: Alan Modra <amodra at gmail dot com>
- To: libc-alpha at sourceware dot org
- Date: Fri, 9 Aug 2013 14:25:03 +0930
- Subject: PowerPC makecontext
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.
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
index 95902b1..54f44c8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
@@ -47,7 +47,7 @@ ENTRY(__makecontext)
#ifdef PIC
mflr r0
cfi_register(lr,r0)
- bl 1f
+ bcl 20,31,1f
1: mflr r6
addi r6,r6,L(exitcode)-1b
mtlr r0
@@ -136,7 +136,7 @@ ENTRY(__novec_makecontext)
#ifdef PIC
mflr r0
cfi_register(lr,r0)
- bl 1f
+ bcl 20,31,1f
1: mflr r6
addi r6,r6,L(novec_exitcode)-1b
mtlr r0
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
index 4a16669..4b5550b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
@@ -125,7 +125,7 @@ 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);
+ 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
--
Alan Modra
Australia Development Lab, IBM