| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544 |
- /* PLT trampolines. Alpha version.
- Copyright (C) 2005-2026 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <https://www.gnu.org/licenses/>. */
- #include <sysdep.h>
- .set noat
- .macro savei regno, offset
- stq $\regno, \offset($30)
- cfi_rel_offset(\regno, \offset)
- .endm
- .macro savef regno, offset
- stt $f\regno, \offset($30)
- cfi_rel_offset(\regno+32, \offset)
- .endm
- .align 4
- .globl _dl_runtime_resolve_new
- .ent _dl_runtime_resolve_new
- #undef FRAMESIZE
- #define FRAMESIZE 14*8
- _dl_runtime_resolve_new:
- .frame $30, FRAMESIZE, $26, 0
- .mask 0x4000000, 0
- ldah $29, 0($27) !gpdisp!1
- lda $30, -FRAMESIZE($30)
- stq $26, 0*8($30)
- stq $16, 2*8($30)
- stq $17, 3*8($30)
- lda $29, 0($29) !gpdisp!1
- stq $18, 4*8($30)
- mov $28, $16 /* link_map from .got.plt */
- stq $19, 5*8($30)
- mov $25, $17 /* offset of reloc entry */
- stq $20, 6*8($30)
- mov $26, $18 /* return address */
- stq $21, 7*8($30)
- stt $f16, 8*8($30)
- stt $f17, 9*8($30)
- stt $f18, 10*8($30)
- stt $f19, 11*8($30)
- stt $f20, 12*8($30)
- stt $f21, 13*8($30)
- .prologue 2
- bsr $26, _dl_fixup !samegp
- mov $0, $27
- ldq $26, 0*8($30)
- ldq $16, 2*8($30)
- ldq $17, 3*8($30)
- ldq $18, 4*8($30)
- ldq $19, 5*8($30)
- ldq $20, 6*8($30)
- ldq $21, 7*8($30)
- ldt $f16, 8*8($30)
- ldt $f17, 9*8($30)
- ldt $f18, 10*8($30)
- ldt $f19, 11*8($30)
- ldt $f20, 12*8($30)
- ldt $f21, 13*8($30)
- lda $30, FRAMESIZE($30)
- jmp $31, ($27), 0
- .end _dl_runtime_resolve_new
- .globl _dl_runtime_profile_new
- .type _dl_runtime_profile_new, @function
- #ifdef SHARED
- #undef FRAMESIZE
- #define FRAMESIZE 20*8
- /* We save the registers in a different order than desired by
- .mask/.fmask, so we have to use explicit cfi directives. */
- cfi_startproc
- _dl_runtime_profile_new:
- ldah $29, 0($27) !gpdisp!2
- lda $30, -FRAMESIZE($30)
- savei 26, 0*8
- stq $16, 2*8($30)
- stq $17, 3*8($30)
- lda $29, 0($29) !gpdisp!2
- stq $18, 4*8($30)
- lda $1, FRAMESIZE($30) /* incoming sp value */
- stq $1, 1*8($30)
- stq $19, 5*8($30)
- stq $20, 6*8($30)
- mov $28, $16 /* link_map from .got.plt */
- stq $21, 7*8($30)
- mov $25, $17 /* offset of reloc entry */
- stt $f16, 8*8($30)
- mov $26, $18 /* return address */
- stt $f17, 9*8($30)
- mov $30, $19 /* La_alpha_regs address */
- stt $f18, 10*8($30)
- lda $20, 14*8($30) /* framesize address */
- stt $f19, 11*8($30)
- stt $f20, 12*8($30)
- stt $f21, 13*8($30)
- stq $28, 16*8($30)
- stq $25, 17*8($30)
- bsr $26, _dl_profile_fixup !samegp
- mov $0, $27
- /* Discover if we're wrapping this call. */
- ldq $18, 14*8($30)
- bge $18, 1f
- ldq $26, 0*8($30)
- ldq $16, 2*8($30)
- ldq $17, 3*8($30)
- ldq $18, 4*8($30)
- ldq $19, 5*8($30)
- ldq $20, 6*8($30)
- ldq $21, 7*8($30)
- ldt $f16, 8*8($30)
- ldt $f17, 9*8($30)
- ldt $f18, 10*8($30)
- ldt $f19, 11*8($30)
- ldt $f20, 12*8($30)
- ldt $f21, 13*8($30)
- lda $30, FRAMESIZE($30)
- jmp $31, ($27), 0
- 1:
- /* Create a frame pointer and allocate a new argument frame. */
- savei 15, 15*8
- mov $30, $15
- cfi_def_cfa_register (15)
- addq $18, 15, $18
- bic $18, 15, $18
- subq $30, $18, $30
- /* Save the call destination around memcpy. */
- stq $0, 14*8($30)
- /* Copy the stack arguments into place. */
- lda $16, 0($30)
- lda $17, FRAMESIZE($15)
- jsr $26, memcpy
- ldgp $29, 0($26)
- /* Reload the argument registers. */
- ldq $27, 14*8($30)
- ldq $16, 2*8($15)
- ldq $17, 3*8($15)
- ldq $18, 4*8($15)
- ldq $19, 5*8($15)
- ldq $20, 6*8($15)
- ldq $21, 7*8($15)
- ldt $f16, 8*8($15)
- ldt $f17, 9*8($15)
- ldt $f18, 10*8($15)
- ldt $f19, 11*8($15)
- ldt $f20, 12*8($15)
- ldt $f21, 13*8($15)
- jsr $26, ($27), 0
- ldgp $29, 0($26)
- /* Set up for call to _dl_audit_pltexit. */
- ldq $16, 16*8($15)
- ldq $17, 17*8($15)
- stq $0, 16*8($15)
- lda $18, 0($15)
- stq $1, 17*8($15)
- lda $19, 16*8($15)
- stt $f0, 18*8($15)
- stt $f1, 19*8($15)
- bsr $26, _dl_audit_pltexit !samegp
- mov $15, $30
- cfi_def_cfa_register (30)
- ldq $26, 0($30)
- ldq $15, 15*8($30)
- lda $30, FRAMESIZE($30)
- ret
- cfi_endproc
- .size _dl_runtime_profile_new, .-_dl_runtime_profile_new
- #endif /* SHARED */
- .align 4
- .globl _dl_runtime_resolve_old
- .ent _dl_runtime_resolve_old
- #undef FRAMESIZE
- #define FRAMESIZE 44*8
- _dl_runtime_resolve_old:
- lda $30, -FRAMESIZE($30)
- .frame $30, FRAMESIZE, $26
- /* Preserve all registers that C normally doesn't. */
- stq $26, 0*8($30)
- stq $0, 1*8($30)
- stq $1, 2*8($30)
- stq $2, 3*8($30)
- stq $3, 4*8($30)
- stq $4, 5*8($30)
- stq $5, 6*8($30)
- stq $6, 7*8($30)
- stq $7, 8*8($30)
- stq $8, 9*8($30)
- stq $16, 10*8($30)
- stq $17, 11*8($30)
- stq $18, 12*8($30)
- stq $19, 13*8($30)
- stq $20, 14*8($30)
- stq $21, 15*8($30)
- stq $22, 16*8($30)
- stq $23, 17*8($30)
- stq $24, 18*8($30)
- stq $25, 19*8($30)
- stq $29, 20*8($30)
- stt $f0, 21*8($30)
- stt $f1, 22*8($30)
- stt $f10, 23*8($30)
- stt $f11, 24*8($30)
- stt $f12, 25*8($30)
- stt $f13, 26*8($30)
- stt $f14, 27*8($30)
- stt $f15, 28*8($30)
- stt $f16, 29*8($30)
- stt $f17, 30*8($30)
- stt $f18, 31*8($30)
- stt $f19, 32*8($30)
- stt $f20, 33*8($30)
- stt $f21, 34*8($30)
- stt $f22, 35*8($30)
- stt $f23, 36*8($30)
- stt $f24, 37*8($30)
- stt $f25, 38*8($30)
- stt $f26, 39*8($30)
- stt $f27, 40*8($30)
- stt $f28, 41*8($30)
- stt $f29, 42*8($30)
- stt $f30, 43*8($30)
- .mask 0x27ff01ff, -FRAMESIZE
- .fmask 0xfffffc03, -FRAMESIZE+21*8
- /* Set up our GP. */
- br $29, .+4
- ldgp $29, 0($29)
- .prologue 0
- /* Set up the arguments for _dl_fixup:
- $16 = link_map out of plt0
- $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24
- $18 = return address
- */
- subq $28, $27, $17
- ldq $16, 8($27)
- subq $17, 20, $17
- mov $26, $18
- addq $17, $17, $17
- bsr $26, _dl_fixup !samegp
- /* Move the destination address into position. */
- mov $0, $27
- /* Restore program registers. */
- ldq $26, 0*8($30)
- ldq $0, 1*8($30)
- ldq $1, 2*8($30)
- ldq $2, 3*8($30)
- ldq $3, 4*8($30)
- ldq $4, 5*8($30)
- ldq $5, 6*8($30)
- ldq $6, 7*8($30)
- ldq $7, 8*8($30)
- ldq $8, 9*8($30)
- ldq $16, 10*8($30)
- ldq $17, 11*8($30)
- ldq $18, 12*8($30)
- ldq $19, 13*8($30)
- ldq $20, 14*8($30)
- ldq $21, 15*8($30)
- ldq $22, 16*8($30)
- ldq $23, 17*8($30)
- ldq $24, 18*8($30)
- ldq $25, 19*8($30)
- ldq $29, 20*8($30)
- ldt $f0, 21*8($30)
- ldt $f1, 22*8($30)
- ldt $f10, 23*8($30)
- ldt $f11, 24*8($30)
- ldt $f12, 25*8($30)
- ldt $f13, 26*8($30)
- ldt $f14, 27*8($30)
- ldt $f15, 28*8($30)
- ldt $f16, 29*8($30)
- ldt $f17, 30*8($30)
- ldt $f18, 31*8($30)
- ldt $f19, 32*8($30)
- ldt $f20, 33*8($30)
- ldt $f21, 34*8($30)
- ldt $f22, 35*8($30)
- ldt $f23, 36*8($30)
- ldt $f24, 37*8($30)
- ldt $f25, 38*8($30)
- ldt $f26, 39*8($30)
- ldt $f27, 40*8($30)
- ldt $f28, 41*8($30)
- ldt $f29, 42*8($30)
- ldt $f30, 43*8($30)
- /* Flush the Icache after having modified the .plt code. */
- imb
- /* Clean up and turn control to the destination */
- lda $30, FRAMESIZE($30)
- jmp $31, ($27)
- .end _dl_runtime_resolve_old
- .globl _dl_runtime_profile_old
- .usepv _dl_runtime_profile_old, no
- .type _dl_runtime_profile_old, @function
- #ifdef SHARED
- /* We save the registers in a different order than desired by
- .mask/.fmask, so we have to use explicit cfi directives. */
- cfi_startproc
- #undef FRAMESIZE
- #define FRAMESIZE 50*8
- .align 4
- _dl_runtime_profile_old:
- lda $30, -FRAMESIZE($30)
- cfi_adjust_cfa_offset (FRAMESIZE)
- /* Preserve all argument registers. This also constructs the
- La_alpha_regs structure. */
- savei 26, 0*8
- savei 16, 2*8
- savei 17, 3*8
- savei 18, 4*8
- savei 19, 5*8
- savei 20, 6*8
- savei 21, 7*8
- lda $16, FRAMESIZE($30)
- savef 16, 8*8
- savef 17, 9*8
- savef 18, 10*8
- savef 19, 11*8
- savef 20, 12*8
- savef 21, 13*8
- stq $16, 1*8($30)
- /* Preserve all registers that C normally doesn't. */
- savei 0, 14*8
- savei 1, 15*8
- savei 2, 16*8
- savei 3, 17*8
- savei 4, 18*8
- savei 5, 19*8
- savei 6, 20*8
- savei 7, 21*8
- savei 8, 22*8
- savei 22, 23*8
- savei 23, 24*8
- savei 24, 25*8
- savei 25, 26*8
- savei 29, 27*8
- savef 0, 28*8
- savef 1, 29*8
- savef 10, 30*8
- savef 11, 31*8
- savef 12, 32*8
- savef 13, 33*8
- savef 14, 34*8
- savef 15, 35*8
- savef 22, 36*8
- savef 23, 37*8
- savef 24, 38*8
- savef 25, 39*8
- savef 26, 40*8
- savef 27, 41*8
- savef 28, 42*8
- savef 29, 43*8
- savef 30, 44*8
- /* Set up our GP. */
- br $29, .+4
- ldgp $29, 0($29)
- /* Set up the arguments for _dl_profile_fixup:
- $16 = link_map out of plt0
- $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24
- $18 = return address
- $19 = La_alpha_regs address
- $20 = framesize address
- */
- subq $28, $27, $17
- ldq $16, 8($27)
- subq $17, 20, $17
- mov $26, $18
- addq $17, $17, $17
- lda $19, 0($30)
- lda $20, 45*8($30)
- stq $16, 48*8($30)
- stq $17, 49*8($30)
- bsr $26, _dl_profile_fixup !samegp
- /* Discover if we're wrapping this call. */
- ldq $18, 45*8($30)
- bge $18, 1f
- /* Move the destination address into position. */
- mov $0, $27
- /* Restore program registers. */
- ldq $26, 0*8($30)
- ldq $16, 2*8($30)
- ldq $17, 3*8($30)
- ldq $18, 4*8($30)
- ldq $19, 5*8($30)
- ldq $20, 6*8($30)
- ldq $21, 7*8($30)
- ldt $f16, 8*8($30)
- ldt $f17, 9*8($30)
- ldt $f18, 10*8($30)
- ldt $f19, 11*8($30)
- ldt $f20, 12*8($30)
- ldt $f21, 13*8($30)
- ldq $0, 14*8($30)
- ldq $1, 15*8($30)
- ldq $2, 16*8($30)
- ldq $3, 17*8($30)
- ldq $4, 18*8($30)
- ldq $5, 19*8($30)
- ldq $6, 20*8($30)
- ldq $7, 21*8($30)
- ldq $8, 22*8($30)
- ldq $22, 23*8($30)
- ldq $23, 24*8($30)
- ldq $24, 25*8($30)
- ldq $25, 26*8($30)
- ldq $29, 27*8($30)
- ldt $f0, 28*8($30)
- ldt $f1, 29*8($30)
- ldt $f10, 30*8($30)
- ldt $f11, 31*8($30)
- ldt $f12, 32*8($30)
- ldt $f13, 33*8($30)
- ldt $f14, 34*8($30)
- ldt $f15, 35*8($30)
- ldt $f22, 36*8($30)
- ldt $f23, 37*8($30)
- ldt $f24, 38*8($30)
- ldt $f25, 39*8($30)
- ldt $f26, 40*8($30)
- ldt $f27, 41*8($30)
- ldt $f28, 42*8($30)
- ldt $f29, 43*8($30)
- ldt $f30, 44*8($30)
- /* Clean up and turn control to the destination. */
- lda $30, FRAMESIZE($30)
- jmp $31, ($27)
- 1:
- /* Create a frame pointer and allocate a new argument frame. */
- savei 15, 45*8
- mov $30, $15
- cfi_def_cfa_register (15)
- addq $18, 15, $18
- bic $18, 15, $18
- subq $30, $18, $30
- /* Save the call destination around memcpy. */
- stq $0, 46*8($30)
- /* Copy the stack arguments into place. */
- lda $16, 0($30)
- lda $17, FRAMESIZE($15)
- jsr $26, memcpy
- ldgp $29, 0($26)
- /* Reload the argument registers. */
- ldq $27, 46*8($30)
- ldq $16, 2*8($15)
- ldq $17, 3*8($15)
- ldq $18, 4*8($15)
- ldq $19, 5*8($15)
- ldq $20, 6*8($15)
- ldq $21, 7*8($15)
- ldt $f16, 8*8($15)
- ldt $f17, 9*8($15)
- ldt $f18, 10*8($15)
- ldt $f19, 11*8($15)
- ldt $f20, 12*8($15)
- ldt $f21, 13*8($15)
- jsr $26, ($27), 0
- ldgp $29, 0($26)
- /* Set up for call to _dl_audit_pltexit. */
- ldq $16, 48*8($15)
- ldq $17, 49*8($15)
- stq $0, 46*8($15)
- lda $18, 0($15)
- stq $1, 47*8($15)
- lda $19, 46*8($15)
- stt $f0, 48*8($15)
- stt $f1, 49*8($15)
- bsr $26, _dl_audit_pltexit !samegp
- mov $15, $30
- cfi_def_cfa_register (30)
- ldq $26, 0($30)
- ldq $15, 45*8($30)
- lda $30, FRAMESIZE($30)
- ret
- cfi_endproc
- .size _dl_runtime_profile_old, .-_dl_runtime_profile_old
- #endif /* SHARED */
|