1.section .text
2.set noreorder
3
4.hidden __tsan_setjmp
5.comm _ZN14__interception11real_setjmpE,8,8
6.globl setjmp
7.type setjmp, @function
8setjmp:
9
10 // save env parameters
11 daddiu $sp,$sp,-40
12 sd $s0,32($sp)
13 sd $ra,24($sp)
14 sd $fp,16($sp)
15 sd $gp,8($sp)
16
17 // calculate and save pointer to GOT
18 lui $gp,%hi(%neg(%gp_rel(setjmp)))
19 daddu $gp,$gp,$t9
20 daddiu $gp,$gp,%lo(%neg(%gp_rel(setjmp)))
21 move $s0,$gp
22
23 // save jmp_buf
24 sd $a0,0($sp)
25
26 // obtain $sp
27 dadd $a0,$zero,$sp
28
29 // call tsan interceptor
30 jal __tsan_setjmp
31 daddiu $a1,$a0,40
32
33 // restore jmp_buf
34 ld $a0,0($sp)
35
36 // restore gp
37 move $gp,$s0
38
39 // load pointer of libc setjmp to t9
40 dla $t9,(_ZN14__interception11real_setjmpE)
41
42 // restore env parameters
43 ld $gp,8($sp)
44 ld $fp,16($sp)
45 ld $ra,24($sp)
46 ld $s0,32($sp)
47 daddiu $sp,$sp,40
48
49 // tail jump to libc setjmp
50 ld $t9,0($t9)
51 jr $t9
52 nop
53
54.size setjmp, .-setjmp
55
56.hidden __tsan_setjmp
57.globl _setjmp
58.comm _ZN14__interception12real__setjmpE,8,8
59.type _setjmp, @function
60_setjmp:
61
62 // Save env parameters
63 daddiu $sp,$sp,-40
64 sd $s0,32($sp)
65 sd $ra,24($sp)
66 sd $fp,16($sp)
67 sd $gp,8($sp)
68
69 // calculate and save pointer to GOT
70 lui $gp,%hi(%neg(%gp_rel(_setjmp)))
71 daddu $gp,$gp,$t9
72 daddiu $gp,$gp,%lo(%neg(%gp_rel(_setjmp)))
73 move $s0,$gp
74
75 // save jmp_buf
76 sd $a0,0($sp)
77
78 // obtain $sp
79 dadd $a0,$zero,$sp
80
81 // call tsan interceptor
82 jal __tsan_setjmp
83 daddiu $a1,$a0,40
84
85 // restore jmp_buf
86 ld $a0,0($sp)
87
88 // restore gp
89 move $gp,$s0
90
91 // load pointer of libc _setjmp to t9
92 dla $t9,(_ZN14__interception12real__setjmpE)
93
94 // restore env parameters
95 ld $gp,8($sp)
96 ld $fp,16($sp)
97 ld $ra,24($sp)
98 ld $s0,32($sp)
99 daddiu $sp,$sp,40
100
101 // tail jump to libc _setjmp
102 ld $t9,0($t9)
103 jr $t9
104 nop
105
106.size _setjmp, .-_setjmp
107
108.hidden __tsan_setjmp
109.globl sigsetjmp
110.comm _ZN14__interception14real_sigsetjmpE,8,8
111.type sigsetjmp, @function
112sigsetjmp:
113
114 // Save env parameters
115 daddiu $sp,$sp,-48
116 sd $s0,40($sp)
117 sd $ra,32($sp)
118 sd $fp,24($sp)
119 sd $gp,16($sp)
120
121 // calculate and save pointer to GOT
122 lui $gp,%hi(%neg(%gp_rel(sigsetjmp)))
123 daddu $gp,$gp,$t9
124 daddiu $gp,$gp,%lo(%neg(%gp_rel(sigsetjmp)))
125 move $s0,$gp
126
127 // save jmp_buf and savesig
128 sd $a0,0($sp)
129 sd $a1,8($sp)
130
131 // obtain $sp
132 dadd $a0,$zero,$sp
133
134 // call tsan interceptor
135 jal __tsan_setjmp
136 daddiu $a1,$a0,48
137
138 // restore jmp_buf and savesig
139 ld $a0,0($sp)
140 ld $a1,8($sp)
141
142 // restore gp
143 move $gp,$s0
144
145 // load pointer of libc sigsetjmp to t9
146 dla $t9,(_ZN14__interception14real_sigsetjmpE)
147
148 // restore env parameters
149 ld $gp,16($sp)
150 ld $fp,24($sp)
151 ld $ra,32($sp)
152 ld $s0,40($sp)
153 daddiu $sp,$sp,48
154
155 // tail jump to libc sigsetjmp
156 ld $t9,0($t9)
157 jr $t9
158 nop
159
160.size sigsetjmp, .-sigsetjmp
161
162.hidden __tsan_setjmp
163.comm _ZN14__interception16real___sigsetjmpE,8,8
164.globl __sigsetjmp
165.type __sigsetjmp, @function
166__sigsetjmp:
167
168 // Save env parameters
169 daddiu $sp,$sp,-48
170 sd $s0,40($sp)
171 sd $ra,32($sp)
172 sd $fp,24($sp)
173 sd $gp,16($sp)
174
175 // calculate and save pointer to GOT
176 lui $gp,%hi(%neg(%gp_rel(__sigsetjmp)))
177 daddu $gp,$gp,$t9
178 daddiu $gp,$gp,%lo(%neg(%gp_rel(__sigsetjmp)))
179 move $s0,$gp
180
181 // save jmp_buf and savesig
182 sd $a0,0($sp)
183 sd $a1,8($sp)
184
185 // obtain $sp
186 dadd $a0,$zero,$sp
187
188 // call tsan interceptor
189 jal __tsan_setjmp
190 daddiu $a1,$a0,48
191
192 // restore jmp_buf and savesig
193 ld $a0,0($sp)
194 ld $a1,8($sp)
195
196 // restore gp
197 move $gp,$s0
198
199 // load pointer to libc __sigsetjmp in t9
200 dla $t9,(_ZN14__interception16real___sigsetjmpE)
201
202 // restore env parameters
203 ld $gp,16($sp)
204 ld $fp,24($sp)
205 ld $ra,32($sp)
206 ld $s0,40($sp)
207 daddiu $sp,$sp,48
208
209 // tail jump to libc __sigsetjmp
210 ld $t9,0($t9)
211 jr $t9
212 nop
213
214.size __sigsetjmp, .-__sigsetjmp
215

source code of compiler-rt/lib/tsan/rtl/tsan_rtl_mips64.S