1 /* Adapted from glibc */
2 /* Copyright (C) 1996, 1997 Free Software Foundation, Inc. */
4 /* clone is even more special than fork as it mucks with stacks
5 and invokes a function in the right context after its all over. */
8 #include <bits/errno.h>
9 #include <sys/syscall.h>
11 /* int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
23 /* Sanity check arguments. */
25 mov.l er0,er0 /* no NULL function pointers */
27 mov.l er1,er1 /* no NULL stack pointers */
30 /* Allocate space and copy the argument onto the new stack. */
34 /* Do the system call */
35 mov.l er0,er3 /* er3 = child entry */
37 mov.l er2,er1 /* er1 = flags */
38 mov.l er0,er2 /* er2 = child sp */
53 mov.l @(__errno_location@GOTOFF,er5),er1
64 mov.l @sp+,er0 /* restore args */