2 * libc/sysdeps/linux/bfin/clone.c -- `clone' syscall for linux/blackfin
4 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
6 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
11 #include <sys/syscall.h>
14 clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...)
18 if (fn && child_stack) {
20 __asm__ __volatile__ (
21 "excpt 0;" /* Call sys_clone */
23 "if !cc jump 1f;" /* if (rval != 0) skip to parent */
30 "call (p1);" /* Call cloned function */
32 "call (p0);" /* Call cloned function */
35 "excpt 0;" /* Call sys_exit */
38 : "qA" (__NR_clone), "q1" (child_stack), "q0" (flags), "a" (arg), "a" (fn), "i" (__NR_exit)