Replace FSF snail mail address with URLs.
[glibc.git] / sysdeps / sparc / sparc32 / dl-trampoline.S
blob79ec79fe9ea9775c72519a9ccc7c2c735aa59d51
1 /* PLT trampolines.  Sparc 32-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, see
17    <http://www.gnu.org/licenses/>.  */
19 #include <sysdep.h>
21         .text
22         .align  32
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:
32         cfi_startproc
34         save    %sp, -104, %sp
35         cfi_def_cfa_register(%fp)
36         cfi_window_save
37         cfi_register (%o7, %i7)
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
46         cfi_endproc
48         .size   _dl_runtime_resolve, .-_dl_runtime_resolve
50         /* For the profiling cases we pass in our stack frame
51          * as the base of the La_sparc64_regs, so it looks
52          * like:
53          *      %l0                     %sp
54          *      ...
55          *      %l7                     %sp + (7 * 8)
56          *      %i0                     %sp + (8 * 8)
57          *      ...
58          *      %i7                     %sp + (15 * 8)
59          *      %f0                     %sp + (16 * 8)
60          *      %f16                    %sp + (31 * 8)
61          *      framesize               %sp + (32 * 8)
62          */
64         .globl  _dl_profile_save_regs
65         .type   _dl_profile_save_regs, @function
66 _dl_profile_save_regs:
67         cfi_startproc
69         std     %l0, [%sp + ( 0 * 8)]
70         std     %l2, [%sp + ( 1 * 8)]
71         std     %l4, [%sp + ( 2 * 8)]
72         std     %l6, [%sp + ( 3 * 8)]
73         std     %i0, [%sp + ( 4 * 8)]
74         std     %i2, [%sp + ( 5 * 8)]
75         std     %i4, [%sp + ( 6 * 8)]
76         std     %i6, [%sp + ( 7 * 8)]
77         ld      [%sp + (8 * 8)], %l4
78         retl
79          st     %l4, [%sp + (8 * 8)]
81         cfi_endproc
83         .size   _dl_profile_save_regs, .-_dl_profile_save_regs
85         /* If we are going to call pltexit, then we must replicate
86          * the caller's stack frame.
87          * %o0: PLT resolved function address
88          */
89         .globl  _dl_profile_invoke
90         .type   _dl_profile_invoke, @function
91 _dl_profile_invoke:
92         cfi_startproc
94         sub     %sp, %l0, %sp
96         srl     %l0, 3, %l7
97         mov     %o0, %l1
98         mov     %i0, %o0
99         mov     %i1, %o1
100         mov     %i2, %o2
101         mov     %i3, %o3
102         mov     %i4, %o4
103         mov     %i5, %o5
104         mov     %fp, %l2
105         mov     %sp, %l3
106 1:      ldd     [%l2], %g2
107         add     %l2, 0x8, %l2
108         subcc   %l7, 1, %l7
109         std     %g2, [%l3]
110         bne     1b
111          add    %l3, 0x8, %l3
113         jmpl    %l1, %o7
114          nop
116         std     %o0, [%sp + ( 9 * 8)]
117         std     %f0, [%sp + (10 * 8)]
119         mov     %l5, %o0
120         mov     %l6, %o1
121         add     %sp, %l0, %o2
122         call    _dl_call_pltexit
123          add    %sp, (16 * 8), %o3
125         ldd     [%sp + (9 * 8)], %i0
127         jmpl    %i7 + 8, %g0
128          restore
130         cfi_endproc
132         .size   _dl_profile_invoke, .-_dl_profile_invoke
134         /* %g1: PLT offset loaded by PLT entry
135          * %g2: callers PC, which is PLT0 + 4, and we store the
136          *      link map at PLT0 + 12, therefore we add 8 to get
137          *      the address of the link map
138          */
139         .align  32
140         .globl  _dl_runtime_profile
141         .type   _dl_runtime_profile, @function
142 _dl_runtime_profile:
143         cfi_startproc
145         cmp     %fp, 0
146         be,a    1f
147          mov    104, %g3
148         sub     %fp, %sp, %g3
149 1:      save    %sp, -104, %sp
150         cfi_def_cfa_register(%fp)
151         cfi_window_save
152         cfi_register(%o7, %i7)
154         ld      [%g2 + 8], %o0
155         srl     %g1, 10, %o1
156         mov     %i7, %o2
157         sub     %o1, 4*12, %o1
159         mov     %g3, %l0
160         mov     %o0, %l5
161         mov     %o1, %l6
163         call _dl_profile_save_regs
164          nop
166         mov     %sp, %o3
167         call    _dl_profile_fixup
168          add    %sp, (9 * 8), %o4
170         ld      [%sp + (9 * 8)], %o1
171         cmp     %o1, 0
172         bgeu    1f
173          nop
174         
175         call    _dl_profile_invoke
176          nop
178 1:      jmp     %o0
179          restore
181         cfi_endproc
183         .size   _dl_runtime_profile, .-_dl_runtime_profile