]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/ldso/ldso/frv/resolve.S
Inital import
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / ldso / ldso / frv / resolve.S
1 /* Copyright (C) 2003 Red Hat, Inc.
2  * Contributed by Alexandre Oliva <aoliva@redhat.com>
3  *
4  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
5  */
6
7      /* The function below is tail-called by resolver stubs when a
8         lazily-bound function is called.  It must preserve all
9         registers that could be used to pass arguments to the actual
10         function.  Upon _dl_linux_resolve entry, GR14 holds the
11         address of a lazy PLT entry, so @(GR14,-4) is the lazy
12         relocation number that we have to pass to _dl_linux_resolver.
13         GR15 holds the caller's GOT, from which we extract the
14         elf_resolve* that _dl_linux_resolver needs as well.
15
16         _dl_linux_resolver() figures out where the jump symbol is
17         _really_ supposed to have jumped to and returns that to us.
18         Once we have that, we prepare to tail-call the actual
19         function, clean up after ourselves, restoring the original
20         arguments, then jump to the fixed up address.  */
21
22         .text
23         .p2align 4
24
25         .hidden _dl_linux_resolve
26         .global _dl_linux_resolve
27         .type   _dl_linux_resolve,@function
28
29 _dl_linux_resolve:
30         /* Preserve arguments.  */
31         addi    sp, -8*4, sp
32         stdi    gr8, @(sp, 8)
33         stdi    gr10, @(sp, 16)
34         stdi    gr12, @(sp, 24)
35         movsg   lr,gr8
36         st      gr8, @(sp,gr0)
37
38         /* Prepare to call _dl_linux_resolver.  */
39         ldi     @(gr15, 8), gr8
40         ldi     @(gr14, -4), gr9
41         mov.p   gr5, gr15
42         call    _dl_linux_resolver
43
44         /* Move aside return value that contains the FUNCDESC_VALUE.  */
45         ldd     @(gr8,gr0),gr14
46
47         /* Restore arguments.  */
48         ld      @(sp, gr0), gr8
49         movgs   gr8,lr
50         lddi    @(sp, 24), gr12
51         lddi    @(sp, 16), gr10
52         lddi    @(sp, 8), gr8
53         addi    sp, 8*4, sp
54
55         /* Now jump to the actual function.  */
56         jmpl    @(gr14, gr0)
57         .size   _dl_linux_resolve, . - _dl_linux_resolve