From patchwork Sun May 25 19:41:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 22F7214009E for ; Mon, 26 May 2014 05:44:01 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=CQc7NaN//AgoTuwt35aeehjw/AeRz5d zUCfNmwfjjHZsf7OfojfKk16nO6C1RbOBu5ds1NCtJKxdtL3QXLsEtv0QkHM/4ze YRLtfnCr5FjeftOJnMYRkVRLS5ZhoAde5tMNAlx6MEQJg6wueSk8BaYuYiEmDaEN saFaUtloOKHM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=IkHUE44LSfdb0m3EywFAK/honnI=; b=ffBtl qUeBZAFNaW5cfCuj0RpTigaUwXi9pc/hiCixQ4sqnTalYgS35E+RYvn9iGlXPlsJ wr1cbnAEp2qg/KjDgJp40+8925FCAXp1u3a0KhtiOg60zqrzKbqk3NHBD8s4Hy3H QGUlxusElCuHonhUER1BF9QyBHPMZJRCmZhU3A= Received: (qmail 2899 invoked by alias); 25 May 2014 19:42:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 2718 invoked by uid 89); 25 May 2014 19:42:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_50, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qc0-f173.google.com X-Received: by 10.140.47.18 with SMTP id l18mr25670995qga.9.1401046934850; Sun, 25 May 2014 12:42:14 -0700 (PDT) From: Richard Henderson To: libc-alpha@sourceware.org Cc: marcus.shawcroft@gmail.com, Richard Henderson Subject: [PATCH v3 8/9] aarch64: Consolidate NPTL/non versions of clone Date: Sun, 25 May 2014 12:41:48 -0700 Message-Id: <1401046909-25821-9-git-send-email-rth@twiddle.net> In-Reply-To: <1401046909-25821-1-git-send-email-rth@twiddle.net> References: <1401046909-25821-1-git-send-email-rth@twiddle.net> From: Richard Henderson At the same time, rely on non-clobbered registers across syscall so that we eliminate the stack frame that we previously ignored in the unwind info. --- sysdeps/unix/sysv/linux/aarch64/clone.S | 56 ++++++++++++---------------- sysdeps/unix/sysv/linux/aarch64/nptl/clone.S | 21 ----------- 2 files changed, 24 insertions(+), 53 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/aarch64/nptl/clone.S diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S index f2964f4..a2b5a2b 100644 --- a/sysdeps/unix/sysv/linux/aarch64/clone.S +++ b/sysdeps/unix/sysv/linux/aarch64/clone.S @@ -39,47 +39,42 @@ */ .text ENTRY(__clone) + /* Save args for the child. */ + mov x10, x0 + mov x11, x2 + mov x12, x3 + /* Sanity check args. */ - cbz x0, 1f - cbz x1, 1f - /* Insert the args onto the new stack. */ - stp x0, x3, [x1, #-16]! /* Fn, arg. */ + mov x0, #-EINVAL + cbz x10, .Lsyscall_error + cbz x1, .Lsyscall_error /* Do the system call. */ + /* X0:flags, x1:newsp, x2:parenttidptr, x3:newtls, x4:childtid. */ mov x0, x2 /* flags */ - /* New sp is already in x1. */ mov x2, x4 /* ptid */ mov x3, x5 /* tls */ mov x4, x6 /* ctid */ - -#ifdef RESET_PID - /* We rely on the kernel preserving the argument regsiters across a - each system call so that we can inspect the flags against after - the clone call. */ - mov x5, x0 -#endif - mov x8, #SYS_ify(clone) - /* X0:flags, x1:newsp, x2:parenttidptr, x3:newtls, x4:childtid. */ svc 0x0 - cfi_endproc + cmp x0, #0 - beq 2f - blt 3f + beq thread_start + blt .Lsyscall_error RET -1: mov x0, #-EINVAL -3: - b syscall_error +PSEUDO_END (__clone) -2: + .align 4 + .type thread_start, %function +thread_start: cfi_startproc cfi_undefined (x30) mov x29, 0 -#ifdef RESET_PID - tbnz x5, #CLONE_THREAD_BIT, 3f + + tbnz x11, #CLONE_THREAD_BIT, 3f mov x0, #-1 - tbnz x5, #CLONE_VM_BIT, 2f + tbnz x11, #CLONE_VM_BIT, 2f mov x8, #SYS_ify(getpid) svc 0x0 2: @@ -87,18 +82,15 @@ ENTRY(__clone) sub x1, x1, #PTHREAD_SIZEOF str w0, [x1, #PTHREAD_PID_OFFSET] str w0, [x1, #PTHREAD_TID_OFFSET] - 3: -#endif - /* Pick the function arg and call address from the stack and - execute. */ - ldp x1, x0, [sp], #16 - blr x1 + + /* Pick the function arg and execute. */ + mov x0, x12 + blr x10 /* We are done, pass the return value through x0. */ b HIDDEN_JUMPTARGET(_exit) cfi_endproc - cfi_startproc -PSEUDO_END (__clone) + .size thread_start, .-thread_start weak_alias (__clone, clone) diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/clone.S b/sysdeps/unix/sysv/linux/aarch64/nptl/clone.S deleted file mode 100644 index 281be3b..0000000 --- a/sysdeps/unix/sysv/linux/aarch64/nptl/clone.S +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (C) 2009-2014 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define RESET_PID -#include -#include "../clone.S"