]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/ldso/ldso/sh64/resolve.S
Inital import
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / ldso / ldso / sh64 / resolve.S
1 /* vi: set sw=8 ts=8: */
2 /*
3  * ldso/ldso/sh64/resolve.S
4  *
5  * SuperH (sh64) dynamic resolver support
6  *
7  * Copyright (C) 2003  Paul Mundt <lethal@linux-sh.org>
8  *
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. The name of the above contributors may not be
17  *    used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  */
32
33         .section .text..SHmedia32,"ax"
34         .globl  _dl_linux_resolver
35         .globl  _dl_linux_resolve
36         .type   _dl_linux_resolve, @function
37
38         .balign 16
39 _dl_linux_resolve:
40         addi    r15, -72, r15           ! make room on the stack
41         pt      _dl_linux_resolver, tr0
42         st.q    r15, 0, r2              ! save regs
43         st.q    r15, 8, r3
44         st.q    r15, 16, r4
45         st.q    r15, 24, r5
46         st.q    r15, 32, r6
47         st.q    r15, 40, r7
48         st.q    r15, 48, r8
49         st.q    r15, 56, r9
50         st.q    r15, 64, r18
51
52 #ifdef HAVE_FPU
53         addi    r15, -48, r15           ! make room for FP regs
54         fst.d   r15, 0, dr0             ! save FP regs
55         fst.d   r15, 8, dr2
56         fst.d   r15, 16, dr4
57         fst.d   r15, 24, dr6
58         fst.d   r15, 32, dr8
59         fst.d   r15, 40, dr10
60 #endif
61
62         /*
63          * Args for _dl_linux_resolver(), set in r17/r21 by PLT code
64          */
65
66         add     r17, r63, r2            ! link map address
67         add     r21, r63, r3            ! GOT offset
68         blink   tr0, r18                ! call _dl_linux_resolver()
69         ptabs/l r2, tr0                 ! save result = addr of function called
70
71 #ifdef HAVE_FPU
72         fld.d   r15, 0, dr0             ! restore FP regs
73         fld.d   r15, 8, dr2
74         fld.d   r15, 16, dr4
75         fld.d   r15, 24, dr6
76         fld.d   r15, 32, dr8
77         fld.d   r15, 40, dr10
78         addi    r15, 48, r15
79 #endif
80
81         ld.q    r15, 0, r2              ! restore regs
82         ld.q    r15, 8, r3
83         ld.q    r15, 16, r4
84         ld.q    r15, 24, r5
85         ld.q    r15, 32, r6
86         ld.q    r15, 40, r7
87         ld.q    r15, 48, r8
88         ld.q    r15, 56, r9
89         ld.q    r15, 64, r18
90
91         addi    r15, 72, r15
92         blink   tr0, r63                ! jump to function address
93
94         .size   _dl_linux_resolve, . - _dl_linux_resolve
95