OSDN Git Service

902cd8238f8dbf9bef59fe8e22f77557987396a4
[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, write to the Free
18    Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19    Boston, MA 02110-1301, USA.  */
20
21 #define MIN_FRAME_SIZE 32
22
23 #ifdef __XTENSA_EB__
24 #define XTENSA_IMM12_FLD_OFFSET 8
25 #else /* __XTENSA_EL__ */
26 #define XTENSA_IMM12_FLD_OFFSET 12
27 #endif /* __XTENSA_EL__ */
28
29         .text
30         .align  4
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