1 /* PLT trampolines. Alpha version.
2 Copyright (C) 2005 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 .macro savei regno, offset
25 stq $\regno, \offset($30)
26 cfi_rel_offset(\regno, \offset)
29 .macro savef regno, offset
30 stt $f\regno, \offset($30)
31 cfi_rel_offset(\regno+32, \offset)
35 .globl _dl_runtime_resolve_new
36 .ent _dl_runtime_resolve_new
39 #define FRAMESIZE 14*8
41 _dl_runtime_resolve_new:
42 .frame $30, FRAMESIZE, $26, 0
45 ldah $29, 0($27) !gpdisp!1
46 lda $30, -FRAMESIZE($30)
51 lda $29, 0($29) !gpdisp!1
53 mov $28, $16 /* link_map from .got.plt */
56 mov $25, $17 /* offset of reloc entry */
58 mov $26, $18 /* return address */
70 bsr $26, _dl_fixup !samegp
86 lda $30, FRAMESIZE($30)
88 .end _dl_runtime_resolve_new
90 .globl _dl_runtime_profile_new
91 .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_call_pltexit. */
200 bsr $26, _dl_call_pltexit !samegp
203 cfi_def_cfa_register (30)
206 lda $30, FRAMESIZE($30)
210 .size _dl_runtime_profile_new, .-_dl_runtime_profile_new
213 .globl _dl_runtime_resolve_old
214 .ent _dl_runtime_resolve_old
217 #define FRAMESIZE 44*8
219 _dl_runtime_resolve_old:
220 lda $30, -FRAMESIZE($30)
221 .frame $30, FRAMESIZE, $26
222 /* Preserve all registers that C normally doesn't. */
267 .mask 0x27ff01ff, -FRAMESIZE
268 .fmask 0xfffffc03, -FRAMESIZE+21*8
273 /* Set up the arguments for _dl_fixup:
274 $16 = link_map out of plt0
275 $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24
283 bsr $26, _dl_fixup !samegp
285 /* Move the destination address into position. */
287 /* Restore program registers. */
332 /* Flush the Icache after having modified the .plt code. */
334 /* Clean up and turn control to the destination */
335 lda $30, FRAMESIZE($30)
338 .end _dl_runtime_resolve_old
340 .globl _dl_runtime_profile_old
341 .usepv _dl_runtime_profile_old, no
342 .type _dl_runtime_profile_old, @function
344 /* We save the registers in a different order than desired by
345 .mask/.fmask, so we have to use explicit cfi directives. */
349 #define FRAMESIZE 50*8
352 _dl_runtime_profile_old:
353 lda $30, -FRAMESIZE($30)
354 cfi_adjust_cfa_offset (FRAMESIZE)
356 /* Preserve all argument registers. This also constructs the
357 La_alpha_regs structure. */
365 lda $16, FRAMESIZE($30)
374 /* Preserve all registers that C normally doesn't. */
411 /* Set up the arguments for _dl_profile_fixup:
412 $16 = link_map out of plt0
413 $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24
415 $19 = La_alpha_regs address
416 $20 = framesize address
428 bsr $26, _dl_profile_fixup !samegp
430 /* Discover if we're wrapping this call. */
434 /* Move the destination address into position. */
436 /* Restore program registers. */
482 /* Clean up and turn control to the destination. */
483 lda $30, FRAMESIZE($30)
487 /* Create a frame pointer and allocate a new argument frame. */
490 cfi_def_cfa_register (15)
495 /* Save the call destination around memcpy. */
498 /* Copy the stack arguments into place. */
500 lda $17, FRAMESIZE($15)
504 /* Reload the argument registers. */
522 /* Set up for call to _dl_call_pltexit. */
531 bsr $26, _dl_call_pltexit !samegp
534 cfi_def_cfa_register (30)
537 lda $30, FRAMESIZE($30)
541 .size _dl_runtime_profile_old, .-_dl_runtime_profile_old