]>
Commit | Line | Data |
---|---|---|
404a4e2f | 1 | /* PLT trampolines. Sparc 32-bit version. |
568035b7 | 2 | Copyright (C) 2005-2013 Free Software Foundation, Inc. |
404a4e2f RM |
3 | This file is part of the GNU C Library. |
4 | ||
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. | |
9 | ||
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. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
404a4e2f RM |
18 | |
19 | #include <sysdep.h> | |
20 | ||
21 | .text | |
22 | .align 32 | |
23 | ||
24 | /* %g1: PLT offset loaded by PLT entry | |
25 | * %g2: callers PC, which is PLT0 + 4, and we store the | |
26 | * link map at PLT0 + 12, therefore we add 8 to get | |
27 | * the address of the link map | |
28 | */ | |
29 | .globl _dl_runtime_resolve | |
30 | .type _dl_runtime_resolve, @function | |
31 | _dl_runtime_resolve: | |
043cee37 RM |
32 | cfi_startproc |
33 | ||
404a4e2f | 34 | save %sp, -104, %sp |
043cee37 RM |
35 | cfi_def_cfa_register(%fp) |
36 | cfi_window_save | |
37 | cfi_register (%o7, %i7) | |
38 | ||
404a4e2f RM |
39 | ld [%g2 + 8], %o0 |
40 | srl %g1, 10, %o1 | |
41 | call _dl_fixup | |
42 | sub %o1, 4*12, %o1 | |
43 | jmp %o0 | |
44 | restore | |
043cee37 RM |
45 | |
46 | cfi_endproc | |
47 | ||
404a4e2f RM |
48 | .size _dl_runtime_resolve, .-_dl_runtime_resolve |
49 | ||
50 | /* For the profiling cases we pass in our stack frame | |
2d2cd515 | 51 | * as the base of the La_sparc32_regs, so it looks |
404a4e2f | 52 | * like: |
2d2cd515 DM |
53 | * %l0 %sp + (0 * 8) |
54 | * %l1 %sp + (0 * 8) + 4 | |
404a4e2f | 55 | * ... |
2d2cd515 DM |
56 | * %l6 %sp + (3 * 8) |
57 | * %l7 %sp + (3 * 8) + 4 | |
58 | * %i0 %sp + (4 * 8) | |
59 | * %i1 %sp + (4 * 8) + 4 | |
404a4e2f | 60 | * ... |
2d2cd515 DM |
61 | * %i6 %sp + (7 * 8) |
62 | * %i7 %sp + (7 * 8) + 4 | |
63 | * struct_ret_ptr %sp + (8 * 8) | |
64 | * framesize %sp + (9 * 8) | |
404a4e2f RM |
65 | */ |
66 | ||
67 | .globl _dl_profile_save_regs | |
68 | .type _dl_profile_save_regs, @function | |
69 | _dl_profile_save_regs: | |
043cee37 RM |
70 | cfi_startproc |
71 | ||
404a4e2f RM |
72 | std %l0, [%sp + ( 0 * 8)] |
73 | std %l2, [%sp + ( 1 * 8)] | |
74 | std %l4, [%sp + ( 2 * 8)] | |
75 | std %l6, [%sp + ( 3 * 8)] | |
76 | std %i0, [%sp + ( 4 * 8)] | |
77 | std %i2, [%sp + ( 5 * 8)] | |
78 | std %i4, [%sp + ( 6 * 8)] | |
79 | std %i6, [%sp + ( 7 * 8)] | |
2d2cd515 | 80 | ld [%fp + (8 * 8)], %l4 |
404a4e2f RM |
81 | retl |
82 | st %l4, [%sp + (8 * 8)] | |
043cee37 RM |
83 | |
84 | cfi_endproc | |
85 | ||
404a4e2f RM |
86 | .size _dl_profile_save_regs, .-_dl_profile_save_regs |
87 | ||
88 | /* If we are going to call pltexit, then we must replicate | |
89 | * the caller's stack frame. | |
90 | * %o0: PLT resolved function address | |
91 | */ | |
92 | .globl _dl_profile_invoke | |
93 | .type _dl_profile_invoke, @function | |
94 | _dl_profile_invoke: | |
043cee37 RM |
95 | cfi_startproc |
96 | ||
2d2cd515 DM |
97 | add %l0, 7, %l0 |
98 | andn %l0, 7, %l0 | |
99 | add %l0, 2 * 8, %g1 | |
100 | ||
101 | sub %sp, %g1, %sp | |
404a4e2f RM |
102 | srl %l0, 3, %l7 |
103 | mov %o0, %l1 | |
104 | mov %i0, %o0 | |
105 | mov %i1, %o1 | |
106 | mov %i2, %o2 | |
107 | mov %i3, %o3 | |
108 | mov %i4, %o4 | |
109 | mov %i5, %o5 | |
2d2cd515 | 110 | cmp %l0, 0 |
404a4e2f | 111 | mov %fp, %l2 |
2d2cd515 DM |
112 | be 2f |
113 | add %sp, (11 * 8), %l3 | |
404a4e2f RM |
114 | 1: ldd [%l2], %g2 |
115 | add %l2, 0x8, %l2 | |
116 | subcc %l7, 1, %l7 | |
e638c1a2 | 117 | std %g2, [%l3] |
404a4e2f RM |
118 | bne 1b |
119 | add %l3, 0x8, %l3 | |
120 | ||
2d2cd515 | 121 | 2: jmpl %l1, %o7 |
404a4e2f RM |
122 | nop |
123 | ||
124 | std %o0, [%sp + ( 9 * 8)] | |
125 | std %f0, [%sp + (10 * 8)] | |
126 | ||
127 | mov %l5, %o0 | |
128 | mov %l6, %o1 | |
2d2cd515 | 129 | add %sp, (11 * 8), %o2 |
404a4e2f | 130 | call _dl_call_pltexit |
2d2cd515 | 131 | add %sp, ( 9 * 8), %o3 |
404a4e2f | 132 | |
2d2cd515 DM |
133 | ldd [%sp + ( 9 * 8)], %i0 |
134 | ldd [%sp + (10 * 8)], %f0 | |
404a4e2f RM |
135 | |
136 | jmpl %i7 + 8, %g0 | |
137 | restore | |
138 | ||
043cee37 RM |
139 | cfi_endproc |
140 | ||
141 | .size _dl_profile_invoke, .-_dl_profile_invoke | |
142 | ||
404a4e2f RM |
143 | /* %g1: PLT offset loaded by PLT entry |
144 | * %g2: callers PC, which is PLT0 + 4, and we store the | |
145 | * link map at PLT0 + 12, therefore we add 8 to get | |
146 | * the address of the link map | |
147 | */ | |
148 | .align 32 | |
149 | .globl _dl_runtime_profile | |
150 | .type _dl_runtime_profile, @function | |
151 | _dl_runtime_profile: | |
043cee37 RM |
152 | cfi_startproc |
153 | ||
2d2cd515 | 154 | save %sp, -104, %sp |
043cee37 RM |
155 | cfi_def_cfa_register(%fp) |
156 | cfi_window_save | |
157 | cfi_register(%o7, %i7) | |
158 | ||
404a4e2f RM |
159 | ld [%g2 + 8], %o0 |
160 | srl %g1, 10, %o1 | |
161 | mov %i7, %o2 | |
162 | sub %o1, 4*12, %o1 | |
163 | ||
404a4e2f RM |
164 | mov %o0, %l5 |
165 | mov %o1, %l6 | |
166 | ||
2d2cd515 | 167 | call _dl_profile_save_regs |
404a4e2f RM |
168 | nop |
169 | ||
170 | mov %sp, %o3 | |
171 | call _dl_profile_fixup | |
172 | add %sp, (9 * 8), %o4 | |
173 | ||
2d2cd515 DM |
174 | ld [%sp + (9 * 8)], %l0 |
175 | cmp %l0, 0 | |
176 | bl 1f | |
404a4e2f RM |
177 | nop |
178 | ||
179 | call _dl_profile_invoke | |
180 | nop | |
181 | ||
182 | 1: jmp %o0 | |
183 | restore | |
043cee37 RM |
184 | |
185 | cfi_endproc | |
186 | ||
404a4e2f | 187 | .size _dl_runtime_profile, .-_dl_runtime_profile |