|
Packit |
6c4009 |
/* PLT trampolines. m68k version.
|
|
Packit |
6c4009 |
Copyright (C) 2005-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library. If not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <sysdep.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if !defined (__mcoldfire__)
|
|
Packit |
6c4009 |
# define FMOVE fmove.x
|
|
Packit |
6c4009 |
# define FPSPACE 12
|
|
Packit |
6c4009 |
#elif defined (__mcffpu__)
|
|
Packit |
6c4009 |
# define FMOVE fmove.d
|
|
Packit |
6c4009 |
# define FPSPACE 8
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define FPSPACE 0
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.text
|
|
Packit |
6c4009 |
.globl _dl_runtime_resolve
|
|
Packit |
6c4009 |
.type _dl_runtime_resolve, @function
|
|
Packit |
6c4009 |
_dl_runtime_resolve:
|
|
Packit |
6c4009 |
cfi_startproc
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (8)
|
|
Packit |
6c4009 |
| Save %a0 (struct return address) and %a1.
|
|
Packit |
6c4009 |
move.l %a0, -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
move.l %a1, -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
| Call the real address resolver.
|
|
Packit |
6c4009 |
jbsr _dl_fixup
|
|
Packit |
6c4009 |
| Restore register %a0 and %a1.
|
|
Packit |
6c4009 |
move.l (%sp)+, %a1
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
move.l (%sp)+, %a0
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
| Pop parameters
|
|
Packit |
6c4009 |
addq.l #8, %sp
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-8)
|
|
Packit |
6c4009 |
| Call real function.
|
|
Packit |
6c4009 |
#ifdef __mcoldfire__
|
|
Packit |
6c4009 |
move.l %d0,-(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
rts
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
jmp (%d0)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
cfi_endproc
|
|
Packit |
6c4009 |
.size _dl_runtime_resolve, . - _dl_runtime_resolve
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.text
|
|
Packit |
6c4009 |
.globl _dl_runtime_profile
|
|
Packit |
6c4009 |
.type _dl_runtime_profile, @function
|
|
Packit |
6c4009 |
_dl_runtime_profile:
|
|
Packit |
6c4009 |
cfi_startproc
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (8)
|
|
Packit |
6c4009 |
pea 8(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
move.l %a1, -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
move.l %a0, -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
pea -1.w
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
| Push parameters for _dl_profile_fixup
|
|
Packit |
6c4009 |
pea (%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
pea 8(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
move.l 32(%sp), -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
move.l 32(%sp), -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
move.l 32(%sp), -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
subq.l #8, %sp
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (8)
|
|
Packit |
6c4009 |
| Call the real address resolver.
|
|
Packit |
6c4009 |
jbsr _dl_profile_fixup
|
|
Packit |
6c4009 |
| Pop parameters
|
|
Packit |
6c4009 |
lea 28(%sp), %sp
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-28)
|
|
Packit |
6c4009 |
move.l (%sp), %d1
|
|
Packit |
6c4009 |
jpl 1f
|
|
Packit |
6c4009 |
addq.l #4, %sp
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
| Restore register %a0 and %a1.
|
|
Packit |
6c4009 |
move.l (%sp)+, %a0
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
move.l (%sp)+, %a1
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
lea 12(%sp), %sp
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-12)
|
|
Packit |
6c4009 |
| Call real function.
|
|
Packit |
6c4009 |
#ifdef __mcoldfire__
|
|
Packit |
6c4009 |
move.l %d0,-(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
rts
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
jmp (%d0)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
+24 return address
|
|
Packit |
6c4009 |
+20 PLT1
|
|
Packit |
6c4009 |
+16 PLT2
|
|
Packit |
6c4009 |
+12 %sp
|
|
Packit |
6c4009 |
+8 %a1
|
|
Packit |
6c4009 |
+4 %a0
|
|
Packit |
6c4009 |
%sp free
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
#ifdef __mcoldfire__
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (20)
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (24)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
1: move.l %a2, (%sp)
|
|
Packit |
6c4009 |
cfi_rel_offset (%a2, 0)
|
|
Packit |
6c4009 |
move.l %sp, %a2
|
|
Packit |
6c4009 |
move.l %sp, %a0
|
|
Packit |
6c4009 |
lea 28(%sp), %a1
|
|
Packit |
6c4009 |
| Round framesize up to longword alignment
|
|
Packit |
6c4009 |
addq.l #3, %d1
|
|
Packit |
6c4009 |
and.l #-3, %d1
|
|
Packit |
6c4009 |
sub.l %d1, %a0
|
|
Packit |
6c4009 |
move.l %a0, %sp
|
|
Packit |
6c4009 |
cfi_def_cfa_register (%a2)
|
|
Packit |
6c4009 |
#ifdef __mcoldfire__
|
|
Packit |
6c4009 |
tst.l %d1
|
|
Packit |
6c4009 |
beq 2f
|
|
Packit |
6c4009 |
1: move.l (%a1)+, (%a0)+
|
|
Packit |
6c4009 |
subq.l #4,%d1
|
|
Packit |
6c4009 |
bne 1b
|
|
Packit |
6c4009 |
2:
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
lsr.l #2,%d1
|
|
Packit |
6c4009 |
jra 2f
|
|
Packit |
6c4009 |
1: move.l (%a1)+, (%a0)+
|
|
Packit |
6c4009 |
2: dbra %d1,1b
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
%a2+24 return address
|
|
Packit |
6c4009 |
%a2+20 PLT1
|
|
Packit |
6c4009 |
%a2+16 PLT2
|
|
Packit |
6c4009 |
%a2+12 %sp
|
|
Packit |
6c4009 |
%a2+8 %a1
|
|
Packit |
6c4009 |
%a2+4 %a0
|
|
Packit |
6c4009 |
%a2 %a2
|
|
Packit |
6c4009 |
%sp copied stack frame
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
move.l 4(%a2), %a0
|
|
Packit |
6c4009 |
move.l 8(%a2), %a1
|
|
Packit |
6c4009 |
#ifdef __mcoldfire__
|
|
Packit |
6c4009 |
pea 2f(%pc)
|
|
Packit |
6c4009 |
move.l %d0,-(%sp)
|
|
Packit |
6c4009 |
rts
|
|
Packit |
6c4009 |
2:
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
jsr (%d0)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
move.l %a2, %sp
|
|
Packit |
6c4009 |
cfi_def_cfa_register (%sp)
|
|
Packit |
6c4009 |
move.l (%sp)+, %a2
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
cfi_restore (%a2)
|
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
+20 return address
|
|
Packit |
6c4009 |
+16 PLT1
|
|
Packit |
6c4009 |
+12 PLT2
|
|
Packit |
6c4009 |
+8 %sp
|
|
Packit |
6c4009 |
+4 %a1
|
|
Packit |
6c4009 |
%sp %a0
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
#ifdef FMOVE
|
|
Packit |
6c4009 |
FMOVE %fp0, -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (FPSPACE)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
move.l %a0, -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
move.l %d1, -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
move.l %d0, -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
pea (%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
pea (16+FPSPACE)(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
move.l (32+FPSPACE)(%sp), -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
move.l (32+FPSPACE)(%sp), -(%sp)
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4)
|
|
Packit |
6c4009 |
jbsr _dl_call_pltexit
|
|
Packit |
6c4009 |
lea 16(%sp), %sp
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-16)
|
|
Packit |
6c4009 |
move.l (%sp)+, %d0
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
move.l (%sp)+, %d1
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
move.l (%sp)+, %a0
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4)
|
|
Packit |
6c4009 |
#ifdef FMOVE
|
|
Packit |
6c4009 |
FMOVE (%sp)+, %fp0
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-FPSPACE)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
lea 20(%sp), %sp
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-20)
|
|
Packit |
6c4009 |
rts
|
|
Packit |
6c4009 |
cfi_endproc
|
|
Packit |
6c4009 |
.size _dl_runtime_profile, . - _dl_runtime_profile
|