1 /* PLT trampolines. Alpha version.
2 Copyright (C) 2005-2015 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 <http://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
93 #define FRAMESIZE 20*8
95 /* We save the registers in a different order than desired by
96 .mask/.fmask, so we have to use explicit cfi directives. */
99 _dl_runtime_profile_new:
100 ldah $29, 0($27) !gpdisp!2
101 lda $30, -FRAMESIZE($30)
106 lda $29, 0($29) !gpdisp!2
108 lda $1, FRAMESIZE($30) /* incoming sp value */
113 mov $28, $16 /* link_map from .got.plt */
116 mov $25, $17 /* offset of reloc entry */
118 mov $26, $18 /* return address */
121 mov $30, $19 /* La_alpha_regs address */
123 lda $20, 14*8($30) /* framesize address */
131 bsr $26, _dl_profile_fixup !samegp
134 /* Discover if we're wrapping this call. */
151 lda $30, FRAMESIZE($30)
155 /* Create a frame pointer and allocate a new argument frame. */
158 cfi_def_cfa_register (15)
163 /* Save the call destination around memcpy. */
166 /* Copy the stack arguments into place. */
168 lda $17, FRAMESIZE($15)
172 /* Reload the argument registers. */
190 /* Set up for call to _dl_call_pltexit. */
199 bsr $26, _dl_call_pltexit !samegp
202 cfi_def_cfa_register (30)
205 lda $30, FRAMESIZE($30)
209 .size _dl_runtime_profile_new, .-_dl_runtime_profile_new
212 .globl _dl_runtime_resolve_old
213 .ent _dl_runtime_resolve_old
216 #define FRAMESIZE 44*8
218 _dl_runtime_resolve_old:
219 lda $30, -FRAMESIZE($30)
220 .frame $30, FRAMESIZE, $26
221 /* Preserve all registers that C normally doesn't. */
266 .mask 0x27ff01ff, -FRAMESIZE
267 .fmask 0xfffffc03, -FRAMESIZE+21*8
272 /* Set up the arguments for _dl_fixup:
273 $16 = link_map out of plt0
274 $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24
282 bsr $26, _dl_fixup !samegp
284 /* Move the destination address into position. */
286 /* Restore program registers. */
331 /* Flush the Icache after having modified the .plt code. */
333 /* Clean up and turn control to the destination */
334 lda $30, FRAMESIZE($30)
337 .end _dl_runtime_resolve_old
339 .globl _dl_runtime_profile_old
340 .usepv _dl_runtime_profile_old, no
341 .type _dl_runtime_profile_old, @function
343 /* We save the registers in a different order than desired by
344 .mask/.fmask, so we have to use explicit cfi directives. */
348 #define FRAMESIZE 50*8
351 _dl_runtime_profile_old:
352 lda $30, -FRAMESIZE($30)
353 cfi_adjust_cfa_offset (FRAMESIZE)
355 /* Preserve all argument registers. This also constructs the
356 La_alpha_regs structure. */
364 lda $16, FRAMESIZE($30)
373 /* Preserve all registers that C normally doesn't. */
410 /* Set up the arguments for _dl_profile_fixup:
411 $16 = link_map out of plt0
412 $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24
414 $19 = La_alpha_regs address
415 $20 = framesize address
427 bsr $26, _dl_profile_fixup !samegp
429 /* Discover if we're wrapping this call. */
433 /* Move the destination address into position. */
435 /* Restore program registers. */
481 /* Clean up and turn control to the destination. */
482 lda $30, FRAMESIZE($30)
486 /* Create a frame pointer and allocate a new argument frame. */
489 cfi_def_cfa_register (15)
494 /* Save the call destination around memcpy. */
497 /* Copy the stack arguments into place. */
499 lda $17, FRAMESIZE($15)
503 /* Reload the argument registers. */
521 /* Set up for call to _dl_call_pltexit. */
530 bsr $26, _dl_call_pltexit !samegp
533 cfi_def_cfa_register (30)
536 lda $30, FRAMESIZE($30)
540 .size _dl_runtime_profile_old, .-_dl_runtime_profile_old