1.section .text
2
3.hidden __tsan_trace_switch
4.globl __tsan_trace_switch_thunk
5__tsan_trace_switch_thunk:
6  .cfi_startproc
7  # Save scratch registers.
8  push %rax
9  .cfi_adjust_cfa_offset 8
10  .cfi_rel_offset %rax, 0
11  push %rcx
12  .cfi_adjust_cfa_offset 8
13  .cfi_rel_offset %rcx, 0
14  push %rdx
15  .cfi_adjust_cfa_offset 8
16  .cfi_rel_offset %rdx, 0
17  push %rsi
18  .cfi_adjust_cfa_offset 8
19  .cfi_rel_offset %rsi, 0
20  push %rdi
21  .cfi_adjust_cfa_offset 8
22  .cfi_rel_offset %rdi, 0
23  push %r8
24  .cfi_adjust_cfa_offset 8
25  .cfi_rel_offset %r8, 0
26  push %r9
27  .cfi_adjust_cfa_offset 8
28  .cfi_rel_offset %r9, 0
29  push %r10
30  .cfi_adjust_cfa_offset 8
31  .cfi_rel_offset %r10, 0
32  push %r11
33  .cfi_adjust_cfa_offset 8
34  .cfi_rel_offset %r11, 0
35  # Align stack frame.
36  push %rbx  # non-scratch
37  .cfi_adjust_cfa_offset 8
38  .cfi_rel_offset %rbx, 0
39  mov %rsp, %rbx  # save current rsp
40  .cfi_def_cfa_register %rbx
41  shr $4, %rsp  # clear 4 lsb, align to 16
42  shl $4, %rsp
43
44  call __tsan_trace_switch
45
46  # Unalign stack frame back.
47  mov %rbx, %rsp  # restore the original rsp
48  .cfi_def_cfa_register %rsp
49  pop %rbx
50  .cfi_adjust_cfa_offset -8
51  # Restore scratch registers.
52  pop %r11
53  .cfi_adjust_cfa_offset -8
54  pop %r10
55  .cfi_adjust_cfa_offset -8
56  pop %r9
57  .cfi_adjust_cfa_offset -8
58  pop %r8
59  .cfi_adjust_cfa_offset -8
60  pop %rdi
61  .cfi_adjust_cfa_offset -8
62  pop %rsi
63  .cfi_adjust_cfa_offset -8
64  pop %rdx
65  .cfi_adjust_cfa_offset -8
66  pop %rcx
67  .cfi_adjust_cfa_offset -8
68  pop %rax
69  .cfi_adjust_cfa_offset -8
70  .cfi_restore %rax
71  .cfi_restore %rbx
72  .cfi_restore %rcx
73  .cfi_restore %rdx
74  .cfi_restore %rsi
75  .cfi_restore %rdi
76  .cfi_restore %r8
77  .cfi_restore %r9
78  .cfi_restore %r10
79  .cfi_restore %r11
80  ret
81  .cfi_endproc
82
83.hidden __tsan_report_race
84.globl __tsan_report_race_thunk
85__tsan_report_race_thunk:
86  .cfi_startproc
87  # Save scratch registers.
88  push %rax
89  .cfi_adjust_cfa_offset 8
90  .cfi_rel_offset %rax, 0
91  push %rcx
92  .cfi_adjust_cfa_offset 8
93  .cfi_rel_offset %rcx, 0
94  push %rdx
95  .cfi_adjust_cfa_offset 8
96  .cfi_rel_offset %rdx, 0
97  push %rsi
98  .cfi_adjust_cfa_offset 8
99  .cfi_rel_offset %rsi, 0
100  push %rdi
101  .cfi_adjust_cfa_offset 8
102  .cfi_rel_offset %rdi, 0
103  push %r8
104  .cfi_adjust_cfa_offset 8
105  .cfi_rel_offset %r8, 0
106  push %r9
107  .cfi_adjust_cfa_offset 8
108  .cfi_rel_offset %r9, 0
109  push %r10
110  .cfi_adjust_cfa_offset 8
111  .cfi_rel_offset %r10, 0
112  push %r11
113  .cfi_adjust_cfa_offset 8
114  .cfi_rel_offset %r11, 0
115  # Align stack frame.
116  push %rbx  # non-scratch
117  .cfi_adjust_cfa_offset 8
118  .cfi_rel_offset %rbx, 0
119  mov %rsp, %rbx  # save current rsp
120  .cfi_def_cfa_register %rbx
121  shr $4, %rsp  # clear 4 lsb, align to 16
122  shl $4, %rsp
123
124  call __tsan_report_race
125
126  # Unalign stack frame back.
127  mov %rbx, %rsp  # restore the original rsp
128  .cfi_def_cfa_register %rsp
129  pop %rbx
130  .cfi_adjust_cfa_offset -8
131  # Restore scratch registers.
132  pop %r11
133  .cfi_adjust_cfa_offset -8
134  pop %r10
135  .cfi_adjust_cfa_offset -8
136  pop %r9
137  .cfi_adjust_cfa_offset -8
138  pop %r8
139  .cfi_adjust_cfa_offset -8
140  pop %rdi
141  .cfi_adjust_cfa_offset -8
142  pop %rsi
143  .cfi_adjust_cfa_offset -8
144  pop %rdx
145  .cfi_adjust_cfa_offset -8
146  pop %rcx
147  .cfi_adjust_cfa_offset -8
148  pop %rax
149  .cfi_adjust_cfa_offset -8
150  .cfi_restore %rax
151  .cfi_restore %rbx
152  .cfi_restore %rcx
153  .cfi_restore %rdx
154  .cfi_restore %rsi
155  .cfi_restore %rdi
156  .cfi_restore %r8
157  .cfi_restore %r9
158  .cfi_restore %r10
159  .cfi_restore %r11
160  ret
161  .cfi_endproc
162
163#ifdef __linux__
164/* We do not need executable stack.  */
165.section        .note.GNU-stack,"",@progbits
166#endif
167