4 .type __clone, %function
6 # int clone(fn, stack, flags, arg, ptid, tls, ctid)
10 # tid = syscall(SYS_clone,c,b,e,f,g);
11 # if (!tid) syscall(SYS_exit, a(d));
17 # store non-volatile regs r30, r31 on stack in order to put our
18 # start func and its arg there
22 # save r3 (func) into r30, and r6(arg) into r31
26 # create initial stack frame for new thread
31 #move c into first arg
38 # move syscall number into r0
43 # check for syscall error
44 bns+ 1f # jump to label 1 if no summary overflow.
46 neg 3, 3 #negate the result (errno)
48 # compare sc result with 0
51 # if not 0, jump to end
54 #else: we're the child
55 #call funcptr: move arg (d) into r3
57 #move r30 (funcptr) into CTR reg
61 # mov SYS_exit into r0 (the exit param is already in r3)