Home | History | Annotate | Download | only in rtl
      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 .hidden __tsan_setjmp
    164 .comm _ZN14__interception11real_setjmpE,8,8
    165 .globl setjmp
    166 .type setjmp, @function
    167 setjmp:
    168   .cfi_startproc
    169   // save env parameter
    170   push %rdi
    171   .cfi_adjust_cfa_offset 8
    172   .cfi_rel_offset %rdi, 0
    173   // obtain %rsp
    174   lea 16(%rsp), %rdi
    175   mov %rdi, %rsi
    176   xor %fs:0x30, %rsi  // magic mangling of rsp (see libc setjmp)
    177   rol $0x11, %rsi
    178   // call tsan interceptor
    179   call __tsan_setjmp
    180   // restore env parameter
    181   pop %rdi
    182   .cfi_adjust_cfa_offset -8
    183   .cfi_restore %rdi
    184   // tail jump to libc setjmp
    185   movl $0, %eax
    186   movq _ZN14__interception11real_setjmpE@GOTPCREL(%rip), %rdx
    187   jmp *(%rdx)
    188   .cfi_endproc
    189 .size setjmp, .-setjmp
    190 
    191 .comm _ZN14__interception12real__setjmpE,8,8
    192 .globl _setjmp
    193 .type _setjmp, @function
    194 _setjmp:
    195   .cfi_startproc
    196   // save env parameter
    197   push %rdi
    198   .cfi_adjust_cfa_offset 8
    199   .cfi_rel_offset %rdi, 0
    200   // obtain %rsp
    201   lea 16(%rsp), %rdi
    202   mov %rdi, %rsi
    203   xor %fs:0x30, %rsi  // magic mangling of rsp (see libc setjmp)
    204   rol $0x11, %rsi
    205   // call tsan interceptor
    206   call __tsan_setjmp
    207   // restore env parameter
    208   pop %rdi
    209   .cfi_adjust_cfa_offset -8
    210   .cfi_restore %rdi
    211   // tail jump to libc setjmp
    212   movl $0, %eax
    213   movq _ZN14__interception12real__setjmpE@GOTPCREL(%rip), %rdx
    214   jmp *(%rdx)
    215   .cfi_endproc
    216 .size _setjmp, .-_setjmp
    217 
    218 .comm _ZN14__interception14real_sigsetjmpE,8,8
    219 .globl sigsetjmp
    220 .type sigsetjmp, @function
    221 sigsetjmp:
    222   .cfi_startproc
    223   // save env parameter
    224   push %rdi
    225   .cfi_adjust_cfa_offset 8
    226   .cfi_rel_offset %rdi, 0
    227   // save savesigs parameter
    228   push %rsi
    229   .cfi_adjust_cfa_offset 8
    230   .cfi_rel_offset %rsi, 0
    231   // align stack frame
    232   sub $8, %rsp
    233   .cfi_adjust_cfa_offset 8
    234   // obtain %rsp
    235   lea 32(%rsp), %rdi
    236   mov %rdi, %rsi
    237   xor %fs:0x30, %rsi  // magic mangling of rsp (see libc setjmp)
    238   rol $0x11, %rsi
    239   // call tsan interceptor
    240   call __tsan_setjmp
    241   // unalign stack frame
    242   add $8, %rsp
    243   .cfi_adjust_cfa_offset -8
    244   // restore savesigs parameter
    245   pop %rsi
    246   .cfi_adjust_cfa_offset -8
    247   .cfi_restore %rsi
    248   // restore env parameter
    249   pop %rdi
    250   .cfi_adjust_cfa_offset -8
    251   .cfi_restore %rdi
    252   // tail jump to libc sigsetjmp
    253   movl $0, %eax
    254   movq _ZN14__interception14real_sigsetjmpE@GOTPCREL(%rip), %rdx
    255   jmp *(%rdx)
    256   .cfi_endproc
    257 .size sigsetjmp, .-sigsetjmp
    258 
    259 .comm _ZN14__interception16real___sigsetjmpE,8,8
    260 .globl __sigsetjmp
    261 .type __sigsetjmp, @function
    262 __sigsetjmp:
    263   .cfi_startproc
    264   // save env parameter
    265   push %rdi
    266   .cfi_adjust_cfa_offset 8
    267   .cfi_rel_offset %rdi, 0
    268   // save savesigs parameter
    269   push %rsi
    270   .cfi_adjust_cfa_offset 8
    271   .cfi_rel_offset %rsi, 0
    272   // align stack frame
    273   sub $8, %rsp
    274   .cfi_adjust_cfa_offset 8
    275   // obtain %rsp
    276   lea 32(%rsp), %rdi
    277   mov %rdi, %rsi
    278   xor %fs:0x30, %rsi  // magic mangling of rsp (see libc setjmp)
    279   rol $0x11, %rsi
    280   // call tsan interceptor
    281   call __tsan_setjmp
    282   // unalign stack frame
    283   add $8, %rsp
    284   .cfi_adjust_cfa_offset -8
    285   // restore savesigs parameter
    286   pop %rsi
    287   .cfi_adjust_cfa_offset -8
    288   .cfi_restore %rsi
    289   // restore env parameter
    290   pop %rdi
    291   .cfi_adjust_cfa_offset -8
    292   .cfi_restore %rdi
    293   // tail jump to libc sigsetjmp
    294   movl $0, %eax
    295   movq _ZN14__interception16real___sigsetjmpE@GOTPCREL(%rip), %rdx
    296   jmp *(%rdx)
    297   .cfi_endproc
    298 .size __sigsetjmp, .-__sigsetjmp
    299 
    300 #ifdef __linux__
    301 /* We do not need executable stack.  */
    302 .section        .note.GNU-stack,"",@progbits
    303 #endif
    304