Rev 4872 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 1 | |
2 | |||
3 | .global _tls_alloc |
||
4 | |||
5 | |||
6 | .align 4 |
||
7 | |||
8 | |||
9 | pushl $tls_mutex |
||
10 | |||
11 | popl %eax |
||
12 | |||
13 | movl tls_map_start, %edx |
||
14 | |||
15 | .test: |
||
16 | bsfl (%edx), %eax |
||
17 | jnz .done |
||
18 | |||
19 | add $4, %edx |
||
20 | |||
21 | jb .test |
||
22 | |||
23 | xorl %eax, %eax |
||
24 | |||
25 | ret |
||
26 | |||
27 | .done: |
||
28 | |||
29 | movl %edx, tls_map_start |
||
30 | movl $0, tls_mutex |
||
31 | |||
32 | subl $__tls_map, %edx |
||
33 | |||
34 | shll $2, %eax |
||
35 | ret |
||
36 | |||
37 | .section .data |
||
38 | |||
39 | tls_mutex: .long(0) |
||
40 | |||
41 | |||
42 | .section .bss |
||
43 | |||
44 | .align 16 |
||
45 | |||
46 | __tls_map: .space 128 |
||
47 |