|
Packit |
6c4009 |
/* PLT trampolines. Sparc 64-bit 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 |
.text
|
|
Packit |
6c4009 |
.align 32
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* %g1: PLT offset loaded by PLT entry
|
|
Packit |
6c4009 |
* %g4: callers PC, which is PLT0 + 24, therefore we
|
|
Packit |
6c4009 |
* add (32 + 8) to get the address of PLT2 which
|
|
Packit |
6c4009 |
* is where the magic cookie is stored
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
.globl _dl_runtime_resolve_0
|
|
Packit |
6c4009 |
.type _dl_runtime_resolve_0, @function
|
|
Packit |
6c4009 |
_dl_runtime_resolve_0:
|
|
Packit |
6c4009 |
cfi_startproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
save %sp, -192, %sp
|
|
Packit |
6c4009 |
cfi_def_cfa_register(%fp)
|
|
Packit |
6c4009 |
cfi_window_save
|
|
Packit |
6c4009 |
cfi_register(%o7, %i7)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
sethi %hi(1047552), %l2
|
|
Packit |
6c4009 |
ldx [%g4 + 32 + 8], %o0
|
|
Packit |
6c4009 |
sub %g1, %g4, %l0
|
|
Packit |
6c4009 |
xor %l2, -1016, %l2
|
|
Packit |
6c4009 |
sethi %hi(5120), %l3 /* 160 * 32 */
|
|
Packit |
6c4009 |
add %l0, %l2, %l0
|
|
Packit |
6c4009 |
sethi %hi(32768), %l4
|
|
Packit |
6c4009 |
udivx %l0, %l3, %l3
|
|
Packit |
6c4009 |
sllx %l3, 2, %l1
|
|
Packit |
6c4009 |
add %l1, %l3, %l1
|
|
Packit |
6c4009 |
sllx %l1, 10, %l2
|
|
Packit |
6c4009 |
sub %l4, 4, %l4
|
|
Packit |
6c4009 |
sllx %l1, 5, %l1
|
|
Packit |
6c4009 |
sub %l0, %l2, %l0
|
|
Packit |
6c4009 |
udivx %l0, 24, %l0
|
|
Packit |
6c4009 |
add %l0, %l4, %l0
|
|
Packit |
6c4009 |
add %l1, %l0, %l1
|
|
Packit |
6c4009 |
add %l1, %l1, %l0
|
|
Packit |
6c4009 |
add %l0, %l1, %l0
|
|
Packit |
6c4009 |
call _dl_fixup
|
|
Packit |
6c4009 |
sllx %l0, 3, %o1
|
|
Packit |
6c4009 |
jmp %o0
|
|
Packit |
6c4009 |
restore
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
cfi_endproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.size _dl_runtime_resolve_0, .-_dl_runtime_resolve_0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* %g1: PLT offset loaded by PLT entry
|
|
Packit |
6c4009 |
* %g4: callers PC, which is PLT1 + 24, therefore we
|
|
Packit |
6c4009 |
* add 8 to get the address of PLT2 which
|
|
Packit |
6c4009 |
* is where the magic cookie is stored
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
.globl _dl_runtime_resolve_1
|
|
Packit |
6c4009 |
.type _dl_runtime_resolve_1, @function
|
|
Packit |
6c4009 |
_dl_runtime_resolve_1:
|
|
Packit |
6c4009 |
cfi_startproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
save %sp, -192, %sp
|
|
Packit |
6c4009 |
cfi_def_cfa_register(%fp)
|
|
Packit |
6c4009 |
cfi_window_save
|
|
Packit |
6c4009 |
cfi_register(%o7, %i7)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
srlx %g1, 12, %o1
|
|
Packit |
6c4009 |
ldx [%g4 + 8], %o0
|
|
Packit |
6c4009 |
add %o1, %o1, %o3
|
|
Packit |
6c4009 |
sub %o1, 96, %o1
|
|
Packit |
6c4009 |
call _dl_fixup
|
|
Packit |
6c4009 |
add %o1, %o3, %o1
|
|
Packit |
6c4009 |
jmp %o0
|
|
Packit |
6c4009 |
restore
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
cfi_endproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.size _dl_runtime_resolve_1, .-_dl_runtime_resolve_1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* For the profiling cases we pass in our stack frame
|
|
Packit |
6c4009 |
* as the base of the La_sparc64_regs, so it looks
|
|
Packit |
6c4009 |
* like:
|
|
Packit |
6c4009 |
* %l0 %sp
|
|
Packit |
6c4009 |
* ...
|
|
Packit |
6c4009 |
* %l7 %sp + (7 * 8)
|
|
Packit |
6c4009 |
* %i0 %sp + (8 * 8)
|
|
Packit |
6c4009 |
* ...
|
|
Packit |
6c4009 |
* %i7 %sp + (15 * 8)
|
|
Packit |
6c4009 |
* %f0 %sp + (16 * 8)
|
|
Packit |
6c4009 |
* %f16 %sp + (31 * 8)
|
|
Packit |
6c4009 |
* framesize %sp + (32 * 8)
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.globl _dl_profile_save_regs
|
|
Packit |
6c4009 |
.type _dl_profile_save_regs, @function
|
|
Packit |
6c4009 |
_dl_profile_save_regs:
|
|
Packit |
6c4009 |
cfi_startproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
stx %l0, [%sp + STACK_BIAS + ( 0 * 8)]
|
|
Packit |
6c4009 |
stx %l1, [%sp + STACK_BIAS + ( 1 * 8)]
|
|
Packit |
6c4009 |
stx %l2, [%sp + STACK_BIAS + ( 2 * 8)]
|
|
Packit |
6c4009 |
stx %l3, [%sp + STACK_BIAS + ( 3 * 8)]
|
|
Packit |
6c4009 |
stx %l4, [%sp + STACK_BIAS + ( 4 * 8)]
|
|
Packit |
6c4009 |
stx %l5, [%sp + STACK_BIAS + ( 5 * 8)]
|
|
Packit |
6c4009 |
stx %l6, [%sp + STACK_BIAS + ( 6 * 8)]
|
|
Packit |
6c4009 |
stx %l7, [%sp + STACK_BIAS + ( 7 * 8)]
|
|
Packit |
6c4009 |
stx %i0, [%sp + STACK_BIAS + ( 8 * 8)]
|
|
Packit |
6c4009 |
stx %i1, [%sp + STACK_BIAS + ( 9 * 8)]
|
|
Packit |
6c4009 |
stx %i2, [%sp + STACK_BIAS + (10 * 8)]
|
|
Packit |
6c4009 |
stx %i3, [%sp + STACK_BIAS + (11 * 8)]
|
|
Packit |
6c4009 |
stx %i4, [%sp + STACK_BIAS + (12 * 8)]
|
|
Packit |
6c4009 |
stx %i5, [%sp + STACK_BIAS + (13 * 8)]
|
|
Packit |
6c4009 |
stx %i6, [%sp + STACK_BIAS + (14 * 8)]
|
|
Packit |
6c4009 |
stx %i7, [%sp + STACK_BIAS + (15 * 8)]
|
|
Packit |
6c4009 |
std %f0, [%sp + STACK_BIAS + (16 * 8)]
|
|
Packit |
6c4009 |
std %f2, [%sp + STACK_BIAS + (17 * 8)]
|
|
Packit |
6c4009 |
std %f4, [%sp + STACK_BIAS + (18 * 8)]
|
|
Packit |
6c4009 |
std %f6, [%sp + STACK_BIAS + (19 * 8)]
|
|
Packit |
6c4009 |
std %f8, [%sp + STACK_BIAS + (20 * 8)]
|
|
Packit |
6c4009 |
std %f10, [%sp + STACK_BIAS + (21 * 8)]
|
|
Packit |
6c4009 |
std %f12, [%sp + STACK_BIAS + (22 * 8)]
|
|
Packit |
6c4009 |
std %f14, [%sp + STACK_BIAS + (23 * 8)]
|
|
Packit |
6c4009 |
std %f16, [%sp + STACK_BIAS + (24 * 8)]
|
|
Packit |
6c4009 |
std %f18, [%sp + STACK_BIAS + (25 * 8)]
|
|
Packit |
6c4009 |
std %f20, [%sp + STACK_BIAS + (26 * 8)]
|
|
Packit |
6c4009 |
std %f22, [%sp + STACK_BIAS + (27 * 8)]
|
|
Packit |
6c4009 |
std %f24, [%sp + STACK_BIAS + (28 * 8)]
|
|
Packit |
6c4009 |
std %f26, [%sp + STACK_BIAS + (29 * 8)]
|
|
Packit |
6c4009 |
std %f28, [%sp + STACK_BIAS + (30 * 8)]
|
|
Packit |
6c4009 |
retl
|
|
Packit |
6c4009 |
std %f30, [%sp + STACK_BIAS + (31 * 8)]
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
cfi_endproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.size _dl_profile_save_regs, .-_dl_profile_save_regs
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* If we are going to call pltexit, then we must replicate
|
|
Packit |
6c4009 |
* the caller's stack frame.
|
|
Packit |
6c4009 |
* %o0: PLT resolved function address
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
.globl _dl_profile_invoke
|
|
Packit |
6c4009 |
.type _dl_profile_invoke, @function
|
|
Packit |
6c4009 |
_dl_profile_invoke:
|
|
Packit |
6c4009 |
cfi_startproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
add %l0, 7, %l0
|
|
Packit |
6c4009 |
andn %l0, 7, %l0
|
|
Packit |
6c4009 |
add %l0, (8 * 8), %g1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
sub %sp, %g1, %sp
|
|
Packit |
6c4009 |
srlx %l0, 3, %l7
|
|
Packit |
6c4009 |
mov %o0, %l1
|
|
Packit |
6c4009 |
mov %i0, %o0
|
|
Packit |
6c4009 |
mov %i1, %o1
|
|
Packit |
6c4009 |
mov %i2, %o2
|
|
Packit |
6c4009 |
mov %i3, %o3
|
|
Packit |
6c4009 |
mov %i4, %o4
|
|
Packit |
6c4009 |
mov %i5, %o5
|
|
Packit |
6c4009 |
add %fp, STACK_BIAS, %l2
|
|
Packit |
6c4009 |
brz %l0, 2f
|
|
Packit |
6c4009 |
add %sp, STACK_BIAS, %l3
|
|
Packit |
6c4009 |
1: ldx [%l2], %l4
|
|
Packit |
6c4009 |
add %l2, 0x8, %l2
|
|
Packit |
6c4009 |
subcc %l7, 1, %l7
|
|
Packit |
6c4009 |
stx %l4, [%l3]
|
|
Packit |
6c4009 |
bne,pt %xcc, 1b
|
|
Packit |
6c4009 |
add %l3, 0x8, %l3
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
2: jmpl %l1, %o7
|
|
Packit |
6c4009 |
nop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
stx %o0, [%sp + STACK_BIAS + (16 * 8)]
|
|
Packit |
6c4009 |
stx %o1, [%sp + STACK_BIAS + (17 * 8)]
|
|
Packit |
6c4009 |
stx %o2, [%sp + STACK_BIAS + (18 * 8)]
|
|
Packit |
6c4009 |
stx %o3, [%sp + STACK_BIAS + (19 * 8)]
|
|
Packit |
6c4009 |
std %f0, [%sp + STACK_BIAS + (20 * 8)]
|
|
Packit |
6c4009 |
std %f2, [%sp + STACK_BIAS + (21 * 8)]
|
|
Packit |
6c4009 |
std %f4, [%sp + STACK_BIAS + (22 * 8)]
|
|
Packit |
6c4009 |
std %f8, [%sp + STACK_BIAS + (23 * 8)]
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
mov %l5, %o0
|
|
Packit |
6c4009 |
mov %l6, %o1
|
|
Packit |
6c4009 |
add %sp, STACK_BIAS + (24 * 8), %o2
|
|
Packit |
6c4009 |
call _dl_call_pltexit
|
|
Packit |
6c4009 |
add %sp, STACK_BIAS + (16 * 8), %o3
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ldx [%sp + STACK_BIAS + (16 * 8)], %i0
|
|
Packit |
6c4009 |
ldx [%sp + STACK_BIAS + (17 * 8)], %i1
|
|
Packit |
6c4009 |
ldx [%sp + STACK_BIAS + (18 * 8)], %i2
|
|
Packit |
6c4009 |
ldx [%sp + STACK_BIAS + (19 * 8)], %i3
|
|
Packit |
6c4009 |
ldd [%sp + STACK_BIAS + (20 * 8)], %f0
|
|
Packit |
6c4009 |
ldd [%sp + STACK_BIAS + (21 * 8)], %f2
|
|
Packit |
6c4009 |
ldd [%sp + STACK_BIAS + (22 * 8)], %f4
|
|
Packit |
6c4009 |
ldd [%sp + STACK_BIAS + (23 * 8)], %f8
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
jmpl %i7 + 8, %g0
|
|
Packit |
6c4009 |
restore
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
cfi_endproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.size _dl_profile_invoke, .-_dl_profile_invoke
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* %g1: PLT offset loaded by PLT entry
|
|
Packit |
6c4009 |
* %g4: callers PC, which is PLT0 + 24, therefore we
|
|
Packit |
6c4009 |
* add (32 + 8) to get the address of PLT2 which
|
|
Packit |
6c4009 |
* is where the magic cookie is stored
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
.align 32
|
|
Packit |
6c4009 |
.globl _dl_runtime_profile_0
|
|
Packit |
6c4009 |
.type _dl_runtime_profile_0, @function
|
|
Packit |
6c4009 |
_dl_runtime_profile_0:
|
|
Packit |
6c4009 |
cfi_startproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
save %sp, -336, %sp
|
|
Packit |
6c4009 |
cfi_def_cfa_register(%fp)
|
|
Packit |
6c4009 |
cfi_window_save
|
|
Packit |
6c4009 |
cfi_register(%o7, %i7)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
sethi %hi(1047552), %l2
|
|
Packit |
6c4009 |
ldx [%g4 + 32 + 8], %o0
|
|
Packit |
6c4009 |
sub %g1, %g4, %l0
|
|
Packit |
6c4009 |
xor %l2, -1016, %l2
|
|
Packit |
6c4009 |
sethi %hi(5120), %l3 /* 160 * 32 */
|
|
Packit |
6c4009 |
add %l0, %l2, %l0
|
|
Packit |
6c4009 |
sethi %hi(32768), %l4
|
|
Packit |
6c4009 |
udivx %l0, %l3, %l3
|
|
Packit |
6c4009 |
sllx %l3, 2, %l1
|
|
Packit |
6c4009 |
add %l1, %l3, %l1
|
|
Packit |
6c4009 |
sllx %l1, 10, %l2
|
|
Packit |
6c4009 |
sub %l4, 4, %l4
|
|
Packit |
6c4009 |
sllx %l1, 5, %l1
|
|
Packit |
6c4009 |
sub %l0, %l2, %l0
|
|
Packit |
6c4009 |
udivx %l0, 24, %l0
|
|
Packit |
6c4009 |
add %l0, %l4, %l0
|
|
Packit |
6c4009 |
add %l1, %l0, %l1
|
|
Packit |
6c4009 |
add %l1, %l1, %l0
|
|
Packit |
6c4009 |
add %l0, %l1, %l0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
mov %i7, %o2
|
|
Packit |
6c4009 |
sllx %l0, 3, %o1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
mov %o0, %l5
|
|
Packit |
6c4009 |
mov %o1, %l6
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
call _dl_profile_save_regs
|
|
Packit |
6c4009 |
nop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
add %sp, STACK_BIAS, %o3
|
|
Packit |
6c4009 |
call _dl_profile_fixup
|
|
Packit |
6c4009 |
add %sp, (STACK_BIAS + (32 * 8)), %o4
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ldx [%sp + STACK_BIAS + (32 * 8)], %l0
|
|
Packit |
6c4009 |
brlz,pt %l0, 1f
|
|
Packit |
6c4009 |
nop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
call _dl_profile_invoke
|
|
Packit |
6c4009 |
nop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
1: jmp %o0
|
|
Packit |
6c4009 |
restore
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
cfi_endproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.size _dl_runtime_profile_0, .-_dl_runtime_profile_0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* %g1: PLT offset loaded by PLT entry
|
|
Packit |
6c4009 |
* %g4: callers PC, which is PLT1 + 24, therefore we
|
|
Packit |
6c4009 |
* add 8 to get the address of PLT2 which
|
|
Packit |
6c4009 |
* is where the magic cookie is stored
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
.globl _dl_runtime_profile_1
|
|
Packit |
6c4009 |
.type _dl_runtime_profile_1, @function
|
|
Packit |
6c4009 |
_dl_runtime_profile_1:
|
|
Packit |
6c4009 |
cfi_startproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
save %sp, -336, %sp
|
|
Packit |
6c4009 |
cfi_def_cfa_register(%fp)
|
|
Packit |
6c4009 |
cfi_window_save
|
|
Packit |
6c4009 |
cfi_register(%o7, %i7)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
srlx %g1, 12, %o1
|
|
Packit |
6c4009 |
ldx [%g4 + 8], %o0
|
|
Packit |
6c4009 |
add %o1, %o1, %o3
|
|
Packit |
6c4009 |
sub %o1, 96, %o1
|
|
Packit |
6c4009 |
mov %i7, %o2
|
|
Packit |
6c4009 |
add %o1, %o3, %o1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
mov %o0, %l5
|
|
Packit |
6c4009 |
mov %o1, %l6
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
call _dl_profile_save_regs
|
|
Packit |
6c4009 |
nop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
add %sp, STACK_BIAS, %o3
|
|
Packit |
6c4009 |
call _dl_profile_fixup
|
|
Packit |
6c4009 |
add %sp, (STACK_BIAS + (32 * 8)), %o4
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ldx [%sp + STACK_BIAS + (32 * 8)], %l0
|
|
Packit |
6c4009 |
brlz,pt %l0, 1f
|
|
Packit |
6c4009 |
nop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
call _dl_profile_invoke
|
|
Packit |
6c4009 |
nop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
1: jmp %o0
|
|
Packit |
6c4009 |
restore
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
cfi_endproc
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.size _dl_runtime_resolve_1, .-_dl_runtime_resolve_1
|