1 #include "tsan_ppc_regs.h"
7 .type _setjmp, @function
15 .quad .L._setjmp,.TOC.@tocbase,0
24 // r3 is the original stack pointer.
26 // r4 is the mangled stack pointer (see glibc)
29 // Materialize a TOC in case we were called from libc.
30 // For big-endian, we load the TOC from the OPD. For little-
31 // endian, we use the .TOC. symbol to find it.
37 addis r2,r2,.TOC.-0b@ha
40 addis r2,r2,_setjmp-0b@ha
41 addi r2,r2,_setjmp-0b@l
44 // Call the interceptor.
47 // Restore regs needed for setjmp.
50 // Emulate the real setjmp function. We do this because we can't
51 // perform a sibcall: The real setjmp function trashes the TOC
52 // pointer, and with a sibcall we have no way to restore it.
53 // This way we can make sure our caller's stack pointer and
54 // link register are saved correctly in the jmpbuf.
56 addi r5,r1,48 // original stack ptr of caller
58 std r5,0(r3) // mangled stack ptr of caller
60 std r5,8(r3) // caller's saved TOC pointer
62 std r0,16(r3) // caller's mangled return address
104 stw r0,168(r3) // VRSAVE
128 // Clear the "mask-saved" slot.
131 // Restore TOC, LR, and stack and return to caller.
135 li r3,0 // This is the setjmp return path
138 .size _setjmp, .-.L._setjmp
141 .type setjmp, @function
145 .size setjmp, .-setjmp
147 // sigsetjmp is like setjmp, except that the mask in r4 needs
148 // to be saved at offset 512 of the jump buffer.
150 .type __sigsetjmp, @function
158 .quad .L.__sigsetjmp,.TOC.@tocbase,0
168 // r3 is the original stack pointer.
170 // r4 is the mangled stack pointer (see glibc)
173 // Materialize a TOC in case we were called from libc.
174 // For big-endian, we load the TOC from the OPD. For little-
175 // endian, we use the .TOC. symbol to find it.
181 addis r2,r2,.TOC.-1b@ha
182 addi r2,r2,.TOC.-1b@l
184 addis r2,r2,_setjmp-1b@ha
185 addi r2,r2,_setjmp-1b@l
188 // Call the interceptor.
191 // Restore regs needed for __sigsetjmp.
195 // Emulate the real sigsetjmp function. We do this because we can't
196 // perform a sibcall: The real sigsetjmp function trashes the TOC
197 // pointer, and with a sibcall we have no way to restore it.
198 // This way we can make sure our caller's stack pointer and
199 // link register are saved correctly in the jmpbuf.
201 addi r5,r1,64 // original stack ptr of caller
203 std r5,0(r3) // mangled stack ptr of caller
205 std r5,8(r3) // caller's saved TOC pointer
207 std r0,16(r3) // caller's mangled return address
249 stw r0,168(r3) // VRSAVE
273 // Save into the "mask-saved" slot.
275 // Restore TOC, LR, and stack and return to caller.
279 li r3,0 // This is the sigsetjmp return path
282 .size __sigsetjmp, .-.L.__sigsetjmp
285 .type sigsetjmp, @function
289 .size sigsetjmp, .-sigsetjmp