blob: 3b50cc3d34a107b01ea60602f3a7faf9fd98e76d [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001#include <sys/linux-syscalls.h>
2
3.text
4
5/*
6 * int __pthread_clone(int (*fn)(void*), void *tls, int flags,
7 * void *arg);
8 */
9.globl __pthread_clone
10.type __pthread_clone, @function
11.align 4
12__pthread_clone:
13 pushl %ebx
14 pushl %ecx
15 movl 16(%esp), %ecx
16 movl 20(%esp), %ebx
17
18 # insert arguments onto the child stack
19 movl 12(%esp), %eax
20 movl %eax, -12(%ecx)
21 movl 24(%esp), %eax
22 movl %eax, -8(%ecx)
23 lea (%ecx), %eax
24 movl %eax, -4(%ecx)
25
26 movl $__NR_clone, %eax
27 int $0x80
28 test %eax, %eax
29 jns 1f
30
31 # an error occured, set errno and return -1
32 negl %eax
33 call __set_errno
34 orl $-1, %eax
35 jmp 2f
36
371:
38 jnz 2f
39
40 # we're in the child thread now, call __thread_entry
41 # with the appropriate arguments on the child stack
42 # we already placed most of them
43 subl $16, %esp
44 jmp __thread_entry
45 hlt
46
472:
48 popl %ecx
49 popl %ebx
50 ret
David 'Digit' Turner97cf7f32010-01-22 18:59:05 -080051
52/* XXX: TODO: Add __bionic_clone here
53 * See bionic/bionic_clone.c and arch-arm/bionic/clone.S
54 * for more details...
55 */