1 /* PLT trampolines. Alpha version.
2 Copyright (C) 2005-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
23 .macro savei regno, offset
24 stq $\regno, \offset($30)
25 cfi_rel_offset(\regno, \offset)
28 .macro savef regno, offset
29 stt $f\regno, \offset($30)
30 cfi_rel_offset(\regno+32, \offset)
34 .globl _dl_runtime_resolve_new
35 .ent _dl_runtime_resolve_new
38 #define FRAMESIZE 14*8
40 _dl_runtime_resolve_new:
41 .frame $30, FRAMESIZE, $26, 0
44 ldah $29, 0($27) !gpdisp!1
45 lda $30, -FRAMESIZE($30)
50 lda $29, 0($29) !gpdisp!1
52 mov $28, $16 /* link_map from .got.plt */
55 mov $25, $17 /* offset of reloc entry */
57 mov $26, $18 /* return address */
69 bsr $26, _dl_fixup !samegp
85 lda $30, FRAMESIZE($30)
87 .end _dl_runtime_resolve_new
89 .globl _dl_runtime_profile_new
90 .type _dl_runtime_profile_new, @function
94 #define FRAMESIZE 20*8
96 /* We save the registers in a different order than desired by
97 .mask/.fmask, so we have to use explicit cfi directives. */
100 _dl_runtime_profile_new:
101 ldah $29, 0($27) !gpdisp!2
102 lda $30, -FRAMESIZE($30)
107 lda $29, 0($29) !gpdisp!2
109 lda $1, FRAMESIZE($30) /* incoming sp value */
114 mov $28, $16 /* link_map from .got.plt */
117 mov $25, $17 /* offset of reloc entry */
119 mov $26, $18 /* return address */
122 mov $30, $19 /* La_alpha_regs address */
124 lda $20, 14*8($30) /* framesize address */
132 bsr $26, _dl_profile_fixup !samegp
135 /* Discover if we're wrapping this call. */
152 lda $30, FRAMESIZE($30)
156 /* Create a frame pointer and allocate a new argument frame. */
159 cfi_def_cfa_register (15)
164 /* Save the call destination around memcpy. */
167 /* Copy the stack arguments into place. */
169 lda $17, FRAMESIZE($15)
173 /* Reload the argument registers. */
191 /* Set up for call to _dl_audit_pltexit. */
200 bsr $26, _dl_audit_pltexit !samegp
203 cfi_def_cfa_register (30)
206 lda $30, FRAMESIZE($30)
210 .size _dl_runtime_profile_new, .-_dl_runtime_profile_new
214 .globl _dl_runtime_resolve_old
215 .ent _dl_runtime_resolve_old
218 #define FRAMESIZE 44*8
220 _dl_runtime_resolve_old:
221 lda $30, -FRAMESIZE($30)
222 .frame $30, FRAMESIZE, $26
223 /* Preserve all registers that C normally doesn't. */
268 .mask 0x27ff01ff, -FRAMESIZE
269 .fmask 0xfffffc03, -FRAMESIZE+21*8
274 /* Set up the arguments for _dl_fixup:
275 $16 = link_map out of plt0
276 $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24
284 bsr $26, _dl_fixup !samegp
286 /* Move the destination address into position. */
288 /* Restore program registers. */
333 /* Flush the Icache after having modified the .plt code. */
335 /* Clean up and turn control to the destination */
336 lda $30, FRAMESIZE($30)
339 .end _dl_runtime_resolve_old
341 .globl _dl_runtime_profile_old
342 .usepv _dl_runtime_profile_old, no
343 .type _dl_runtime_profile_old, @function
346 /* We save the registers in a different order than desired by
347 .mask/.fmask, so we have to use explicit cfi directives. */
351 #define FRAMESIZE 50*8
354 _dl_runtime_profile_old:
355 lda $30, -FRAMESIZE($30)
356 cfi_adjust_cfa_offset (FRAMESIZE)
358 /* Preserve all argument registers. This also constructs the
359 La_alpha_regs structure. */
367 lda $16, FRAMESIZE($30)
376 /* Preserve all registers that C normally doesn't. */
413 /* Set up the arguments for _dl_profile_fixup:
414 $16 = link_map out of plt0
415 $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24
417 $19 = La_alpha_regs address
418 $20 = framesize address
430 bsr $26, _dl_profile_fixup !samegp
432 /* Discover if we're wrapping this call. */
436 /* Move the destination address into position. */
438 /* Restore program registers. */
484 /* Clean up and turn control to the destination. */
485 lda $30, FRAMESIZE($30)
489 /* Create a frame pointer and allocate a new argument frame. */
492 cfi_def_cfa_register (15)
497 /* Save the call destination around memcpy. */
500 /* Copy the stack arguments into place. */
502 lda $17, FRAMESIZE($15)
506 /* Reload the argument registers. */
524 /* Set up for call to _dl_audit_pltexit. */
533 bsr $26, _dl_audit_pltexit !samegp
536 cfi_def_cfa_register (30)
539 lda $30, FRAMESIZE($30)
543 .size _dl_runtime_profile_old, .-_dl_runtime_profile_old