1 | #include "sanitizer_common/sanitizer_asm.h" |
2 | |
3 | #define CFA_OFFSET 160 |
4 | #define R2_REL_OFFSET 16 |
5 | #define R3_REL_OFFSET 24 |
6 | #define R14_REL_OFFSET 112 |
7 | #define R15_REL_OFFSET 120 |
8 | #define FRAME_SIZE 160 |
9 | |
10 | .text |
11 | |
12 | ASM_HIDDEN(__tsan_setjmp) |
13 | |
14 | .macro intercept symbol, real |
15 | .comm \real, 8, 8 |
16 | .globl ASM_SYMBOL_INTERCEPTOR(\symbol) |
17 | ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(\symbol)) |
18 | ASM_SYMBOL_INTERCEPTOR(\symbol): |
19 | CFI_STARTPROC |
20 | stmg %r2, %r3, R2_REL_OFFSET(%r15) |
21 | CFI_REL_OFFSET(%r2, R2_REL_OFFSET) |
22 | CFI_REL_OFFSET(%r3, R3_REL_OFFSET) |
23 | stmg %r14, %r15, R14_REL_OFFSET(%r15) |
24 | CFI_REL_OFFSET(%r14, R14_REL_OFFSET) |
25 | CFI_REL_OFFSET(%r15, R15_REL_OFFSET) |
26 | aghi %r15, -FRAME_SIZE |
27 | CFI_ADJUST_CFA_OFFSET(FRAME_SIZE) |
28 | la %r2, FRAME_SIZE(%r15) |
29 | brasl %r14, ASM_SYMBOL(__tsan_setjmp) |
30 | lmg %r14, %r15, FRAME_SIZE + R14_REL_OFFSET(%r15) |
31 | CFI_RESTORE(%r14) |
32 | CFI_RESTORE(%r15) |
33 | CFI_DEF_CFA_OFFSET(CFA_OFFSET) |
34 | lmg %r2, %r3, R2_REL_OFFSET(%r15) |
35 | CFI_RESTORE(%r2) |
36 | CFI_RESTORE(%r3) |
37 | larl %r1, \real |
38 | lg %r1, 0(%r1) |
39 | br %r1 |
40 | CFI_ENDPROC |
41 | ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(\symbol)) |
42 | .endm |
43 | |
44 | intercept setjmp, _ZN14__interception11real_setjmpE |
45 | intercept _setjmp, _ZN14__interception12real__setjmpE |
46 | intercept sigsetjmp, _ZN14__interception14real_sigsetjmpE |
47 | intercept __sigsetjmp, _ZN14__interception16real___sigsetjmpE |
48 | |
49 | NO_EXEC_STACK_DIRECTIVE |
50 | |