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