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 Netto X-Patchwork-Id: 132494 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp115685ljb; Tue, 27 Mar 2018 17:37:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx49OVLtocUoewima7N/1oSJqttGQr39wPnZEdt4fLLgLjbfHS9Dy0Tr/Np43wRtpZDxgYz8I X-Received: by 10.98.229.21 with SMTP id n21mr1132199pff.158.1522197433608; Tue, 27 Mar 2018 17:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522197433; cv=none; d=google.com; s=arc-20160816; b=dBX0TU0zchRO9gcDAJNMFZTeOmrd4KlUYxVGHngF9ciqyR0BsM3gXdcF7wJ+DZON2l wEXzvebTKAtgReSOAJ4MFup3hJ0MbvsISb7DaOCRKkv3UK3qFltnwUTwkcJ4mSF0UAhV NQdvIGYH7Wb8/CmhtD3/r8l3R6GuIEzq5nDM3t9PZHj0vKQOrPJLKC0ruyltNEgVWM8v qyuo12M8bzrfvectF+dopJjL7rpjIREykIDBhEo1KQB4000BH5W6YqV8UVc0Q2fE1Rv7 BqZgIH/z5f3P43AWbd456uc4mHC73MGsYu3lgdfvoLCbYX3SgVREYsLYa0e3wQk2Lzt2 zfxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:delivered-to:sender:list-help :list-post:list-archive:list-subscribe:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=Ln5vS/xrH6PAW93gRDXcLrk4nVGBjZ9ur631aFZwxGE=; b=C5EbWrEEJDXGRSVU5f05ZAnL8EC6tyXQnPl/NdO4HwkCF0NMez/zcJCoiQAVWQW31A /d8ww7e3XLrrbewxwceYbJ6qiuXBkpM+TNctOkczgMpakMxCIiFVXtLepwArOBKbDcQA 1PAP0TuZ0wGwmyUX6+kHlylLqxY1uxYX6i6Bg/xtwXBY44Ogmv+ffLTT4Ca+VeFcHIKJ FHPRKZnLpfzLVF3qN2kaOs++sA8Ui8OI36bUr1fJjqVnvtZ66qC4bnDEO+SHc60KD9Rn KmRlSTwBr9thmWbaTfjMPiRXT1Dej1HjoG6qiWpFl0VLWbWEhSjndAv/Yrakqo/7dDX2 4shw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=j6//LUMd; spf=pass (google.com: domain of libc-alpha-return-91271-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91271-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id d126si1625436pgc.385.2018.03.27.17.37.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Mar 2018 17:37:13 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91271-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=j6//LUMd; spf=pass (google.com: domain of libc-alpha-return-91271-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91271-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=NFJ9HagVLMnwfevVquj0DvMrtlGzR93GFLLSv0acwttZi+y6oRcb6 QMOulnqrvV9BZpgzjot0VATtK9lhfv4pA3nh+WFgteLIHoTaJYN5qEA9ndJpu9KC VQstrqqsJ6Tuf7c2lPPF7KiXoOuahSla63x0se235GHc5NYdlVTbWU= 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=j6//LUMd6DhKThJQleDmQxwRqOmP 02rlMWr3cD55jzuNvRrPs4enB6dVPmB0FLpCTF6VVqZv/9JV3eM9qJzFfDaRlhW2 IxeARQvy3et9m6DXK8G3V9FsV0nPkwOfUG6a6MPO3gtkAtaoCHYto4/9+GEB4yyv HYh2tlYNfveRpJk= 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-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(+) -- 2.14.1 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