]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/lib/asan/asan_asm_instrumentation.S
Imported Upstream version 1.5.0+dfsg1
[rustc.git] / src / compiler-rt / lib / asan / asan_asm_instrumentation.S
CommitLineData
1a4d82fc
JJ
1// This file was generated by gen_asm_instrumentation.sh. Please, do not edit
2// manually.
3#ifdef __linux__
4.section .text
5#if defined(__x86_64__) || defined(__i386__)
6.globl __asan_report_store1
7.globl __asan_report_load1
8.globl __asan_report_store2
9.globl __asan_report_load2
10.globl __asan_report_store4
11.globl __asan_report_load4
12.globl __asan_report_store8
13.globl __asan_report_load8
14.globl __asan_report_store16
15.globl __asan_report_load16
16#endif // defined(__x86_64__) || defined(__i386__)
17#if defined(__i386__)
18// Sanitize 1-byte store. Takes one 4-byte address as an argument on
19// stack, nothing is returned.
20.globl __sanitizer_sanitize_store1
21.type __sanitizer_sanitize_store1, @function
22__sanitizer_sanitize_store1:
23 pushl %ebp
24 movl %esp, %ebp
25 pushl %eax
26 pushl %ecx
27 pushl %edx
28 pushfl
29 movl 8(%ebp), %eax
30 movl %eax, %ecx
31 shrl $0x3, %ecx
32 movb 0x20000000(%ecx), %cl
33 testb %cl, %cl
34 je .sanitize_store1_done
35 movl %eax, %edx
36 andl $0x7, %edx
37 movsbl %cl, %ecx
38 cmpl %ecx, %edx
39 jl .sanitize_store1_done
40 pushl %eax
41 cld
42 emms
43 call __asan_report_store1@PLT
44.sanitize_store1_done:
45 popfl
46 popl %edx
47 popl %ecx
48 popl %eax
49 leave
50 ret
51// Sanitize 1-byte load. Takes one 4-byte address as an argument on
52// stack, nothing is returned.
53.globl __sanitizer_sanitize_load1
54.type __sanitizer_sanitize_load1, @function
55__sanitizer_sanitize_load1:
56 pushl %ebp
57 movl %esp, %ebp
58 pushl %eax
59 pushl %ecx
60 pushl %edx
61 pushfl
62 movl 8(%ebp), %eax
63 movl %eax, %ecx
64 shrl $0x3, %ecx
65 movb 0x20000000(%ecx), %cl
66 testb %cl, %cl
67 je .sanitize_load1_done
68 movl %eax, %edx
69 andl $0x7, %edx
70 movsbl %cl, %ecx
71 cmpl %ecx, %edx
72 jl .sanitize_load1_done
73 pushl %eax
74 cld
75 emms
76 call __asan_report_load1@PLT
77.sanitize_load1_done:
78 popfl
79 popl %edx
80 popl %ecx
81 popl %eax
82 leave
83 ret
84// Sanitize 2-byte store. Takes one 4-byte address as an argument on
85// stack, nothing is returned.
86.globl __sanitizer_sanitize_store2
87.type __sanitizer_sanitize_store2, @function
88__sanitizer_sanitize_store2:
89 pushl %ebp
90 movl %esp, %ebp
91 pushl %eax
92 pushl %ecx
93 pushl %edx
94 pushfl
95 movl 8(%ebp), %eax
96 movl %eax, %ecx
97 shrl $0x3, %ecx
98 movb 0x20000000(%ecx), %cl
99 testb %cl, %cl
100 je .sanitize_store2_done
101 movl %eax, %edx
102 andl $0x7, %edx
103 incl %edx
104 movsbl %cl, %ecx
105 cmpl %ecx, %edx
106 jl .sanitize_store2_done
107 pushl %eax
108 cld
109 emms
110 call __asan_report_store2@PLT
111.sanitize_store2_done:
112 popfl
113 popl %edx
114 popl %ecx
115 popl %eax
116 leave
117 ret
118// Sanitize 2-byte load. Takes one 4-byte address as an argument on
119// stack, nothing is returned.
120.globl __sanitizer_sanitize_load2
121.type __sanitizer_sanitize_load2, @function
122__sanitizer_sanitize_load2:
123 pushl %ebp
124 movl %esp, %ebp
125 pushl %eax
126 pushl %ecx
127 pushl %edx
128 pushfl
129 movl 8(%ebp), %eax
130 movl %eax, %ecx
131 shrl $0x3, %ecx
132 movb 0x20000000(%ecx), %cl
133 testb %cl, %cl
134 je .sanitize_load2_done
135 movl %eax, %edx
136 andl $0x7, %edx
137 incl %edx
138 movsbl %cl, %ecx
139 cmpl %ecx, %edx
140 jl .sanitize_load2_done
141 pushl %eax
142 cld
143 emms
144 call __asan_report_load2@PLT
145.sanitize_load2_done:
146 popfl
147 popl %edx
148 popl %ecx
149 popl %eax
150 leave
151 ret
152// Sanitize 4-byte store. Takes one 4-byte address as an argument on
153// stack, nothing is returned.
154.globl __sanitizer_sanitize_store4
155.type __sanitizer_sanitize_store4, @function
156__sanitizer_sanitize_store4:
157 pushl %ebp
158 movl %esp, %ebp
159 pushl %eax
160 pushl %ecx
161 pushl %edx
162 pushfl
163 movl 8(%ebp), %eax
164 movl %eax, %ecx
165 shrl $0x3, %ecx
166 movb 0x20000000(%ecx), %cl
167 testb %cl, %cl
168 je .sanitize_store4_done
169 movl %eax, %edx
170 andl $0x7, %edx
171 addl $0x3, %edx
172 movsbl %cl, %ecx
173 cmpl %ecx, %edx
174 jl .sanitize_store4_done
175 pushl %eax
176 cld
177 emms
178 call __asan_report_store4@PLT
179.sanitize_store4_done:
180 popfl
181 popl %edx
182 popl %ecx
183 popl %eax
184 leave
185 ret
186// Sanitize 4-byte load. Takes one 4-byte address as an argument on
187// stack, nothing is returned.
188.globl __sanitizer_sanitize_load4
189.type __sanitizer_sanitize_load4, @function
190__sanitizer_sanitize_load4:
191 pushl %ebp
192 movl %esp, %ebp
193 pushl %eax
194 pushl %ecx
195 pushl %edx
196 pushfl
197 movl 8(%ebp), %eax
198 movl %eax, %ecx
199 shrl $0x3, %ecx
200 movb 0x20000000(%ecx), %cl
201 testb %cl, %cl
202 je .sanitize_load4_done
203 movl %eax, %edx
204 andl $0x7, %edx
205 addl $0x3, %edx
206 movsbl %cl, %ecx
207 cmpl %ecx, %edx
208 jl .sanitize_load4_done
209 pushl %eax
210 cld
211 emms
212 call __asan_report_load4@PLT
213.sanitize_load4_done:
214 popfl
215 popl %edx
216 popl %ecx
217 popl %eax
218 leave
219 ret
220// Sanitize 8-byte store. Takes one 4-byte address as an argument on
221// stack, nothing is returned.
222.globl __sanitizer_sanitize_store8
223.type __sanitizer_sanitize_store8, @function
224__sanitizer_sanitize_store8:
225 pushl %ebp
226 movl %esp, %ebp
227 pushl %eax
228 pushl %ecx
229 pushfl
230 movl 8(%ebp), %eax
231 movl %eax, %ecx
232 shrl $0x3, %ecx
233 cmpb $0x0, 0x20000000(%ecx)
234 je .sanitize_store8_done
235 pushl %eax
236 cld
237 emms
238 call __asan_report_store8@PLT
239.sanitize_store8_done:
240 popfl
241 popl %ecx
242 popl %eax
243 leave
244 ret
245// Sanitize 8-byte load. Takes one 4-byte address as an argument on
246// stack, nothing is returned.
247.globl __sanitizer_sanitize_load8
248.type __sanitizer_sanitize_load8, @function
249__sanitizer_sanitize_load8:
250 pushl %ebp
251 movl %esp, %ebp
252 pushl %eax
253 pushl %ecx
254 pushfl
255 movl 8(%ebp), %eax
256 movl %eax, %ecx
257 shrl $0x3, %ecx
258 cmpb $0x0, 0x20000000(%ecx)
259 je .sanitize_load8_done
260 pushl %eax
261 cld
262 emms
263 call __asan_report_load8@PLT
264.sanitize_load8_done:
265 popfl
266 popl %ecx
267 popl %eax
268 leave
269 ret
270// Sanitize 16-byte store. Takes one 4-byte address as an argument on
271// stack, nothing is returned.
272.globl __sanitizer_sanitize_store16
273.type __sanitizer_sanitize_store16, @function
274__sanitizer_sanitize_store16:
275 pushl %ebp
276 movl %esp, %ebp
277 pushl %eax
278 pushl %ecx
279 pushfl
280 movl 8(%ebp), %eax
281 movl %eax, %ecx
282 shrl $0x3, %ecx
283 cmpw $0x0, 0x20000000(%ecx)
284 je .sanitize_store16_done
285 pushl %eax
286 cld
287 emms
288 call __asan_report_store16@PLT
289.sanitize_store16_done:
290 popfl
291 popl %ecx
292 popl %eax
293 leave
294 ret
295// Sanitize 16-byte load. Takes one 4-byte address as an argument on
296// stack, nothing is returned.
297.globl __sanitizer_sanitize_load16
298.type __sanitizer_sanitize_load16, @function
299__sanitizer_sanitize_load16:
300 pushl %ebp
301 movl %esp, %ebp
302 pushl %eax
303 pushl %ecx
304 pushfl
305 movl 8(%ebp), %eax
306 movl %eax, %ecx
307 shrl $0x3, %ecx
308 cmpw $0x0, 0x20000000(%ecx)
309 je .sanitize_load16_done
310 pushl %eax
311 cld
312 emms
313 call __asan_report_load16@PLT
314.sanitize_load16_done:
315 popfl
316 popl %ecx
317 popl %eax
318 leave
319 ret
320#endif // defined(__i386__)
321#if defined(__x86_64__)
322// Sanitize 1-byte store. Takes one 8-byte address as an argument in %rdi,
323// nothing is returned.
324.globl __sanitizer_sanitize_store1
325.type __sanitizer_sanitize_store1, @function
326__sanitizer_sanitize_store1:
327 subq $128, %rsp
328 pushq %rax
329 pushq %rcx
330 pushfq
331 movq %rdi, %rax
332 shrq $0x3, %rax
333 movb 0x7fff8000(%rax), %al
334 test %al, %al
335 je .sanitize_store1_done
336 movl %edi, %ecx
337 andl $0x7, %ecx
338 movsbl %al, %eax
339 cmpl %eax, %ecx
340 jl .sanitize_store1_done
341 subq $8, %rsp
342 andq $-16, %rsp
343 cld
344 emms
345 call __asan_report_store1@PLT
346.sanitize_store1_done:
347 popfq
348 popq %rcx
349 popq %rax
350 addq $128, %rsp
351 ret
352// Sanitize 1-byte load. Takes one 8-byte address as an argument in %rdi,
353// nothing is returned.
354.globl __sanitizer_sanitize_load1
355.type __sanitizer_sanitize_load1, @function
356__sanitizer_sanitize_load1:
357 subq $128, %rsp
358 pushq %rax
359 pushq %rcx
360 pushfq
361 movq %rdi, %rax
362 shrq $0x3, %rax
363 movb 0x7fff8000(%rax), %al
364 test %al, %al
365 je .sanitize_load1_done
366 movl %edi, %ecx
367 andl $0x7, %ecx
368 movsbl %al, %eax
369 cmpl %eax, %ecx
370 jl .sanitize_load1_done
371 subq $8, %rsp
372 andq $-16, %rsp
373 cld
374 emms
375 call __asan_report_load1@PLT
376.sanitize_load1_done:
377 popfq
378 popq %rcx
379 popq %rax
380 addq $128, %rsp
381 ret
382// Sanitize 2-byte store. Takes one 8-byte address as an argument in %rdi,
383// nothing is returned.
384.globl __sanitizer_sanitize_store2
385.type __sanitizer_sanitize_store2, @function
386__sanitizer_sanitize_store2:
387 subq $128, %rsp
388 pushq %rax
389 pushq %rcx
390 pushfq
391 movq %rdi, %rax
392 shrq $0x3, %rax
393 movb 0x7fff8000(%rax), %al
394 test %al, %al
395 je .sanitize_store2_done
396 movl %edi, %ecx
397 andl $0x7, %ecx
398 incl %ecx
399 movsbl %al, %eax
400 cmpl %eax, %ecx
401 jl .sanitize_store2_done
402 subq $8, %rsp
403 andq $-16, %rsp
404 cld
405 emms
406 call __asan_report_store2@PLT
407.sanitize_store2_done:
408 popfq
409 popq %rcx
410 popq %rax
411 addq $128, %rsp
412 ret
413// Sanitize 2-byte load. Takes one 8-byte address as an argument in %rdi,
414// nothing is returned.
415.globl __sanitizer_sanitize_load2
416.type __sanitizer_sanitize_load2, @function
417__sanitizer_sanitize_load2:
418 subq $128, %rsp
419 pushq %rax
420 pushq %rcx
421 pushfq
422 movq %rdi, %rax
423 shrq $0x3, %rax
424 movb 0x7fff8000(%rax), %al
425 test %al, %al
426 je .sanitize_load2_done
427 movl %edi, %ecx
428 andl $0x7, %ecx
429 incl %ecx
430 movsbl %al, %eax
431 cmpl %eax, %ecx
432 jl .sanitize_load2_done
433 subq $8, %rsp
434 andq $-16, %rsp
435 cld
436 emms
437 call __asan_report_load2@PLT
438.sanitize_load2_done:
439 popfq
440 popq %rcx
441 popq %rax
442 addq $128, %rsp
443 ret
444// Sanitize 4-byte store. Takes one 8-byte address as an argument in %rdi,
445// nothing is returned.
446.globl __sanitizer_sanitize_store4
447.type __sanitizer_sanitize_store4, @function
448__sanitizer_sanitize_store4:
449 subq $128, %rsp
450 pushq %rax
451 pushq %rcx
452 pushfq
453 movq %rdi, %rax
454 shrq $0x3, %rax
455 movb 0x7fff8000(%rax), %al
456 test %al, %al
457 je .sanitize_store4_done
458 movl %edi, %ecx
459 andl $0x7, %ecx
460 addl $0x3, %ecx
461 movsbl %al, %eax
462 cmpl %eax, %ecx
463 jl .sanitize_store4_done
464 subq $8, %rsp
465 andq $-16, %rsp
466 cld
467 emms
468 call __asan_report_store4@PLT
469.sanitize_store4_done:
470 popfq
471 popq %rcx
472 popq %rax
473 addq $128, %rsp
474 ret
475// Sanitize 4-byte load. Takes one 8-byte address as an argument in %rdi,
476// nothing is returned.
477.globl __sanitizer_sanitize_load4
478.type __sanitizer_sanitize_load4, @function
479__sanitizer_sanitize_load4:
480 subq $128, %rsp
481 pushq %rax
482 pushq %rcx
483 pushfq
484 movq %rdi, %rax
485 shrq $0x3, %rax
486 movb 0x7fff8000(%rax), %al
487 test %al, %al
488 je .sanitize_load4_done
489 movl %edi, %ecx
490 andl $0x7, %ecx
491 addl $0x3, %ecx
492 movsbl %al, %eax
493 cmpl %eax, %ecx
494 jl .sanitize_load4_done
495 subq $8, %rsp
496 andq $-16, %rsp
497 cld
498 emms
499 call __asan_report_load4@PLT
500.sanitize_load4_done:
501 popfq
502 popq %rcx
503 popq %rax
504 addq $128, %rsp
505 ret
506// Sanitize 8-byte store. Takes one 8-byte address as an argument in %rdi,
507// nothing is returned.
508.globl __sanitizer_sanitize_store8
509.type __sanitizer_sanitize_store8, @function
510__sanitizer_sanitize_store8:
511 subq $128, %rsp
512 pushq %rax
513 pushfq
514 movq %rdi, %rax
515 shrq $0x3, %rax
516 cmpb $0x0, 0x7fff8000(%rax)
517 je .sanitize_store8_done
518 subq $8, %rsp
519 andq $-16, %rsp
520 cld
521 emms
522 call __asan_report_store8@PLT
523.sanitize_store8_done:
524 popfq
525 popq %rax
526 addq $128, %rsp
527 ret
528// Sanitize 8-byte load. Takes one 8-byte address as an argument in %rdi,
529// nothing is returned.
530.globl __sanitizer_sanitize_load8
531.type __sanitizer_sanitize_load8, @function
532__sanitizer_sanitize_load8:
533 subq $128, %rsp
534 pushq %rax
535 pushfq
536 movq %rdi, %rax
537 shrq $0x3, %rax
538 cmpb $0x0, 0x7fff8000(%rax)
539 je .sanitize_load8_done
540 subq $8, %rsp
541 andq $-16, %rsp
542 cld
543 emms
544 call __asan_report_load8@PLT
545.sanitize_load8_done:
546 popfq
547 popq %rax
548 addq $128, %rsp
549 ret
550// Sanitize 16-byte store. Takes one 8-byte address as an argument in %rdi,
551// nothing is returned.
552.globl __sanitizer_sanitize_store16
553.type __sanitizer_sanitize_store16, @function
554__sanitizer_sanitize_store16:
555 subq $128, %rsp
556 pushq %rax
557 pushfq
558 movq %rdi, %rax
559 shrq $0x3, %rax
560 cmpw $0x0, 0x7fff8000(%rax)
561 je .sanitize_store16_done
562 subq $8, %rsp
563 andq $-16, %rsp
564 cld
565 emms
566 call __asan_report_store16@PLT
567.sanitize_store16_done:
568 popfq
569 popq %rax
570 addq $128, %rsp
571 ret
572// Sanitize 16-byte load. Takes one 8-byte address as an argument in %rdi,
573// nothing is returned.
574.globl __sanitizer_sanitize_load16
575.type __sanitizer_sanitize_load16, @function
576__sanitizer_sanitize_load16:
577 subq $128, %rsp
578 pushq %rax
579 pushfq
580 movq %rdi, %rax
581 shrq $0x3, %rax
582 cmpw $0x0, 0x7fff8000(%rax)
583 je .sanitize_load16_done
584 subq $8, %rsp
585 andq $-16, %rsp
586 cld
587 emms
588 call __asan_report_load16@PLT
589.sanitize_load16_done:
590 popfq
591 popq %rax
592 addq $128, %rsp
593 ret
594#endif // defined(__x86_64__)
595/* We do not need executable stack. */
596#if defined(__arm__)
597 .section .note.GNU-stack,"",%progbits
598#else
599 .section .note.GNU-stack,"",@progbits
600#endif // defined(__arm__)
601#endif // __linux__