From patchwork Wed Mar 28 00:36:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 891891 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-91271-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="sENMk7wS"; dkim-atps=neutral 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 409pqW0Z2Sz9s02 for ; Wed, 28 Mar 2018 11:37:10 +1100 (AEDT) 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; q=dns; s= default; b=TNmD0VWUm174tc+IZmf/+Kh/zb+YYpKktOFjz1Fr4STFNHPsyYkyk GGmLX7mVR0QzYiCdhoB09Zn+qZx80O8ofSkcNuTQ9PHNPc6fLMxQSDp8wPPK3mIi YlumqgkmQBnMaXwtzePNGr90tS4Q31032Ihlu7kFY7PxwWOKiYWiss= 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; s=default; bh=kofpEqTyEdTH7bs3x7is2/TY5zc=; b=sENMk7wSQVvpMWOiKyxiPkuQ4+wi CLXxf7SrZUDNFNGDulmsMQ4XHCdOh8dYxbZz/qtB4IC5v2ZgKisUD7tIREjGGADn RlZqPXa+h2unZwYOJohuNzxy+d2a8mXgk8UTQ6V3ggaeNuNjoJeVR3MGmmpxlJr3 RAbruCzgLx9smmU= Received: (qmail 62047 invoked by alias); 28 Mar 2018 00:37:04 -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 61721 invoked by uid 89); 28 Mar 2018 00:37:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=parents, H*p:D*org, ipc, sk:sparc64 X-HELO: mail-qk0-f196.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ln5vS/xrH6PAW93gRDXcLrk4nVGBjZ9ur631aFZwxGE=; b=LcTBZMuKUNDjN9oOOuJuYrQIMXNsycz93lYbzNsmj5qlFdohow6+upMwPOXvQCQ3Yl 7wo8lTLma4xmVaiig/az6ugiJfc5UO78oEIAfZC/SIC9Iim+JUuEsYPeHr5MUfBcIQBE Hqao+X5thZNkY/vOXxr/SiEhnZymP4cdlUq4+WC5sXebf5RSm36A15VwGQpEgTGqgqcK S+sZSxGLs2KPYn5bZ7hvzuKtin/fKQZp82S6F4zXB3vDSSSmzKCMSPL6hHu1D9VZUecf 4kbgwzHFivIIh8noSeGWnbH25SEG31eidQvkh1sQMh/IrtRqsN8+4GPtPcK9kUVqFInH smfA== X-Gm-Message-State: AElRT7FENEADSBd5oX2HdQkuxGKySlw7roeaT3bjqDyOxWvy3B3p4nKK IuLvc5qgiaobwZ/0rHr5Rne3GehWYnc= X-Google-Smtp-Source: AIpwx4+KS5EdtA8qyfcazbueShhgV4g4kYi/UZeMQo+x1WeivbTJuqKkwxnK7hn54jhjJmhVFJvIxQ== X-Received: by 10.55.198.153 with SMTP id s25mr2185003qkl.221.1522197420789; Tue, 27 Mar 2018 17:37:00 -0700 (PDT) From: adhemerval.zanella@linaro.org To: libc-alpha@sourceware.org Cc: Adhemerval Zanella Subject: [COMMITTED] sparc: Fix arch_fork definition Date: Tue, 27 Mar 2018 21:36:53 -0300 Message-Id: <20180328003653.15247-1-adhemerval.zanella@linaro.org> From: Adhemerval Zanella This patch fixes 3dc214977 for sparc. Different than other architectures SPARC kernel Kconfig does not define CONFIG_CLONE_BACKWARDS, however it has the same ABI as if it did, implemented by sparc-specific code (sparc_do_fork). It also has a unique return value convention for clone: Parent --> %o0 == child's pid, %o1 == 0 Child --> %o0 == parent's pid, %o1 == 1 Which required a special macro to correct issue the syscall (INLINE_CLONE_SYSCALL). Checked on sparc64-linux-gnu and sparcv9-linux-gnu. * sysdeps/unix/sysv/linux/arch-fork.h [__ASSUME_CLONE_BACKWARDS] (arch_fork): Issue INLINE_CLONE_SYSCALL if defined. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_CLONE_BACKWARDS): Define. --- ChangeLog | 7 +++++++ sysdeps/unix/sysv/linux/arch-fork.h | 4 ++++ sysdeps/unix/sysv/linux/sparc/kernel-features.h | 14 ++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/sysdeps/unix/sysv/linux/arch-fork.h b/sysdeps/unix/sysv/linux/arch-fork.h index 3daa9651e5..046d9fc60d 100644 --- a/sysdeps/unix/sysv/linux/arch-fork.h +++ b/sysdeps/unix/sysv/linux/arch-fork.h @@ -34,7 +34,11 @@ arch_fork (void *ctid) const int flags = CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD; long int ret; #ifdef __ASSUME_CLONE_BACKWARDS +# ifdef INLINE_CLONE_SYSCALL + ret = INLINE_CLONE_SYSCALL (flags, 0, NULL, 0, ctid); +# else ret = INLINE_SYSCALL_CALL (clone, flags, 0, NULL, 0, ctid); +# endif #elif defined(__ASSUME_CLONE_BACKWARDS2) ret = INLINE_SYSCALL_CALL (clone, 0, flags, NULL, ctid, 0); #elif defined(__ASSUME_CLONE_BACKWARDS3) diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h index 2fd12cb7ce..64d714036e 100644 --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h @@ -40,3 +40,17 @@ /* sparc only supports ipc syscall. */ #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS + +/* SPARC kernel Kconfig does not define CONFIG_CLONE_BACKWARDS, however it + has the same ABI as if it did, implemented by sparc-specific code + (sparc_do_fork). + + It also has a unique return value convention: + + Parent --> %o0 == child's pid, %o1 == 0 + Child --> %o0 == parent's pid, %o1 == 1 + + Which required a special macro to correct issue the syscall + (INLINE_CLONE_SYSCALL). */ +#undef __ASSUME_CLONE_DEFAULT +#define __ASSUME_CLONE_BACKWARDS 1