public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Pavel.Kozlov@synopsys.com, libc-alpha@sourceware.org
Cc: linux-snps-arc@lists.infradead.org
Subject: Re: [PATCH 2/2] ARC: run child from the separate start block in __clone
Date: Tue, 7 Mar 2023 09:03:11 -0300	[thread overview]
Message-ID: <54b35884-f250-e212-38eb-b0604f496246@linaro.org> (raw)
In-Reply-To: <20230302161019.27192-2-kozlov@synopsys.com>



On 02/03/23 13:10, Pavel Kozlov via Libc-alpha wrote:
> From: Pavel Kozlov <pavel.kozlov@synopsys.com>
> 
> For better debug experience use separate code block with extra
> cfi_* directives to run child (same as in __clone3).

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/arc/clone.S | 40 ++++++++++++++++++-----------
>  1 file changed, 25 insertions(+), 15 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/arc/clone.S b/sysdeps/unix/sysv/linux/arc/clone.S
> index 766649625658..0029aaeb8170 100644
> --- a/sysdeps/unix/sysv/linux/arc/clone.S
> +++ b/sysdeps/unix/sysv/linux/arc/clone.S
> @@ -20,9 +20,6 @@
>  #include <sysdep.h>
>  #define _ERRNO_H	1
>  #include <bits/errno.h>
> -#include <tcb-offsets.h>
> -
> -#define CLONE_SETTLS		0x00080000
>  
>  /* int clone(int (*fn)(void *), void *child_stack,
>             int flags, void *arg, ...
> @@ -63,19 +60,9 @@ ENTRY (__clone)
>  	ARC_TRAP_INSN
>  
>  	cmp	r0, 0		/* return code : 0 new process, !0 parent.  */
> +	beq	thread_start_clone
>  	blt	L (__sys_err2)	/* < 0 (signed) error.  */
> -	jnz	[blink]		/* Parent returns.  */
> -
> -	/* child jumps off to @fn with @arg as argument
> -           TP register already set by kernel.  */
> -	jl.d	[r10]
> -	mov	r0, r11
> -
> -	/* exit() with result from @fn (already in r0).  */
> -	mov	r8, __NR_exit
> -	ARC_TRAP_INSN
> -	/* In case it ever came back.  */
> -	flag	1
> +	j	[blink]		/* Parent returns.  */
>  
>  L (__sys_err):
>  	mov	r0, -EINVAL
> @@ -89,5 +76,28 @@ L (__sys_err2):
>  	       position independent.  */
>  	b   __syscall_error
>  PSEUDO_END (__clone)
> +
> +
> +	.align 4
> +	.type thread_start_clone, %function
> +thread_start_clone:
> +	cfi_startproc
> +	/* Terminate call stack by noting ra is undefined.  */
> +	cfi_undefined (blink)
> +
> +	/* Child jumps off to @fn with @arg as argument.  */
> +	jl.d	[r10]
> +	mov	r0, r11
> +
> +	/* exit() with result from @fn (already in r0).  */
> +	mov	r8, __NR_exit
> +	ARC_TRAP_INSN
> +
> +	/* In case it ever came back.  */
> +	flag	1
> +
> +	cfi_endproc
> +	.size thread_start_clone, .-thread_start_clone
> +
>  libc_hidden_def (__clone)
>  weak_alias (__clone, clone)

  reply	other threads:[~2023-03-07 12:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 16:10 [PATCH 1/2] ARC: Add the clone3 wrapper Pavel.Kozlov
2023-03-02 16:10 ` [PATCH 2/2] ARC: run child from the separate start block in __clone Pavel.Kozlov
2023-03-07 12:03   ` Adhemerval Zanella Netto [this message]
2023-03-07 12:02 ` [PATCH 1/2] ARC: Add the clone3 wrapper Adhemerval Zanella Netto

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=54b35884-f250-e212-38eb-b0604f496246@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=Pavel.Kozlov@synopsys.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-snps-arc@lists.infradead.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).