]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/ldso/ldso/xtensa/resolve.S
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / ldso / ldso / xtensa / resolve.S
1 /* Xtensa dynamic resolver.
2    Parts copied from glibc/sysdeps/xtensa/dl-trampoline.S
3    Copyright (C) 2007 Free Software Foundation, Inc.
4    This file is part of the GNU C Library.
5
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, see
18    <http://www.gnu.org/licenses/>.  */
19
20 #define MIN_FRAME_SIZE 32
21
22 #ifdef __XTENSA_EB__
23 #define XTENSA_IMM12_FLD_OFFSET 8
24 #else /* __XTENSA_EL__ */
25 #define XTENSA_IMM12_FLD_OFFSET 12
26 #endif /* __XTENSA_EL__ */
27
28         .text
29         .align  4
30         .literal_position
31         .global _dl_linux_resolve
32         .type   _dl_linux_resolve, @function
33 _dl_linux_resolve:
34         /* Fix up the high 2 bits of the return address.  */
35         movi    a13, 0f
36         slli    a12, a0, 2
37 0:      extui   a13, a13, 30, 2
38         ssai    2
39         src     a12, a13, a12
40
41         /* Call the fixup function.  */
42         movi    a8, _dl_linux_resolver
43         callx8  a8
44
45         /* Extract the target's frame size from the ENTRY instruction.  */
46         l32i    a11, a10, 0
47         extui   a11, a11, XTENSA_IMM12_FLD_OFFSET, 12
48         slli    a11, a11, 3
49
50         addi    a11, a11, -MIN_FRAME_SIZE
51         sub     a11, sp, a11
52         movsp   sp, a11
53
54         /* Jump to the next instruction past the ENTRY.  */
55         addi    a10, a10, 3
56         jx      a10
57         .size   _dl_linux_resolve, . - _dl_linux_resolve