1 /* Copyright (C) 2001, 2003 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 see <http://www.gnu.org/licenses/>. */
19 #include <sys/syscall.h>
22 #include <bits/errno.h>
24 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
26 .syntax no_register_prefix
30 /* Sanity check arguments: No NULL function pointers. Allow a NULL
31 stack pointer though; it makes the kernel allocate stack. */
36 /* We need to muck with a few registers. */
40 /* Save the function pointer and argument. We can't save them
41 onto the new stack since it can be NULL. */
45 /* Move the other arguments into place for the system call. */
49 /* Do the system call. */
50 movu.w SYS_ify (clone),r9
56 /* Jump to error handler if we get (unsigned) -4096 .. 0xffffffff. */
61 /* In parent, successful return. (Avoid using "ret" - it's a macro.) */
66 /* Terminate frame pointers here. */
70 /* Is this the right place for an argument? */
74 /* I've told you once. */
80 PLTCALL (HIDDEN_JUMPTARGET(_exit))
86 /* Stop the unstoppable. */
91 /* Local error handler. */
94 /* Drop through into the ordinary error handler. */