From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7912) id B9EC53858D32; Mon, 13 Mar 2023 14:16:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9EC53858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678717018; bh=uPq9nwqKOchTxS9n8Hx6e0Y7w2/Cb5xlL4LGkgcYca4=; h=From:To:Subject:Date:From; b=NcFnt2qSqCrLgKmClToqjYm+6fuokafk0qNlkjulwTHfYFtNCkLO9MaRYFRWSYBEG ZQ3kktdBzSOpO7Bo1CkF3wtOkpEF24J6PW9y+dyJggfmZWhyz4l4HlIdU/r/gZnXgk Vt+BcbHZ7D9ty2+sQ2bcXdapYbQgoM28p76t7Tso= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Pavel Kozlov To: glibc-cvs@sourceware.org Subject: [glibc] ARC: run child from the separate start block in __clone X-Act-Checkin: glibc X-Git-Author: Pavel Kozlov X-Git-Refname: refs/heads/master X-Git-Oldrev: 3681cdb8f8b2e19d510caa354fa8d5e466f1d72a X-Git-Newrev: 447273e0bf22a3d42e05e6b16d309f3f89879bea Message-Id: <20230313141658.B9EC53858D32@sourceware.org> Date: Mon, 13 Mar 2023 14:16:58 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=447273e0bf22a3d42e05e6b16d309f3f89879bea commit 447273e0bf22a3d42e05e6b16d309f3f89879bea Author: Pavel Kozlov Date: Thu Mar 2 20:10:19 2023 +0400 ARC: run child from the separate start block in __clone For better debug experience use separate code block with extra cfi_* directives to run child (same as in __clone3). Reviewed-by: Adhemerval Zanella Diff: --- 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 7666496256..0029aaeb81 100644 --- a/sysdeps/unix/sysv/linux/arc/clone.S +++ b/sysdeps/unix/sysv/linux/arc/clone.S @@ -20,9 +20,6 @@ #include #define _ERRNO_H 1 #include -#include - -#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)