1 // The content of this file is AArch64-only:
2 #if defined(__aarch64__)
4 #include "sanitizer_common/sanitizer_asm.h"
6 #if !defined(__APPLE__)
13 ASM_HIDDEN(__tsan_setjmp)
14 .comm _ZN14__interception11real_setjmpE,8,8
15 .globl ASM_SYMBOL_INTERCEPTOR(setjmp)
16 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(setjmp))
17 ASM_SYMBOL_INTERCEPTOR(setjmp):
20 // Save frame/link register
21 stp x29, x30, [sp, -32]!
22 CFI_DEF_CFA_OFFSET (32)
26 // Adjust the SP for previous frame
28 CFI_DEF_CFA_REGISTER (29)
34 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
37 // call tsan interceptor
38 bl ASM_SYMBOL(__tsan_setjmp)
40 // Restore env parameter
44 // Restore frame/link register
45 ldp x29, x30, [sp], 32
50 // tail jump to libc setjmp
51 #if !defined(__APPLE__)
52 adrp x1, :got:_ZN14__interception11real_setjmpE
53 ldr x1, [x1, #:got_lo12:_ZN14__interception11real_setjmpE]
56 adrp x1, _setjmp@GOTPAGE
57 ldr x1, [x1, _setjmp@GOTPAGEOFF]
62 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(setjmp))
64 .comm _ZN14__interception12real__setjmpE,8,8
65 .globl ASM_SYMBOL_INTERCEPTOR(_setjmp)
66 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(_setjmp))
67 ASM_SYMBOL_INTERCEPTOR(_setjmp):
70 // Save frame/link register
71 stp x29, x30, [sp, -32]!
72 CFI_DEF_CFA_OFFSET (32)
76 // Adjust the SP for previous frame
78 CFI_DEF_CFA_REGISTER (29)
84 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
87 // call tsan interceptor
88 bl ASM_SYMBOL(__tsan_setjmp)
90 // Restore env parameter
94 // Restore frame/link register
95 ldp x29, x30, [sp], 32
100 // tail jump to libc setjmp
101 #if !defined(__APPLE__)
102 adrp x1, :got:_ZN14__interception12real__setjmpE
103 ldr x1, [x1, #:got_lo12:_ZN14__interception12real__setjmpE]
106 adrp x1, __setjmp@GOTPAGE
107 ldr x1, [x1, __setjmp@GOTPAGEOFF]
112 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(_setjmp))
114 .comm _ZN14__interception14real_sigsetjmpE,8,8
115 .globl ASM_SYMBOL_INTERCEPTOR(sigsetjmp)
116 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
117 ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
120 // Save frame/link register
121 stp x29, x30, [sp, -32]!
122 CFI_DEF_CFA_OFFSET (32)
126 // Adjust the SP for previous frame
128 CFI_DEF_CFA_REGISTER (29)
130 // Save env and savesigs parameter
135 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
138 // call tsan interceptor
139 bl ASM_SYMBOL(__tsan_setjmp)
141 // Restore env and savesigs parameter
146 // Restore frame/link register
147 ldp x29, x30, [sp], 32
152 // tail jump to libc sigsetjmp
153 #if !defined(__APPLE__)
154 adrp x2, :got:_ZN14__interception14real_sigsetjmpE
155 ldr x2, [x2, #:got_lo12:_ZN14__interception14real_sigsetjmpE]
158 adrp x2, _sigsetjmp@GOTPAGE
159 ldr x2, [x2, _sigsetjmp@GOTPAGEOFF]
163 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
165 #if !defined(__APPLE__)
166 .comm _ZN14__interception16real___sigsetjmpE,8,8
167 .globl ASM_SYMBOL_INTERCEPTOR(__sigsetjmp)
168 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
169 ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
172 // Save frame/link register
173 stp x29, x30, [sp, -32]!
174 CFI_DEF_CFA_OFFSET (32)
178 // Adjust the SP for previous frame
180 CFI_DEF_CFA_REGISTER (29)
182 // Save env and savesigs parameter
187 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
190 // call tsan interceptor
191 bl ASM_SYMBOL(__tsan_setjmp)
193 // Restore env and savesigs parameter
198 // Restore frame/link register
199 ldp x29, x30, [sp], 32
204 // tail jump to libc __sigsetjmp
205 #if !defined(__APPLE__)
206 adrp x2, :got:_ZN14__interception16real___sigsetjmpE
207 ldr x2, [x2, #:got_lo12:_ZN14__interception16real___sigsetjmpE]
210 adrp x2, ASM_SYMBOL(__sigsetjmp)@page
211 add x2, x2, ASM_SYMBOL(__sigsetjmp)@pageoff
215 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
218 NO_EXEC_STACK_DIRECTIVE