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
45 lgr 0,15 # create stack frame
47 cfi_adjust_cfa_offset (160)
49 lmg 2,3,208(15) # load args saved by PLT
50 brasl 14,_dl_fixup # call fixup
51 lgr 1,2 # function addr returned in r2
52 aghi 15,160 # remove stack frame
53 cfi_adjust_cfa_offset (-160)
54 lg 14,96(15) # restore registers
58 .size _dl_runtime_resolve, .-_dl_runtime_resolve
62 .globl _dl_runtime_profile
63 .type _dl_runtime_profile, @function
67 stmg %r2,%r6,64(%r15) # save registers
75 lgr %r12,%r15 # create stack frame
76 cfi_def_cfa_register (12)
79 lmg %r2,%r3,48(%r12) # load arguments saved by PLT
80 lgr %r4,%r14 # return address as third parameter
81 la %r5,64(%r12) # pointer to struct La_s390_32_regs
82 la %r6,40(%r12) # long int * framesize
83 brasl %r14,_dl_profile_fixup # call resolver
84 lgr %r1,%r2 # function addr returned in r2
85 lg %r0,40(%r12) # load framesize
93 basr %r14,%r1 # call resolved function
94 0: lr %r15,%r12 # remove stack frame
95 cfi_def_cfa_register (15)
96 lg %r14,32(%r15) # restore registers
100 cfi_def_cfa_register (12)
101 1: jz 4f # framesize == 0 ?
102 aghi %r0,7 # align framesize to 8
104 slgr %r15,%r0 # make room for framesize bytes
109 3: mvc 0(8,%r2),0(%r3) # copy additional parameters
113 4: lmg %r2,%r6,64(%r12) # load register parameters
118 basr %r14,%r1 # call resolved function
121 lmg %r2,%r3,48(%r12) # load arguments saved by PLT
122 la %r4,32(%r12) # pointer to struct La_s390_32_regs
123 la %r5,72(%r12) # pointer to struct La_s390_32_retval
124 brasl %r14,_dl_call_pltexit
127 .size _dl_runtime_profile, .-_dl_runtime_profile