1 /* PLT trampolines. Sparc 64-bit version.
2 Copyright (C) 2005 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25 /* %g1: PLT offset loaded by PLT entry
26 * %g4: callers PC, which is PLT0 + 24, therefore we
27 * add (32 + 8) to get the address of PLT2 which
28 * is where the magic cookie is stored
30 .globl _dl_runtime_resolve_0
31 .type _dl_runtime_resolve_0, @function
32 _dl_runtime_resolve_0:
36 cfi_def_cfa_register(%fp)
38 cfi_register(%o7, %i7)
40 sethi %hi(1047552), %l2
41 ldx [%g4 + 32 + 8], %o0
44 sethi %hi(5120), %l3 /* 160 * 32 */
66 .size _dl_runtime_resolve_0, .-_dl_runtime_resolve_0
68 /* %g1: PLT offset loaded by PLT entry
69 * %g4: callers PC, which is PLT1 + 24, therefore we
70 * add 8 to get the address of PLT2 which
71 * is where the magic cookie is stored
73 .globl _dl_runtime_resolve_1
74 .type _dl_runtime_resolve_1, @function
75 _dl_runtime_resolve_1:
79 cfi_def_cfa_register(%fp)
81 cfi_register(%o7, %i7)
94 .size _dl_runtime_resolve_1, .-_dl_runtime_resolve_1
96 /* For the profiling cases we pass in our stack frame
97 * as the base of the La_sparc64_regs, so it looks
106 * %f16 %sp + (31 * 8)
107 * framesize %sp + (32 * 8)
110 .globl _dl_profile_save_regs
111 .type _dl_profile_save_regs, @function
112 _dl_profile_save_regs:
115 stx %l0, [%sp + STACK_BIAS + ( 0 * 8)]
116 stx %l1, [%sp + STACK_BIAS + ( 1 * 8)]
117 stx %l2, [%sp + STACK_BIAS + ( 2 * 8)]
118 stx %l3, [%sp + STACK_BIAS + ( 3 * 8)]
119 stx %l4, [%sp + STACK_BIAS + ( 4 * 8)]
120 stx %l5, [%sp + STACK_BIAS + ( 5 * 8)]
121 stx %l6, [%sp + STACK_BIAS + ( 6 * 8)]
122 stx %l7, [%sp + STACK_BIAS + ( 7 * 8)]
123 stx %i0, [%sp + STACK_BIAS + ( 8 * 8)]
124 stx %i1, [%sp + STACK_BIAS + ( 9 * 8)]
125 stx %i2, [%sp + STACK_BIAS + (10 * 8)]
126 stx %i3, [%sp + STACK_BIAS + (11 * 8)]
127 stx %i4, [%sp + STACK_BIAS + (12 * 8)]
128 stx %i5, [%sp + STACK_BIAS + (13 * 8)]
129 stx %i6, [%sp + STACK_BIAS + (14 * 8)]
130 stx %i7, [%sp + STACK_BIAS + (15 * 8)]
131 std %f0, [%sp + STACK_BIAS + (16 * 8)]
132 std %f2, [%sp + STACK_BIAS + (17 * 8)]
133 std %f4, [%sp + STACK_BIAS + (18 * 8)]
134 std %f6, [%sp + STACK_BIAS + (19 * 8)]
135 std %f8, [%sp + STACK_BIAS + (20 * 8)]
136 std %f10, [%sp + STACK_BIAS + (21 * 8)]
137 std %f12, [%sp + STACK_BIAS + (22 * 8)]
138 std %f14, [%sp + STACK_BIAS + (23 * 8)]
139 std %f16, [%sp + STACK_BIAS + (24 * 8)]
140 std %f18, [%sp + STACK_BIAS + (25 * 8)]
141 std %f20, [%sp + STACK_BIAS + (26 * 8)]
142 std %f22, [%sp + STACK_BIAS + (27 * 8)]
143 std %f24, [%sp + STACK_BIAS + (28 * 8)]
144 std %f26, [%sp + STACK_BIAS + (29 * 8)]
145 std %f28, [%sp + STACK_BIAS + (30 * 8)]
147 std %f30, [%sp + STACK_BIAS + (31 * 8)]
151 .size _dl_profile_save_regs, .-_dl_profile_save_regs
153 /* If we are going to call pltexit, then we must replicate
154 * the caller's stack frame.
155 * %o0: PLT resolved function address
157 .globl _dl_profile_invoke
158 .type _dl_profile_invoke, @function
172 add %fp, STACK_BIAS, %l2
173 add %sp, STACK_BIAS, %l3
184 stx %o0, [%sp + STACK_BIAS + (16 * 8)]
185 stx %o1, [%sp + STACK_BIAS + (17 * 8)]
186 stx %o2, [%sp + STACK_BIAS + (18 * 8)]
187 stx %o3, [%sp + STACK_BIAS + (19 * 8)]
188 std %f0, [%sp + STACK_BIAS + (20 * 8)]
189 std %f2, [%sp + STACK_BIAS + (21 * 8)]
190 std %f4, [%sp + STACK_BIAS + (22 * 8)]
191 std %f8, [%sp + STACK_BIAS + (23 * 8)]
196 add %sp, STACK_BIAS + (16 * 8), %o3
197 call _dl_call_pltexit
198 add %o2, STACK_BIAS, %o2
200 ldx [%sp + STACK_BIAS + (16 * 8)], %i0
201 ldx [%sp + STACK_BIAS + (17 * 8)], %i1
202 ldx [%sp + STACK_BIAS + (18 * 8)], %i2
203 ldx [%sp + STACK_BIAS + (19 * 8)], %i3
210 .size _dl_profile_invoke, .-_dl_profile_invoke
212 /* %g1: PLT offset loaded by PLT entry
213 * %g4: callers PC, which is PLT0 + 24, therefore we
214 * add (32 + 8) to get the address of PLT2 which
215 * is where the magic cookie is stored
218 .globl _dl_runtime_profile_0
219 .type _dl_runtime_profile_0, @function
220 _dl_runtime_profile_0:
226 1: save %sp, -336, %sp
227 cfi_def_cfa_register(%fp)
229 cfi_register(%o7, %i7)
231 sethi %hi(1047552), %l2
232 ldx [%g4 + 32 + 8], %o0
235 sethi %hi(5120), %l3 /* 160 * 32 */
237 sethi %hi(32768), %l4
258 call _dl_profile_save_regs
261 add %sp, STACK_BIAS, %o3
262 call _dl_profile_fixup
263 add %sp, (STACK_BIAS + (32 * 8)), %o4
265 ldx [%sp + STACK_BIAS + (32 * 8)], %o1
269 call _dl_profile_invoke
277 .size _dl_runtime_profile_0, .-_dl_runtime_profile_0
279 /* %g1: PLT offset loaded by PLT entry
280 * %g4: callers PC, which is PLT1 + 24, therefore we
281 * add 8 to get the address of PLT2 which
282 * is where the magic cookie is stored
284 .globl _dl_runtime_profile_1
285 .type _dl_runtime_profile_1, @function
286 _dl_runtime_profile_1:
292 1: save %sp, -336, %sp
293 cfi_def_cfa_register(%fp)
295 cfi_register(%o7, %i7)
308 call _dl_profile_save_regs
311 add %sp, STACK_BIAS, %o3
312 call _dl_profile_fixup
313 add %sp, (STACK_BIAS + (32 * 8)), %o4
315 ldx [%sp + STACK_BIAS + (32 * 8)], %o1
319 call _dl_profile_invoke
327 .size _dl_runtime_resolve_1, .-_dl_runtime_resolve_1