tsan_rtl_mips64.S 3.7 KB

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