1 /* The clone3 syscall wrapper. Linux/s390x version.
2 Copyright (C) 2023 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
22 #include <bits/errno.h>
24 /* The userland implementation is:
25 int clone3 (struct clone_args *cl_args, size_t size,
26 int (*func)(void *arg), void *arg);
29 int clone3 (struct clone_args *cl_args, size_t size);
31 The parameters are passed in registers from userland:
39 /* Sanity check args. */
45 /* Do the system call, the kernel expects:
46 r1: system call number
49 lghi %r1, SYS_ify(clone3)
51 ltgr %r2,%r2 /* check return code */
53 jgm SYSCALL_ERROR_LABEL
57 jg SYSCALL_ERROR_LABEL
61 .type thread_start, %function
64 /* Mark r14 as undefined in order to stop unwinding here. */
67 /* func is in gpr 4, arg in gpr 5. */
75 ASM_SIZE_DIRECTIVE (thread_start)
77 libc_hidden_def (__clone3)
78 weak_alias (__clone3, clone3)