1 // The content of this file is AArch64-only:
2 #if defined(__aarch64__)
4 #include "sanitizer_common/sanitizer_asm.h"
5 #include "builtins/assembly.h"
7 #if !defined(__APPLE__)
10 .section __TEXT,__text
14 ASM_HIDDEN(__tsan_setjmp)
15 .comm _ZN14__interception11real_setjmpE,8,8
16 .globl ASM_SYMBOL_INTERCEPTOR(setjmp)
17 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(setjmp))
18 ASM_SYMBOL_INTERCEPTOR(setjmp):
22 // Save frame/link register
23 stp x29, x30, [sp, -32]!
24 CFI_DEF_CFA_OFFSET (32)
28 // Adjust the SP for previous frame
30 CFI_DEF_CFA_REGISTER (29)
36 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
39 // call tsan interceptor
40 bl ASM_SYMBOL(__tsan_setjmp)
42 // Restore env parameter
46 // Restore frame/link register
47 ldp x29, x30, [sp], 32
52 // tail jump to libc setjmp
53 #if !defined(__APPLE__)
54 adrp x1, :got:_ZN14__interception11real_setjmpE
55 ldr x1, [x1, #:got_lo12:_ZN14__interception11real_setjmpE]
58 adrp x1, _setjmp@GOTPAGE
59 ldr x1, [x1, _setjmp@GOTPAGEOFF]
64 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(setjmp))
66 .comm _ZN14__interception12real__setjmpE,8,8
67 .globl ASM_SYMBOL_INTERCEPTOR(_setjmp)
68 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(_setjmp))
69 ASM_SYMBOL_INTERCEPTOR(_setjmp):
73 // Save frame/link register
74 stp x29, x30, [sp, -32]!
75 CFI_DEF_CFA_OFFSET (32)
79 // Adjust the SP for previous frame
81 CFI_DEF_CFA_REGISTER (29)
87 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
90 // call tsan interceptor
91 bl ASM_SYMBOL(__tsan_setjmp)
93 // Restore env parameter
97 // Restore frame/link register
98 ldp x29, x30, [sp], 32
103 // tail jump to libc setjmp
104 #if !defined(__APPLE__)
105 adrp x1, :got:_ZN14__interception12real__setjmpE
106 ldr x1, [x1, #:got_lo12:_ZN14__interception12real__setjmpE]
109 adrp x1, __setjmp@GOTPAGE
110 ldr x1, [x1, __setjmp@GOTPAGEOFF]
115 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(_setjmp))
117 .comm _ZN14__interception14real_sigsetjmpE,8,8
118 .globl ASM_SYMBOL_INTERCEPTOR(sigsetjmp)
119 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
120 ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
124 // Save frame/link register
125 stp x29, x30, [sp, -32]!
126 CFI_DEF_CFA_OFFSET (32)
130 // Adjust the SP for previous frame
132 CFI_DEF_CFA_REGISTER (29)
134 // Save env and savesigs parameter
139 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
142 // call tsan interceptor
143 bl ASM_SYMBOL(__tsan_setjmp)
145 // Restore env and savesigs parameter
150 // Restore frame/link register
151 ldp x29, x30, [sp], 32
156 // tail jump to libc sigsetjmp
157 #if !defined(__APPLE__)
158 adrp x2, :got:_ZN14__interception14real_sigsetjmpE
159 ldr x2, [x2, #:got_lo12:_ZN14__interception14real_sigsetjmpE]
162 adrp x2, _sigsetjmp@GOTPAGE
163 ldr x2, [x2, _sigsetjmp@GOTPAGEOFF]
167 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
169 #if !defined(__APPLE__)
170 .comm _ZN14__interception16real___sigsetjmpE,8,8
171 .globl ASM_SYMBOL_INTERCEPTOR(__sigsetjmp)
172 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
173 ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
177 // Save frame/link register
178 stp x29, x30, [sp, -32]!
179 CFI_DEF_CFA_OFFSET (32)
183 // Adjust the SP for previous frame
185 CFI_DEF_CFA_REGISTER (29)
187 // Save env and savesigs parameter
192 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
195 // call tsan interceptor
196 bl ASM_SYMBOL(__tsan_setjmp)
198 // Restore env and savesigs parameter
203 // Restore frame/link register
204 ldp x29, x30, [sp], 32
209 // tail jump to libc __sigsetjmp
210 #if !defined(__APPLE__)
211 adrp x2, :got:_ZN14__interception16real___sigsetjmpE
212 ldr x2, [x2, #:got_lo12:_ZN14__interception16real___sigsetjmpE]
215 adrp x2, ASM_SYMBOL(__sigsetjmp)@page
216 add x2, x2, ASM_SYMBOL(__sigsetjmp)@pageoff
220 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
223 NO_EXEC_STACK_DIRECTIVE