use hidden __tls_get_new for tls/tlsdesc lookup fallback cases
[musl] / src / thread / i386 / clone.s
1 .text
2 .global __clone
3 .type   __clone,@function
4 __clone:
5         push %ebp
6         mov %esp,%ebp
7         push %ebx
8         push %esi
9         push %edi
10
11         xor %eax,%eax
12         push $0x51
13         mov %gs,%ax
14         push $0xfffff
15         shr $3,%eax
16         push 28(%ebp)
17         push %eax
18         mov $120,%al
19
20         mov 12(%ebp),%ecx
21         mov 16(%ebp),%ebx
22         and $-16,%ecx
23         sub $16,%ecx
24         mov 20(%ebp),%edi
25         mov %edi,(%ecx)
26         mov 24(%ebp),%edx
27         mov %esp,%esi
28         mov 32(%ebp),%edi
29         mov 8(%ebp),%ebp
30         int $128
31         test %eax,%eax
32         jnz 1f
33
34         mov %ebp,%eax
35         xor %ebp,%ebp
36         call *%eax
37         mov %eax,%ebx
38         xor %eax,%eax
39         inc %eax
40         int $128
41         hlt
42
43 1:      add $16,%esp
44         pop %edi
45         pop %esi
46         pop %ebx
47         pop %ebp
48         ret