OSDN Git Service

61c2c5d4263da6d4bc2d0053f0672e6212bf43cf
[uclinux-h8/uClibc.git] / 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         .global _dl_linux_resolve
31         .type   _dl_linux_resolve, @function
32 _dl_linux_resolve:
33         /* Fix up the high 2 bits of the return address.  */
34         movi    a13, 0f
35         slli    a12, a0, 2
36 0:      extui   a13, a13, 30, 2
37         ssai    2
38         src     a12, a13, a12
39
40         /* Call the fixup function.  */
41         movi    a8, _dl_linux_resolver
42         callx8  a8
43
44         /* Extract the target's frame size from the ENTRY instruction.  */
45         l32i    a11, a10, 0
46         extui   a11, a11, XTENSA_IMM12_FLD_OFFSET, 12
47         slli    a11, a11, 3
48
49         addi    a11, a11, -MIN_FRAME_SIZE
50         sub     a11, sp, a11
51         movsp   sp, a11
52
53         /* Jump to the next instruction past the ENTRY.  */
54         addi    a10, a10, 3
55         jx      a10
56         .size   _dl_linux_resolve, . - _dl_linux_resolve