* sysdeps/pthread/sigaction.c: Use "" instead of <> to include self,
[glibc.git] / sysdeps / m68k / dl-trampoline.S
blob8791280371e8db4475e1eb52aaec6a81612a554e
1 /* PLT trampolines.  m68k 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
18    02111-1307 USA.  */
20 #include <sysdep.h>
22         .text
23         .globl _dl_runtime_resolve
24         .type _dl_runtime_resolve, @function
25 _dl_runtime_resolve:
26         | Save %a0 (struct return address) and %a1.
27         move.l %a0, -(%sp)
28         move.l %a1, -(%sp)
29         | Call the real address resolver.
30         jbsr _dl_fixup
31         | Restore register %a0 and %a1.
32         move.l (%sp)+, %a1
33         move.l (%sp)+, %a0
34         | Pop parameters
35         addq.l #8, %sp
36         | Call real function.
37         jmp (%d0)
38         .size _dl_runtime_resolve, . - _dl_runtime_resolve
40         .text
41         .globl _dl_runtime_profile
42         .type _dl_runtime_profile, @function
43 _dl_runtime_profile:
44         pea 8(%sp)
45         move.l %a1, -(%sp)
46         move.l %a0, -(%sp)
47         pea -1.w
48         | Push parameters for _dl_profile_fixup
49         pea (%sp)
50         pea 8(%sp)
51         move.l 32(%sp), -(%sp)
52         move.l 32(%sp), -(%sp)
53         move.l 32(%sp), -(%sp)
54         subq.l #8, %sp
55         | Call the real address resolver.
56         jbsr _dl_profile_fixup
57         | Pop parameters
58         lea 28(%sp), %sp
59         move.l (%sp), %d1
60         jpl 1f
61         addq.l #4, %sp
62         | Restore register %a0 and %a1.
63         move.l (%sp)+, %a0
64         move.l (%sp)+, %a1
65         lea 12(%sp), %sp
66         | Call real function.
67         jmp (%d0)
69         /*
70             +24     return address
71             +20     PLT1
72             +16     PLT2
73             +12     %sp
74             +8      %a1
75             +4      %a0
76            %sp      free
77         */
78 1:      move.l %a2, (%sp)
79         move.l %sp, %a2
80         move.l %sp, %a0
81         lea 28(%sp), %a1
82         | Round framesize up to even
83         addq.l #1, %d1
84         lsr #1, %d1
85         sub.l %d1, %a0
86         sub.l %d1, %a0
87         move.l %a0, %sp
88         jra 2f
89 1:      move.w (%a1)+, (%a0)+
90 2:      dbra %d1,1b
91         /*
92            %a2+24  return address
93            %a2+20  PLT1
94            %a2+16  PLT2
95            %a2+12  %sp
96            %a2+8   %a1
97            %a2+4   %a0
98            %a2     %a2
99            %sp     copied stack frame
100         */
102         move.l 4(%a2), %a0
103         move.l 8(%a2), %a1
104         jsr (%d0)
105         move.l %a2, %sp
106         move.l (%sp)+, %a2
107         /*
108             +20     return address
109             +16     PLT1
110             +12     PLT2
111             +8      %sp
112             +4      %a1
113            %sp      %a0
114         */
115         fmove.x %fp0, -(%sp)
116         move.l %d1, -(%sp)
117         move.l %d0, -(%sp)
118         pea (%sp)
119         pea 20(%sp)
120         move.l 40(%sp), -(%sp)
121         move.l 40(%sp), -(%sp)
122         jbsr _dl_call_pltexit
123         lea 16(%sp), %sp
124         move.l (%sp)+, %d0
125         move.l (%sp)+, %d1
126         fmove.x (%sp)+, %fp0
127         lea 20(%sp), %sp
128         rts
129         .size _dl_runtime_profile, . - _dl_runtime_profile