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 /* The PLT stubs will call _dl_runtime_resolve/_dl_runtime_profile
21 * with the following linkage:
22 * r2 - r6 : parameter registers
23 * f0, f2, f4, f6 : floating point parameter registers
24 * 24(r15), 28(r15) : PLT arguments PLT1, PLT2
25 * 96(r15) : additional stack parameters
26 * The normal clobber rules for function calls apply:
27 * r0 - r5 : call clobbered
28 * r6 - r13 : call saved
29 * r14 : return address (call clobbered)
30 * r15 : stack pointer (call saved)
31 * f1, f3, f5, f7 : call saved
32 * f0 - f3, f5, f7 - f15 : call clobbered
38 .globl _dl_runtime_resolve
39 .type _dl_runtime_resolve, @function
43 stmg 2,5,64(15) # save registers
46 lgr 0,15 # create stack frame
48 cfi_adjust_cfa_offset (160)
50 lmg 2,3,208(15) # load args saved by PLT
51 brasl 14,_dl_fixup # call fixup
52 lgr 1,2 # function addr returned in r2
53 aghi 15,160 # remove stack frame
54 cfi_adjust_cfa_offset (-160)
55 lg 14,96(15) # restore registers
59 .size _dl_runtime_resolve, .-_dl_runtime_resolve
63 .globl _dl_runtime_profile
64 .type _dl_runtime_profile, @function
68 stmg %r2,%r6,64(%r15) # save registers
81 cfi_offset (r12, -136)
82 cfi_offset (r14, -128)
83 lgr %r12,%r15 # create stack frame
84 cfi_def_cfa_register (12)
87 lmg %r2,%r3,48(%r12) # load arguments saved by PLT
88 lgr %r4,%r14 # return address as third parameter
89 la %r5,64(%r12) # pointer to struct La_s390_32_regs
90 la %r6,40(%r12) # long int * framesize
91 brasl %r14,_dl_profile_fixup # call resolver
92 lgr %r1,%r2 # function addr returned in r2
93 lg %r0,40(%r12) # load framesize
101 basr %r14,%r1 # call resolved function
102 0: lgr %r15,%r12 # remove stack frame
103 cfi_def_cfa_register (15)
104 lg %r14,32(%r15) # restore registers
108 cfi_def_cfa_register (12)
109 1: jz 4f # framesize == 0 ?
110 aghi %r0,7 # align framesize to 8
112 slgr %r15,%r0 # make room for framesize bytes
117 3: mvc 0(8,%r2),0(%r3) # copy additional parameters
121 4: lmg %r2,%r6,64(%r12) # load register parameters
126 basr %r14,%r1 # call resolved function
129 lmg %r2,%r3,48(%r12) # load arguments saved by PLT
130 la %r4,32(%r12) # pointer to struct La_s390_32_regs
131 la %r5,72(%r12) # pointer to struct La_s390_32_retval
132 brasl %r14,_dl_call_pltexit
135 .size _dl_runtime_profile, .-_dl_runtime_profile