diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-12-21 08:35:58 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-12-21 08:35:58 +0000 |
commit | 05d9958f685e3f0c51be4f1128348645451e51fb (patch) | |
tree | b28c486ae60ad9065ba6d061b494c253fdc73ef5 /libc/sysdeps/linux/bfin/clone.c | |
parent | f6cc7543c5530106123f1fa7958d1c594ddff3d8 (diff) |
Add support for the Analog Devices Blackfin mmuless processor
Diffstat (limited to 'libc/sysdeps/linux/bfin/clone.c')
-rw-r--r-- | libc/sysdeps/linux/bfin/clone.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/bfin/clone.c b/libc/sysdeps/linux/bfin/clone.c new file mode 100644 index 000000000..746da8e22 --- /dev/null +++ b/libc/sysdeps/linux/bfin/clone.c @@ -0,0 +1,39 @@ +/* + * libc/sysdeps/linux/bfin/clone.c -- `clone' syscall for linux/blackfin + * + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License. See the file COPYING.LIB in the main + * directory of this archive for more details. + * + */ + +#include <asm/unistd.h> + +int +clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg) +{ + register long rval = -1; + + if (fn && child_stack) { + + __asm__ __volatile__ ( + "r1 = %2;" + "r0 = %3;" + "P0 = %1;" + "excpt 0;" /*Call sys_clone*/ + "%0 = r0;" + "cc = r0 == 0;" + "if !cc jump xxx;" /* if (rval != 0) skip to parent */ + "r0 = %4;" + "p0 = %5;" + "call (p0);" /* Call cloned function */ + "p0 = %6;" + "excpt 0;" /* Call sys_exit */ + "xxx: nop;" + : "=d" (rval) + : "i" (__NR_clone), "a" (child_stack), "a" (flags), "a" (arg), "a" (fn), "i" (__NR_exit) + : "CC", "R0", "R1", "P0"); + } + return rval; +} |