1 #include "tsan_ppc_regs.h"
6 .type _setjmp, @function
14 .quad .L._setjmp,.TOC.@tocbase,0
23 // r3 is the original stack pointer.
25 // r4 is the mangled stack pointer (see glibc)
28 // Materialize a TOC in case we were called from libc.
29 // For big-endian, we load the TOC from the OPD. For little-
30 // endian, we use the .TOC. symbol to find it.
36 addis r2,r2,.TOC.-0b@ha
39 addis r2,r2,_setjmp-0b@ha
40 addi r2,r2,_setjmp-0b@l
43 // Call the interceptor.
46 // Restore regs needed for setjmp.
49 // Emulate the real setjmp function. We do this because we can't
50 // perform a sibcall: The real setjmp function trashes the TOC
51 // pointer, and with a sibcall we have no way to restore it.
52 // This way we can make sure our caller's stack pointer and
53 // link register are saved correctly in the jmpbuf.
55 addi r5,r1,48 // original stack ptr of caller
57 std r5,0(r3) // mangled stack ptr of caller
59 std r5,8(r3) // caller's saved TOC pointer
61 std r0,16(r3) // caller's mangled return address
103 stw r0,168(r3) // VRSAVE
127 // Clear the "mask-saved" slot.
130 // Restore TOC, LR, and stack and return to caller.
134 li r3,0 // This is the setjmp return path
137 .size _setjmp, .-.L._setjmp
140 .type setjmp, @function
144 .size setjmp, .-setjmp
146 // sigsetjmp is like setjmp, except that the mask in r4 needs
147 // to be saved at offset 512 of the jump buffer.
149 .type __sigsetjmp, @function
157 .quad .L.__sigsetjmp,.TOC.@tocbase,0
167 // r3 is the original stack pointer.
169 // r4 is the mangled stack pointer (see glibc)
172 // Materialize a TOC in case we were called from libc.
173 // For big-endian, we load the TOC from the OPD. For little-
174 // endian, we use the .TOC. symbol to find it.
180 addis r2,r2,.TOC.-1b@ha
181 addi r2,r2,.TOC.-1b@l
183 addis r2,r2,_setjmp-1b@ha
184 addi r2,r2,_setjmp-1b@l
187 // Call the interceptor.
190 // Restore regs needed for __sigsetjmp.
194 // Emulate the real sigsetjmp function. We do this because we can't
195 // perform a sibcall: The real sigsetjmp function trashes the TOC
196 // pointer, and with a sibcall we have no way to restore it.
197 // This way we can make sure our caller's stack pointer and
198 // link register are saved correctly in the jmpbuf.
200 addi r5,r1,64 // original stack ptr of caller
202 std r5,0(r3) // mangled stack ptr of caller
204 std r5,8(r3) // caller's saved TOC pointer
206 std r0,16(r3) // caller's mangled return address
248 stw r0,168(r3) // VRSAVE
272 // Save into the "mask-saved" slot.
274 // Restore TOC, LR, and stack and return to caller.
278 li r3,0 // This is the sigsetjmp return path
281 .size __sigsetjmp, .-.L.__sigsetjmp
284 .type sigsetjmp, @function
288 .size sigsetjmp, .-sigsetjmp