1 /* PLT trampolines. s390 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
20 /* This code is used in dl-runtime.c to call the `fixup' function
21 and then redirect to the address it returns. */
23 /* The PLT stubs will call _dl_runtime_resolve/_dl_runtime_profile
24 * with the following linkage:
25 * r2 - r6 : parameter registers
26 * f0, f2 : floating point parameter registers
27 * 24(r15), 28(r15) : PLT arguments PLT1, PLT2
28 * 96(r15) : additional stack parameters
29 * The normal clobber rules for function calls apply:
30 * r0 - r5 : call clobbered
31 * r6 - r13 : call saved
32 * r14 : return address (call clobbered)
33 * r15 : stack pointer (call saved)
35 * f0 - f3, f5, f7 - f15 : call clobbered
41 .globl _dl_runtime_resolve
42 .type _dl_runtime_resolve, @function
46 stm %r2,%r5,32(%r15) # save registers
48 lr %r0,%r15 # create stack frame
50 cfi_adjust_cfa_offset (96)
52 lm %r2,%r3,120(%r15) # load args saved by PLT
55 bas %r14,0(%r14,%r1) # call resolver
56 lr %r1,%r2 # function addr returned in r2
57 ahi %r15,96 # remove stack frame
58 cfi_adjust_cfa_offset (-96)
59 l %r14,8(15) # restore registers
62 1: .long _dl_fixup - 0b
64 .size _dl_runtime_resolve, .-_dl_runtime_resolve
68 .globl _dl_runtime_profile
69 .type _dl_runtime_profile, @function
73 stm %r2,%r6,32(%r15) # save registers
79 lr %r12,%r15 # create stack frame
80 cfi_def_cfa_register (12)
83 lm %r2,%r3,24(%r12) # load arguments saved by PLT
84 lr %r4,%r14 # return address as third parameter
87 la %r5,32(%r12) # pointer to struct La_s390_32_regs
88 la %r6,20(%r12) # long int * framesize
89 bas %r14,0(%r14,%r1) # call resolver
90 lr %r1,%r2 # function addr returned in r2
91 icm %r0,15,20(%r12) # load & test framesize
96 basr %r14,%r1 # call resolved function
97 1: lr %r15,%r12 # remove stack frame
98 cfi_def_cfa_register (15)
99 l %r14,16(%r15) # restore registers
103 cfi_def_cfa_register (12)
104 2: jz 4f # framesize == 0 ?
105 ahi %r0,7 # align framesize to 8
108 slr %r15,%r0 # make room for framesize bytes
113 3: mvc 0(8,%r2),0(%r3) # copy additional parameters
117 4: lm %r2,%r6,32(%r12) # load register parameters
120 basr %r14,%r1 # call resolved function
123 lm %r2,%r3,24(%r12) # load arguments saved by PLT
126 la %r4,32(%r12) # pointer to struct La_s390_32_regs
127 la %r5,72(%r12) # pointer to struct La_s390_32_retval
128 basr %r14,%r1 # call _dl_call_pltexit
130 6: .long _dl_profile_fixup - 0b
131 7: .long _dl_call_pltexit - 5b
133 .size _dl_runtime_profile, .-_dl_runtime_profile