1 /* PLT trampolines. Sparc 64-bit version.
2 Copyright (C) 2005-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
24 /* %g1: PLT offset loaded by PLT entry
25 * %g4: callers PC, which is PLT0 + 24, therefore we
26 * add (32 + 8) to get the address of PLT2 which
27 * is where the magic cookie is stored
29 .globl _dl_runtime_resolve_0
30 .type _dl_runtime_resolve_0, @function
31 _dl_runtime_resolve_0:
35 cfi_def_cfa_register(%fp)
37 cfi_register(%o7, %i7)
39 sethi %hi(1047552), %l2
40 ldx [%g4 + 32 + 8], %o0
43 sethi %hi(5120), %l3 /* 160 * 32 */
65 .size _dl_runtime_resolve_0, .-_dl_runtime_resolve_0
67 /* %g1: PLT offset loaded by PLT entry
68 * %g4: callers PC, which is PLT1 + 24, therefore we
69 * add 8 to get the address of PLT2 which
70 * is where the magic cookie is stored
72 .globl _dl_runtime_resolve_1
73 .type _dl_runtime_resolve_1, @function
74 _dl_runtime_resolve_1:
78 cfi_def_cfa_register(%fp)
80 cfi_register(%o7, %i7)
93 .size _dl_runtime_resolve_1, .-_dl_runtime_resolve_1
95 /* For the profiling cases we pass in our stack frame
96 * as the base of the La_sparc64_regs, so it looks
105 * %f16 %sp + (31 * 8)
106 * framesize %sp + (32 * 8)
109 .globl _dl_profile_save_regs
110 .type _dl_profile_save_regs, @function
111 _dl_profile_save_regs:
114 stx %l0, [%sp + STACK_BIAS + ( 0 * 8)]
115 stx %l1, [%sp + STACK_BIAS + ( 1 * 8)]
116 stx %l2, [%sp + STACK_BIAS + ( 2 * 8)]
117 stx %l3, [%sp + STACK_BIAS + ( 3 * 8)]
118 stx %l4, [%sp + STACK_BIAS + ( 4 * 8)]
119 stx %l5, [%sp + STACK_BIAS + ( 5 * 8)]
120 stx %l6, [%sp + STACK_BIAS + ( 6 * 8)]
121 stx %l7, [%sp + STACK_BIAS + ( 7 * 8)]
122 stx %i0, [%sp + STACK_BIAS + ( 8 * 8)]
123 stx %i1, [%sp + STACK_BIAS + ( 9 * 8)]
124 stx %i2, [%sp + STACK_BIAS + (10 * 8)]
125 stx %i3, [%sp + STACK_BIAS + (11 * 8)]
126 stx %i4, [%sp + STACK_BIAS + (12 * 8)]
127 stx %i5, [%sp + STACK_BIAS + (13 * 8)]
128 stx %i6, [%sp + STACK_BIAS + (14 * 8)]
129 stx %i7, [%sp + STACK_BIAS + (15 * 8)]
130 std %f0, [%sp + STACK_BIAS + (16 * 8)]
131 std %f2, [%sp + STACK_BIAS + (17 * 8)]
132 std %f4, [%sp + STACK_BIAS + (18 * 8)]
133 std %f6, [%sp + STACK_BIAS + (19 * 8)]
134 std %f8, [%sp + STACK_BIAS + (20 * 8)]
135 std %f10, [%sp + STACK_BIAS + (21 * 8)]
136 std %f12, [%sp + STACK_BIAS + (22 * 8)]
137 std %f14, [%sp + STACK_BIAS + (23 * 8)]
138 std %f16, [%sp + STACK_BIAS + (24 * 8)]
139 std %f18, [%sp + STACK_BIAS + (25 * 8)]
140 std %f20, [%sp + STACK_BIAS + (26 * 8)]
141 std %f22, [%sp + STACK_BIAS + (27 * 8)]
142 std %f24, [%sp + STACK_BIAS + (28 * 8)]
143 std %f26, [%sp + STACK_BIAS + (29 * 8)]
144 std %f28, [%sp + STACK_BIAS + (30 * 8)]
146 std %f30, [%sp + STACK_BIAS + (31 * 8)]
150 .size _dl_profile_save_regs, .-_dl_profile_save_regs
152 /* If we are going to call pltexit, then we must replicate
153 * the caller's stack frame.
154 * %o0: PLT resolved function address
156 .globl _dl_profile_invoke
157 .type _dl_profile_invoke, @function
163 add %l0, (8 * 8), %g1
174 add %fp, STACK_BIAS, %l2
176 add %sp, STACK_BIAS, %l3
187 stx %o0, [%sp + STACK_BIAS + (16 * 8)]
188 stx %o1, [%sp + STACK_BIAS + (17 * 8)]
189 stx %o2, [%sp + STACK_BIAS + (18 * 8)]
190 stx %o3, [%sp + STACK_BIAS + (19 * 8)]
191 std %f0, [%sp + STACK_BIAS + (20 * 8)]
192 std %f2, [%sp + STACK_BIAS + (21 * 8)]
193 std %f4, [%sp + STACK_BIAS + (22 * 8)]
194 std %f8, [%sp + STACK_BIAS + (23 * 8)]
198 add %sp, STACK_BIAS + (24 * 8), %o2
199 call _dl_call_pltexit
200 add %sp, STACK_BIAS + (16 * 8), %o3
202 ldx [%sp + STACK_BIAS + (16 * 8)], %i0
203 ldx [%sp + STACK_BIAS + (17 * 8)], %i1
204 ldx [%sp + STACK_BIAS + (18 * 8)], %i2
205 ldx [%sp + STACK_BIAS + (19 * 8)], %i3
206 ldd [%sp + STACK_BIAS + (20 * 8)], %f0
207 ldd [%sp + STACK_BIAS + (21 * 8)], %f2
208 ldd [%sp + STACK_BIAS + (22 * 8)], %f4
209 ldd [%sp + STACK_BIAS + (23 * 8)], %f8
216 .size _dl_profile_invoke, .-_dl_profile_invoke
218 /* %g1: PLT offset loaded by PLT entry
219 * %g4: callers PC, which is PLT0 + 24, therefore we
220 * add (32 + 8) to get the address of PLT2 which
221 * is where the magic cookie is stored
224 .globl _dl_runtime_profile_0
225 .type _dl_runtime_profile_0, @function
226 _dl_runtime_profile_0:
230 cfi_def_cfa_register(%fp)
232 cfi_register(%o7, %i7)
234 sethi %hi(1047552), %l2
235 ldx [%g4 + 32 + 8], %o0
238 sethi %hi(5120), %l3 /* 160 * 32 */
240 sethi %hi(32768), %l4
260 call _dl_profile_save_regs
263 add %sp, STACK_BIAS, %o3
264 call _dl_profile_fixup
265 add %sp, (STACK_BIAS + (32 * 8)), %o4
267 ldx [%sp + STACK_BIAS + (32 * 8)], %l0
271 call _dl_profile_invoke
279 .size _dl_runtime_profile_0, .-_dl_runtime_profile_0
281 /* %g1: PLT offset loaded by PLT entry
282 * %g4: callers PC, which is PLT1 + 24, therefore we
283 * add 8 to get the address of PLT2 which
284 * is where the magic cookie is stored
286 .globl _dl_runtime_profile_1
287 .type _dl_runtime_profile_1, @function
288 _dl_runtime_profile_1:
292 cfi_def_cfa_register(%fp)
294 cfi_register(%o7, %i7)
306 call _dl_profile_save_regs
309 add %sp, STACK_BIAS, %o3
310 call _dl_profile_fixup
311 add %sp, (STACK_BIAS + (32 * 8)), %o4
313 ldx [%sp + STACK_BIAS + (32 * 8)], %l0
317 call _dl_profile_invoke
325 .size _dl_runtime_resolve_1, .-_dl_runtime_resolve_1