OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [ldso/] [ldso/] [sh/] [resolve.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/*
2
 * Stolen from glibc-2.2.2 by Eddie C. Dost 
3
 */
4
 
5
        .text
6
        .globl  _dl_linux_resolver
7
        .globl  _dl_linux_resolve
8
        .type   _dl_linux_resolve, @function
9
        .balign 16
10
_dl_linux_resolve:
11
        mov.l   r3, @-r15
12
        mov.l   r4, @-r15
13
        mov.l   r5, @-r15
14
        mov.l   r6, @-r15
15
        mov.l   r7, @-r15
16
        mov.l   r12, @-r15
17
        movt    r3              ! Save T flag
18
        mov.l   r3, @-r15
19
 
20
#ifdef HAVE_FPU
21
        sts.l   fpscr, @-r15
22
        mov     #8,r3
23
        swap.w  r3, r3
24
        lds     r3, fpscr
25
        fmov.s  fr11, @-r15
26
        fmov.s  fr10, @-r15
27
        fmov.s  fr9, @-r15
28
        fmov.s  fr8, @-r15
29
        fmov.s  fr7, @-r15
30
        fmov.s  fr6, @-r15
31
        fmov.s  fr5, @-r15
32
        fmov.s  fr4, @-r15
33
#endif
34
        sts.l   pr, @-r15
35
/* Note - The PLT entries have been "optimised" not to use r2.  r2 is used by
36
   GCC to return the address of large structures, so it should not be
37
   corrupted here.  This does mean however, that those PLTs does not conform
38
   to the SH PIC ABI.  That spec says that r0 contains the type of the PLT
39
   and r2 contains the GOT id.  The GNU Plt version stores the GOT id in r0 and
40
   ignores the type.  We can easily detect this difference however,
41
   since the type will always be 0 or 8, and the GOT ids will always be
42
   greater than or equal to 12.
43
 
44
   Found in binutils/bfd/elf32-sh.c by Stefan Allius 
45
 */
46
        mov     #8 ,r5
47
        cmp/gt  r5, r0
48
        bt      1f
49
        mov     r2, r0          ! link map address in r2 (SH PIC ABI)
50
1:
51
        mov     r0, r4          ! link map address in r0 (GNUs PLT)
52
        mova    .LG, r0
53
        mov.l   .LG, r5
54
        add     r5, r0
55
        mov.l   3f, r5
56
        mov.l   @(r0, r5),r5
57
        jsr     @r5
58
         mov    r1, r5          ! Reloc offset
59
 
60
        lds.l   @r15+, pr       ! Get register content back
61
 
62
#ifdef HAVE_FPU
63
        fmov.s  @r15+, fr4
64
        fmov.s  @r15+, fr5
65
        fmov.s  @r15+, fr6
66
        fmov.s  @r15+, fr7
67
        fmov.s  @r15+, fr8
68
        fmov.s  @r15+, fr9
69
        fmov.s  @r15+, fr10
70
        fmov.s  @r15+, fr11
71
        lds.l   @r15+, fpscr
72
#endif
73
 
74
        mov.l   @r15+, r3
75
        shal    r3              ! Load T flag
76
        mov.l   @r15+, r12
77
        mov.l   @r15+, r7
78
        mov.l   @r15+, r6
79
        mov.l   @r15+, r5
80
        mov.l   @r15+, r4
81
        jmp     @r0             ! Jump to function address
82
         mov.l  @r15+, r3
83
 
84
        .balign 4
85
 
86
3:
87
        .long   _dl_linux_resolver@GOT
88
.LG:
89
        .long   _GLOBAL_OFFSET_TABLE_
90
        .size   _dl_linux_resolve, . - _dl_linux_resolve
91
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.