1 /* Wrapper around clone system call.
2 Copyright (C) 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
22 #include <bits/errno.h>
24 /* This is the only really unusual system call in PPC linux, but not
25 because of any weirdness in the system call itself; because of
26 all the freaky stuff we have to do to make the call useful. */
28 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
31 /* Set up stack frame, save registers. */
33 /* Check for child_stack == NULL || fn == NULL. */
41 /* Set up stack frame for child. */
47 /* Save fn, args across syscall. */
48 mr %r30,%r3 /* Function in r30. */
49 mr %r31,%r6 /* Arguments in r31. */
51 /* 'flags' argument is first parameter to clone syscall. (The other
52 argument is the stack pointer, already in r4.) */
56 DO_CALL(SYS_ify(clone))
60 /* Parent. Restore registers & return. */
71 /* Call _exit with result from procedure. */
80 b JUMPTARGET(__syscall_error)
83 weak_alias (__clone, clone)