From patchwork Sat Feb 20 16:04:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 42124 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 4254B3894C36; Sat, 20 Feb 2021 16:04:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4254B3894C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1613837054; bh=tbmMVxojwf8K8v98V0v8Q+Vng/XWPheAirWU7/0b/aI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=VfgJiH9opSUi/OLGESaiRKa87SnPTOYtLs40neVmjc68JrZ02SC6ksd4vlRuVtcXR 569jqgks9kEYqHW0cQDvyGVG0Fx5QGa3ojjbSduCERW2PJOHQ/CYutX//s2MXGR+Bt +j2i6jryi+4m1GzROadWAnLGBdjwS4w6VczTl0qs= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 6DC9F3894436 for ; Sat, 20 Feb 2021 16:04:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6DC9F3894436 Received: by mail-pj1-x102b.google.com with SMTP id t2so6043666pjq.2 for ; Sat, 20 Feb 2021 08:04:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=tbmMVxojwf8K8v98V0v8Q+Vng/XWPheAirWU7/0b/aI=; b=GQxlsW77JquyP4xG/abot1WTcQ9W+DTNrLOFLc73siwRQVTupCCBSjcAFRGPikT4Kk gddVnq8i8ls3tQTDSYIxchqS1/HUVuFOybyGCqqFI+QByoAXL7yhhgDJT3Ic5rR4Dd6U 1Ir8Y19nN0MNA3M002xQAi4AEzHXQiVfu/U+2ADX4UYselK8TctIWCnz6a/QiAuHghca r2Z4x3vYPwrTKOH2OfvUDU9AS884+HTenHQwBisTuBFV8Lm1ta4ejicKzdajmS1ooyRz 37PhXb7xDr2LTRQ2eolSR/4LusO1+DQtF8TexJdpXznwUXl0QYVWtKVPqUHmVOGBO96g yVOg== X-Gm-Message-State: AOAM533jgZAoFSeOsvQ/+Rw7M1+VDiUb5YPiStI99CM+IDrpnvMMLJfF 7JWvGYF677CGWTviBBkh69uY0PTsUEo= X-Google-Smtp-Source: ABdhPJyeC4Wjvh3gr3flBrB/9wjrvzOXFJJ3vwnaWYqkKVo8sJBr5cAamtqf2Xd+sPcq8aXOAQohxg== X-Received: by 2002:a17:90a:1d44:: with SMTP id u4mr15095601pju.88.1613837050349; Sat, 20 Feb 2021 08:04:10 -0800 (PST) Received: from gnu-cfl-2.localdomain (c-69-181-90-243.hsd1.ca.comcast.net. [69.181.90.243]) by smtp.gmail.com with ESMTPSA id b17sm12766784pfb.75.2021.02.20.08.04.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Feb 2021 08:04:09 -0800 (PST) Received: from gnu-cfl-2.localdomain (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id 067C01A0156 for ; Sat, 20 Feb 2021 08:04:09 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH] x86_64/clone.S: Upate comments Date: Sat, 20 Feb 2021 08:04:06 -0800 Message-Id: <20210220160406.318856-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-Spam-Status: No, score=-3038.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" --- sysdeps/unix/sysv/linux/x86_64/clone.S | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S index 51638d897b..31ac12da0c 100644 --- a/sysdeps/unix/sysv/linux/x86_64/clone.S +++ b/sysdeps/unix/sysv/linux/x86_64/clone.S @@ -24,18 +24,20 @@ #include /* The userland implementation is: - int clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg), + int clone (int (*fn)(void *arg), void *child_stack, int flags, + void *arg, pid_t *parent_tid, void *tls, pid_t *child_tid); the kernel entry is: - int clone (long flags, void *child_stack). + int clone (long flags, void *child_stack, pid_t *parent_tid, + pid_t *child_tid, void *tls); The parameters are passed in register and on the stack from userland: rdi: fn rsi: child_stack rdx: flags rcx: arg - r8d: TID field in parent - r9d: thread pointer -%esp+8: TID field in child + r8: TID field in parent + r9: thread pointer +%rsp+8: TID field in child The kernel expects: rax: system call number @@ -60,7 +62,7 @@ ENTRY (__clone) movq %rcx,8(%rsi) /* Save the function pointer. It will be popped off in the - child in the ebx frobbing below. */ + child. */ movq %rdi,0(%rsi) /* Do the system call. */