]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/ldso/ldso/arc/resolve.S
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / ldso / ldso / arc / resolve.S
1 /*
2  * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
3  *
4  * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
5  */
6
7 #include <sysdep.h>
8 #include <sys/syscall.h>
9
10 ; Save the registers which resolver could possibly clobber
11 ;       r0-r9: args to the function - symbol being resolved
12 ;       r10-r12 are already clobbered by PLTn, PLT0 thus neednot be saved
13
14 .macro  SAVE_CALLER_SAVED
15         push_s  r0
16         push_s  r1
17         push_s  r2
18         push_s  r3
19         st.a    r4, [sp, -4]
20         st.a    r5, [sp, -4]
21         st.a    r6, [sp, -4]
22         st.a    r7, [sp, -4]
23         st.a    r8, [sp, -4]
24         st.a    r9, [sp, -4]
25         push_s  blink
26 .endm
27
28 .macro RESTORE_CALLER_SAVED_BUT_R0
29         ld.ab   blink,[sp, 4]
30         ld.ab   r9, [sp, 4]
31         ld.ab   r8, [sp, 4]
32         ld.ab   r7, [sp, 4]
33         ld.ab   r6, [sp, 4]
34         ld.ab   r5, [sp, 4]
35         ld.ab   r4, [sp, 4]
36         pop_s   r3
37         pop_s   r2
38         pop_s   r1
39 .endm
40
41 ; Upon entry, PLTn, which led us here, sets up the following regs
42 ;       r11 = Module info (tpnt pointer as expected by resolver)
43 ;       r12 = PC of the PLTn itself - needed by resolver to find
44 ;             corresponding .rela.plt entry
45
46 ENTRY(_dl_linux_resolve)
47         ; args to func being resolved, which resolver might clobber
48         SAVE_CALLER_SAVED
49
50         mov_s   r1, r12
51         bl.d    _dl_linux_resolver
52         mov     r0, r11
53
54         RESTORE_CALLER_SAVED_BUT_R0
55         j_s.d   [r0]    ; r0 has resolved function addr
56         pop_s   r0      ; restore first arg to resolved call
57 END(_dl_linux_resolve)