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:
34 sethi %hi(1047552), %l2
35 ldx [%g4 + 32 + 8], %o0
38 sethi %hi(5120), %l3 /* 160 * 32 */
57 .size _dl_runtime_resolve_0, .-_dl_runtime_resolve_0
59 /* %g1: PLT offset loaded by PLT entry
60 * %g4: callers PC, which is PLT1 + 24, therefore we
61 * add 8 to get the address of PLT2 which
62 * is where the magic cookie is stored
64 .globl _dl_runtime_resolve_1
65 .type _dl_runtime_resolve_1, @function
66 _dl_runtime_resolve_1:
76 .size _dl_runtime_resolve_1, .-_dl_runtime_resolve_1
78 /* For the profiling cases we pass in our stack frame
79 * as the base of the La_sparc64_regs, so it looks
89 * framesize %sp + (32 * 8)
92 .globl _dl_profile_save_regs
93 .type _dl_profile_save_regs, @function
94 _dl_profile_save_regs:
95 stx %l0, [%sp + STACK_BIAS + ( 0 * 8)]
96 stx %l1, [%sp + STACK_BIAS + ( 1 * 8)]
97 stx %l2, [%sp + STACK_BIAS + ( 2 * 8)]
98 stx %l3, [%sp + STACK_BIAS + ( 3 * 8)]
99 stx %l4, [%sp + STACK_BIAS + ( 4 * 8)]
100 stx %l5, [%sp + STACK_BIAS + ( 5 * 8)]
101 stx %l6, [%sp + STACK_BIAS + ( 6 * 8)]
102 stx %l7, [%sp + STACK_BIAS + ( 7 * 8)]
103 stx %i0, [%sp + STACK_BIAS + ( 8 * 8)]
104 stx %i1, [%sp + STACK_BIAS + ( 9 * 8)]
105 stx %i2, [%sp + STACK_BIAS + (10 * 8)]
106 stx %i3, [%sp + STACK_BIAS + (11 * 8)]
107 stx %i4, [%sp + STACK_BIAS + (12 * 8)]
108 stx %i5, [%sp + STACK_BIAS + (13 * 8)]
109 stx %i6, [%sp + STACK_BIAS + (14 * 8)]
110 stx %i7, [%sp + STACK_BIAS + (15 * 8)]
111 std %f0, [%sp + STACK_BIAS + (16 * 8)]
112 std %f2, [%sp + STACK_BIAS + (17 * 8)]
113 std %f4, [%sp + STACK_BIAS + (18 * 8)]
114 std %f6, [%sp + STACK_BIAS + (19 * 8)]
115 std %f8, [%sp + STACK_BIAS + (20 * 8)]
116 std %f10, [%sp + STACK_BIAS + (21 * 8)]
117 std %f12, [%sp + STACK_BIAS + (22 * 8)]
118 std %f14, [%sp + STACK_BIAS + (23 * 8)]
119 std %f16, [%sp + STACK_BIAS + (24 * 8)]
120 std %f18, [%sp + STACK_BIAS + (25 * 8)]
121 std %f20, [%sp + STACK_BIAS + (26 * 8)]
122 std %f22, [%sp + STACK_BIAS + (27 * 8)]
123 std %f24, [%sp + STACK_BIAS + (28 * 8)]
124 std %f26, [%sp + STACK_BIAS + (29 * 8)]
125 std %f28, [%sp + STACK_BIAS + (30 * 8)]
127 std %f30, [%sp + STACK_BIAS + (31 * 8)]
128 .size _dl_profile_save_regs, .-_dl_profile_save_regs
130 /* If we are going to call pltexit, then we must replicate
131 * the caller's stack frame.
132 * %o0: PLT resolved function address
134 .globl _dl_profile_invoke
135 .type _dl_profile_invoke, @function
147 add %fp, STACK_BIAS, %l2
148 add %sp, STACK_BIAS, %l3
159 stx %o0, [%sp + STACK_BIAS + (16 * 8)]
160 stx %o1, [%sp + STACK_BIAS + (17 * 8)]
161 stx %o2, [%sp + STACK_BIAS + (18 * 8)]
162 stx %o3, [%sp + STACK_BIAS + (19 * 8)]
163 std %f0, [%sp + STACK_BIAS + (20 * 8)]
164 std %f2, [%sp + STACK_BIAS + (21 * 8)]
165 std %f4, [%sp + STACK_BIAS + (22 * 8)]
166 std %f8, [%sp + STACK_BIAS + (23 * 8)]
171 add %sp, STACK_BIAS + (16 * 8), %o3
172 call _dl_call_pltexit
173 add %o2, STACK_BIAS, %o2
175 ldx [%sp + STACK_BIAS + (16 * 8)], %i0
176 ldx [%sp + STACK_BIAS + (17 * 8)], %i1
177 ldx [%sp + STACK_BIAS + (18 * 8)], %i2
178 ldx [%sp + STACK_BIAS + (19 * 8)], %i3
183 /* %g1: PLT offset loaded by PLT entry
184 * %g4: callers PC, which is PLT0 + 24, therefore we
185 * add (32 + 8) to get the address of PLT2 which
186 * is where the magic cookie is stored
189 .globl _dl_runtime_profile_0
190 .type _dl_runtime_profile_0, @function
191 _dl_runtime_profile_0:
195 1: save %sp, -336, %sp
196 sethi %hi(1047552), %l2
197 ldx [%g4 + 32 + 8], %o0
200 sethi %hi(5120), %l3 /* 160 * 32 */
202 sethi %hi(32768), %l4
223 call _dl_profile_save_regs
226 add %sp, STACK_BIAS, %o3
227 call _dl_profile_fixup
228 add %sp, (STACK_BIAS + (32 * 8)), %o4
230 ldx [%sp + STACK_BIAS + (32 * 8)], %o1
234 call _dl_profile_invoke
239 .size _dl_runtime_profile_0, .-_dl_runtime_profile_0
241 /* %g1: PLT offset loaded by PLT entry
242 * %g4: callers PC, which is PLT1 + 24, therefore we
243 * add 8 to get the address of PLT2 which
244 * is where the magic cookie is stored
246 .globl _dl_runtime_profile_1
247 .type _dl_runtime_profile_1, @function
248 _dl_runtime_profile_1:
252 1: save %sp, -336, %sp
264 call _dl_profile_save_regs
267 add %sp, STACK_BIAS, %o3
268 call _dl_profile_fixup
269 add %sp, (STACK_BIAS + (32 * 8)), %o4
271 ldx [%sp + STACK_BIAS + (32 * 8)], %o1
275 call _dl_profile_invoke
280 .size _dl_runtime_resolve_1, .-_dl_runtime_resolve_1