public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v3] Fix clone (CLONE_VM) pid/tid reset (BZ#19957)
Date: Fri, 22 Apr 2016 19:40:00 -0000	[thread overview]
Message-ID: <87eg9x77q2.fsf@linux-m68k.org> (raw)
In-Reply-To: <1461351245-22814-1-git-send-email-adhemerval.zanella@linaro.org> (Adhemerval Zanella's message of "Fri, 22 Apr 2016 15:54:05 -0300")

Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:

> diff --git a/sysdeps/unix/sysv/linux/m68k/clone.S b/sysdeps/unix/sysv/linux/m68k/clone.S
> index 33474cc..84eb2b9 100644
> --- a/sysdeps/unix/sysv/linux/m68k/clone.S
> +++ b/sysdeps/unix/sysv/linux/m68k/clone.S
> @@ -25,7 +25,6 @@
>  #include <tls.h>
>  
>  #define CLONE_VM      0x00000100
> -#define CLONE_THREAD  0x00010000
>  
>  /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
>  	     void *parent_tidptr, void *tls, void *child_tidptr) */
> @@ -101,12 +100,9 @@ thread_start:
>  	subl	%fp, %fp	/* terminate the stack frame */
>  	/* Check and see if we need to reset the PID.  */
>  	movel	%d1, %a1
> -	andl	#CLONE_THREAD, %d1
> +	andl	#CLONE_VM, %d1
>  	jne	donepid
>  	movel	%a1, %d1
> -	movel	#-1, %d0
> -	andl	#CLONE_VM, %d1
> -	jne	gotpid
>  	movel	#SYS_ify (getpid), %d0
>  	trap	#0
>  gotpid:

This can be simplified further:

diff --git a/sysdeps/unix/sysv/linux/m68k/clone.S b/sysdeps/unix/sysv/linux/m68k/clone.S
index 33474cc..aec12cb 100644
--- a/sysdeps/unix/sysv/linux/m68k/clone.S
+++ b/sysdeps/unix/sysv/linux/m68k/clone.S
@@ -25,7 +25,6 @@
 #include <tls.h>
 
 #define CLONE_VM      0x00000100
-#define CLONE_THREAD  0x00010000
 
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
 	     void *parent_tidptr, void *tls, void *child_tidptr) */
@@ -100,16 +99,10 @@ thread_start:
 	cfi_undefined (pc)	/* Mark end of stack */
 	subl	%fp, %fp	/* terminate the stack frame */
 	/* Check and see if we need to reset the PID.  */
-	movel	%d1, %a1
-	andl	#CLONE_THREAD, %d1
-	jne	donepid
-	movel	%a1, %d1
-	movel	#-1, %d0
 	andl	#CLONE_VM, %d1
-	jne	gotpid
+	jne	donepid
 	movel	#SYS_ify (getpid), %d0
 	trap	#0
-gotpid:
 	movel	%a0, -(%sp)
 	movel	%d0, -(%sp)
 	bsrl	__m68k_read_tp@PLTPC


Andreas.

-- 
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."

  reply	other threads:[~2016-04-22 19:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 18:54 Adhemerval Zanella
2016-04-22 19:40 ` Andreas Schwab [this message]
2016-04-22 19:57   ` Adhemerval Zanella
2016-04-25 18:18 ` Carlos O'Donell
2016-04-25 20:31   ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eg9x77q2.fsf@linux-m68k.org \
    --to=schwab@linux-m68k.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).