From patchwork Thu Mar 2 16:10:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Kozlov X-Patchwork-Id: 65909 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3E70E385E839 for ; Thu, 2 Mar 2023 16:12:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E70E385E839 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677773566; bh=Vg249BbTkvNkrtiiv3LWdoFEvaTjamFxVm9+45KaJvc=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=KJ87GV9XwweTqmc22BvDefwF7ynUBqAjrhefl/3/EtattJviAg2T/M4QfZqbZ3ob0 e2xk54mYgg3hb2nMxeaM27U2VoJoDrkgvu2ukcJKOtpBtUNEUKtDEKN9IvftHDHbIN Mqaf4oxYOMJy7mGpjc+MzxRfpS+UPMAFYN22yqLI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-00230701.pphosted.com (mx0a-00230701.pphosted.com [148.163.156.19]) by sourceware.org (Postfix) with ESMTPS id 9D76E38582BD for ; Thu, 2 Mar 2023 16:12:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D76E38582BD Received: from pps.filterd (m0297266.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 322G51Lb010064; Thu, 2 Mar 2023 08:12:20 -0800 Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 3nyjfdwbnq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Mar 2023 08:12:20 -0800 Received: from mailhost.synopsys.com (sv1-mailhost2.synopsys.com [10.205.2.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id D279DC00AF; Thu, 2 Mar 2023 16:12:17 +0000 (UTC) Received: from SNPS-o0WHuHJU73.internal.synopsys.com (snps-o0whuhju73.internal.synopsys.com [10.116.105.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client did not present a certificate) by mailhost.synopsys.com (Postfix) with ESMTPSA id E173AA006D; Thu, 2 Mar 2023 16:12:16 +0000 (UTC) X-SNPS-Relay: synopsys.com To: libc-alpha@sourceware.org Cc: linux-snps-arc@lists.infradead.org, Pavel Kozlov Subject: [PATCH 2/2] ARC: run child from the separate start block in __clone Date: Thu, 2 Mar 2023 20:10:19 +0400 Message-Id: <20230302161019.27192-2-kozlov@synopsys.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230302161019.27192-1-kozlov@synopsys.com> References: <20230302161019.27192-1-kozlov@synopsys.com> MIME-Version: 1.0 X-Proofpoint-GUID: YlCzq_bxQPRvZ3PwhbDVJxRjvxzMUMw8 X-Proofpoint-ORIG-GUID: YlCzq_bxQPRvZ3PwhbDVJxRjvxzMUMw8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-02_09,2023-03-02_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 lowpriorityscore=0 phishscore=0 suspectscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 malwarescore=0 adultscore=0 mlxlogscore=944 impostorscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303020140 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pavel Kozlov via Libc-alpha From: Pavel Kozlov Reply-To: Pavel.Kozlov@synopsys.com Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" From: Pavel Kozlov For better debug experience use separate code block with extra cfi_* directives to run child (same as in __clone3). Reviewed-by: Adhemerval Zanella --- 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 #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)