This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix handling of NULL context link in powerpc64 makecontext
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: libc-alpha at sourceware dot org
- Cc: Ryan Arnold <rsa at us dot ibm dot com>
- Date: Wed, 31 Oct 2012 23:17:56 +0100
- Subject: [PATCH] Fix handling of NULL context link in powerpc64 makecontext
If the function registered with makecontext returns with a NULL context
link the process should exit with zero, not non-zero.
Andreas.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: If the
function returns with a NULL context exit with zero.
---
.../sysv/linux/powerpc/powerpc64/makecontext.S | 30 +++++++++++-----------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
index ded2a35..0939a65 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
@@ -134,26 +134,26 @@ L(noparms):
'makecontext' call. If the pointer is NULL the process must
terminate. */
L(exitcode):
- /* Recover the ucontext and TOC from the dummy frame. */
- ld r1,FRAME_BACKCHAIN(r1) /* Unstack the parameter save area frame. */
- ld r3,FRAME_PARM1_SAVE(r1)
- ld r2,FRAME_TOC_SAVE(r1)
- ld r3,UCONTEXT_LINK(r3) /* Load the resume context. */
- cmpdi r3,0
- beq L(BADSTATUS)
+ /* Recover the ucontext and TOC from the dummy frame. */
+ ld r1,FRAME_BACKCHAIN(r1) /* Unstack the parameter save area frame. */
+ ld r3,FRAME_PARM1_SAVE(r1)
+ ld r2,FRAME_TOC_SAVE(r1)
+ ld r3,UCONTEXT_LINK(r3) /* Load the resume context. */
+ cmpdi r3,0
+ beq L(do_exit)
bl JUMPTARGET(__setcontext)
nop
-
-L(BADSTATUS):
-/* If setcontext returns (which can happen if the syscall fails) we will
- exit the program with error status (-1). */
- li r3,-1
+ /* If setcontext returns (which can happen if the syscall fails) we will
+ exit the program with error status (-1). */
+ li r3,-1
+L(do_exit):
#ifdef SHARED
- b JUMPTARGET(__GI_exit);
+ b JUMPTARGET(__GI_exit);
#else
- b JUMPTARGET(exit);
- nop
+ b JUMPTARGET(exit);
+ nop
#endif
+ b L(do_exit)
/* The address of the exit code is in the link register. Store the lr
in the ucontext as LNK so the target function will return to our
--
1.8.0
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."