1 /* Copyright 2011 Nicholas J. Kain, licensed GNU LGPL 2.1 or later */
4 .type __uniclone,%function
5 /* rdi = child_stack, rsi = start, rdx = pthread_struct */
7 subq $16,%rdi /* grow child_stack */
8 mov %rsi,8(%rdi) /* push start onto child_stack as return ptr */
9 mov %rdx,0(%rdi) /* push pthread_struct onto child_stack */
10 mov %rdx,%r8 /* r8 = tls */
11 mov %rdi,%rsi /* rsi = child_stack */
12 leaq 40(%rdx),%r10 /* r10 = child_id */
13 movl $56,%eax /* clone syscall number */
14 movl $0x7d0f00,%edi /* rdi = flags */
15 mov %r10,%rdx /* rdx = parent_id */
16 syscall /* clone(flags, child_stack, parent_id,
19 jnz 1f /* if we're in the parent -> goto 1f */
20 pop %rdi /* restore pthread_struct from child stack */
22 .size __uniclone,.-__uniclone