1 #include "tsan_ppc_regs.h"
4 .type _setjmp, @function
12 .quad .L._setjmp,.TOC.@tocbase,0
21 // r3 is the original stack pointer.
23 // r4 is the mangled stack pointer (see glibc)
26 // Materialize a TOC in case we were called from libc.
27 // For big-endian, we load the TOC from the OPD. For little-
28 // endian, we use the .TOC. symbol to find it.
34 addis r2,r2,.TOC.-0b@ha
37 addis r2,r2,_setjmp-0b@ha
38 addi r2,r2,_setjmp-0b@l
41 // Call the interceptor.
44 // Restore regs needed for setjmp.
47 // Emulate the real setjmp function. We do this because we can't
48 // perform a sibcall: The real setjmp function trashes the TOC
49 // pointer, and with a sibcall we have no way to restore it.
50 // This way we can make sure our caller's stack pointer and
51 // link register are saved correctly in the jmpbuf.
53 addi r5,r1,48 // original stack ptr of caller
55 std r5,0(r3) // mangled stack ptr of caller
57 std r5,8(r3) // caller's saved TOC pointer
59 std r0,16(r3) // caller's mangled return address
101 stw r0,168(r3) // VRSAVE
125 // Clear the "mask-saved" slot.
128 // Restore TOC, LR, and stack and return to caller.
132 li r3,0 // This is the setjmp return path
135 .size _setjmp, .-.L._setjmp
138 .type setjmp, @function
142 .size setjmp, .-setjmp
144 // sigsetjmp is like setjmp, except that the mask in r4 needs
145 // to be saved at offset 512 of the jump buffer.
147 .type __sigsetjmp, @function
155 .quad .L.__sigsetjmp,.TOC.@tocbase,0
165 // r3 is the original stack pointer.
167 // r4 is the mangled stack pointer (see glibc)
170 // Materialize a TOC in case we were called from libc.
171 // For big-endian, we load the TOC from the OPD. For little-
172 // endian, we use the .TOC. symbol to find it.
178 addis r2,r2,.TOC.-1b@ha
179 addi r2,r2,.TOC.-1b@l
181 addis r2,r2,_setjmp-1b@ha
182 addi r2,r2,_setjmp-1b@l
185 // Call the interceptor.
188 // Restore regs needed for __sigsetjmp.
192 // Emulate the real sigsetjmp function. We do this because we can't
193 // perform a sibcall: The real sigsetjmp function trashes the TOC
194 // pointer, and with a sibcall we have no way to restore it.
195 // This way we can make sure our caller's stack pointer and
196 // link register are saved correctly in the jmpbuf.
198 addi r5,r1,64 // original stack ptr of caller
200 std r5,0(r3) // mangled stack ptr of caller
202 std r5,8(r3) // caller's saved TOC pointer
204 std r0,16(r3) // caller's mangled return address
246 stw r0,168(r3) // VRSAVE
270 // Save into the "mask-saved" slot.
272 // Restore TOC, LR, and stack and return to caller.
276 li r3,0 // This is the sigsetjmp return path
279 .size __sigsetjmp, .-.L.__sigsetjmp
282 .type sigsetjmp, @function
286 .size sigsetjmp, .-sigsetjmp