add tlsdesc support for i386
[oweals/musl.git] / src / ldso / i386 / tlsdesc.s
1 .text
2 .global __tlsdesc_static
3 .type __tlsdesc_static,@function
4 __tlsdesc_static:
5         mov 4(%eax),%eax
6         ret
7
8 .global __tlsdesc_dynamic
9 .type __tlsdesc_dynamic,@function
10 __tlsdesc_dynamic:
11         mov 4(%eax),%eax
12         push %edx
13         mov %gs:4,%edx
14         push %ecx
15         mov (%eax),%ecx
16         cmp %ecx,(%edx)
17         jc 1f
18         mov 4(%eax),%eax
19         add (%edx,%ecx,4),%eax
20 2:      pop %ecx
21         sub %gs:0,%eax
22         pop %edx
23         ret
24 1:      push %eax
25         call __tls_get_addr
26         pop %ecx
27         jmp 2b