Warning: That file was not part of the compilation database. It may have many parsing errors.

1/* PLT trampolines. i386 version.
2 Copyright (C) 2004-2018 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
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.
9
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.
14
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/>. */
18
19#include <sysdep.h>
20#include <link-defines.h>
21
22#ifdef HAVE_MPX_SUPPORT
23# define PRESERVE_BND_REGS_PREFIX bnd
24#else
25# define PRESERVE_BND_REGS_PREFIX .byte 0xf2
26#endif
27
28 .text
29 .globl _dl_runtime_resolve
30 .type _dl_runtime_resolve, @function
31 cfi_startproc
32 .align 16
33_dl_runtime_resolve:
34 cfi_adjust_cfa_offset (8)
35 _CET_ENDBR
36 pushl %eax # Preserve registers otherwise clobbered.
37 cfi_adjust_cfa_offset (4)
38 pushl %ecx
39 cfi_adjust_cfa_offset (4)
40 pushl %edx
41 cfi_adjust_cfa_offset (4)
42 movl 16(%esp), %edx # Copy args pushed by PLT in register. Note
43 movl 12(%esp), %eax # that `fixup' takes its parameters in regs.
44 call _dl_fixup # Call resolver.
45 popl %edx # Get register content back.
46 cfi_adjust_cfa_offset (-4)
47 movl (%esp), %ecx
48 movl %eax, (%esp) # Store the function address.
49 movl 4(%esp), %eax
50 ret $12 # Jump to function address.
51 cfi_endproc
52 .size _dl_runtime_resolve, .-_dl_runtime_resolve
53
54# The SHSTK compatible version.
55 .text
56 .globl _dl_runtime_resolve_shstk
57 .type _dl_runtime_resolve_shstk, @function
58 cfi_startproc
59 .align 16
60_dl_runtime_resolve_shstk:
61 cfi_adjust_cfa_offset (8)
62 _CET_ENDBR
63 pushl %eax # Preserve registers otherwise clobbered.
64 cfi_adjust_cfa_offset (4)
65 pushl %edx
66 cfi_adjust_cfa_offset (4)
67 movl 12(%esp), %edx # Copy args pushed by PLT in register. Note
68 movl 8(%esp), %eax # that `fixup' takes its parameters in regs.
69 call _dl_fixup # Call resolver.
70 movl (%esp), %edx # Get register content back.
71 movl %eax, %ecx # Store the function address.
72 movl 4(%esp), %eax # Get register content back.
73 addl $16, %esp # Adjust stack: PLT1 + PLT2 + %eax + %edx
74 cfi_adjust_cfa_offset (-16)
75 jmp *%ecx # Jump to function address.
76 cfi_endproc
77 .size _dl_runtime_resolve_shstk, .-_dl_runtime_resolve_shstk
78
79#ifndef PROF
80# The SHSTK compatible version.
81 .globl _dl_runtime_profile_shstk
82 .type _dl_runtime_profile_shstk, @function
83 cfi_startproc
84 .align 16
85_dl_runtime_profile_shstk:
86 cfi_adjust_cfa_offset (8)
87 _CET_ENDBR
88 pushl %esp
89 cfi_adjust_cfa_offset (4)
90 addl $8, (%esp) # Account for the pushed PLT data
91 pushl %ebp
92 cfi_adjust_cfa_offset (4)
93 pushl %eax # Preserve registers otherwise clobbered.
94 cfi_adjust_cfa_offset (4)
95 pushl %ecx
96 cfi_adjust_cfa_offset (4)
97 pushl %edx
98 cfi_adjust_cfa_offset (4)
99 movl %esp, %ecx
100 subl $8, %esp
101 cfi_adjust_cfa_offset (8)
102 movl $-1, 4(%esp)
103 leal 4(%esp), %edx
104 movl %edx, (%esp)
105 pushl %ecx # Address of the register structure
106 cfi_adjust_cfa_offset (4)
107 movl 40(%esp), %ecx # Load return address
108 movl 36(%esp), %edx # Copy args pushed by PLT in register. Note
109 movl 32(%esp), %eax # that `fixup' takes its parameters in regs.
110 call _dl_profile_fixup # Call resolver.
111 cfi_adjust_cfa_offset (-8)
112 movl (%esp), %edx
113 testl %edx, %edx
114 jns 1f
115 movl 4(%esp), %edx # Get register content back.
116 movl %eax, %ecx # Store the function address.
117 movl 12(%esp), %eax # Get register content back.
118 # Adjust stack: PLT1 + PLT2 + %esp + %ebp + %eax + %ecx + %edx
119 # + free.
120 addl $32, %esp
121 cfi_adjust_cfa_offset (-32)
122 jmp *%ecx # Jump to function address.
123 cfi_endproc
124 .size _dl_runtime_profile_shstk, .-_dl_runtime_profile_shstk
125
126 .globl _dl_runtime_profile
127 .type _dl_runtime_profile, @function
128 cfi_startproc
129 .align 16
130_dl_runtime_profile:
131 cfi_adjust_cfa_offset (8)
132 _CET_ENDBR
133 pushl %esp
134 cfi_adjust_cfa_offset (4)
135 addl $8, (%esp) # Account for the pushed PLT data
136 pushl %ebp
137 cfi_adjust_cfa_offset (4)
138 pushl %eax # Preserve registers otherwise clobbered.
139 cfi_adjust_cfa_offset (4)
140 pushl %ecx
141 cfi_adjust_cfa_offset (4)
142 pushl %edx
143 cfi_adjust_cfa_offset (4)
144 movl %esp, %ecx
145 subl $8, %esp
146 cfi_adjust_cfa_offset (8)
147 movl $-1, 4(%esp)
148 leal 4(%esp), %edx
149 movl %edx, (%esp)
150 pushl %ecx # Address of the register structure
151 cfi_adjust_cfa_offset (4)
152 movl 40(%esp), %ecx # Load return address
153 movl 36(%esp), %edx # Copy args pushed by PLT in register. Note
154 movl 32(%esp), %eax # that `fixup' takes its parameters in regs.
155 call _dl_profile_fixup # Call resolver.
156 cfi_adjust_cfa_offset (-8)
157 movl (%esp), %edx
158 testl %edx, %edx
159 jns 1f
160 popl %edx
161 cfi_adjust_cfa_offset (-4)
162 popl %edx # Get register content back.
163 cfi_adjust_cfa_offset (-4)
164 movl (%esp), %ecx
165 movl %eax, (%esp) # Store the function address.
166 movl 4(%esp), %eax
167 ret $20 # Jump to function address.
168
169 /*
170 +32 return address
171 +28 PLT1
172 +24 PLT2
173 +20 %esp
174 +16 %ebp
175 +12 %eax
176 +8 %ecx
177 +4 %edx
178 %esp free
179 */
180 cfi_adjust_cfa_offset (8)
1811: movl %ebx, (%esp)
182 cfi_rel_offset (ebx, 0)
183 movl %edx, %ebx # This is the frame buffer size
184 pushl %edi
185 cfi_adjust_cfa_offset (4)
186 cfi_rel_offset (edi, 0)
187 pushl %esi
188 cfi_adjust_cfa_offset (4)
189 cfi_rel_offset (esi, 0)
190 leal 44(%esp), %esi
191 movl %ebx, %ecx
192 orl $4, %ebx # Increase frame size if necessary to align
193 # stack for the function call
194 andl $~3, %ebx
195 movl %esp, %edi
196 subl %ebx, %edi
197 movl %esp, %ebx
198 cfi_def_cfa_register (ebx)
199 movl %edi, %esp
200 shrl $2, %ecx
201 rep
202 movsl
203 movl (%ebx), %esi
204 cfi_restore (esi)
205 movl 4(%ebx), %edi
206 cfi_restore (edi)
207 /*
208 %ebx+40 return address
209 %ebx+36 PLT1
210 %ebx+32 PLT2
211 %ebx+28 %esp
212 %ebx+24 %ebp
213 %ebx+20 %eax
214 %ebx+16 %ecx
215 %ebx+12 %edx
216 %ebx+8 %ebx
217 %ebx+4 free
218 %ebx free
219 %esp copied stack frame
220 */
221 movl %eax, (%ebx)
222 movl 12(%ebx), %edx
223 movl 16(%ebx), %ecx
224 movl 20(%ebx), %eax
225 call *(%ebx)
226 movl %ebx, %esp
227 cfi_def_cfa_register (esp)
228 movl 8(%esp), %ebx
229 cfi_restore (ebx)
230 /*
231 +40 return address
232 +36 PLT1
233 +32 PLT2
234 +28 %esp
235 +24 %ebp
236 +20 %eax
237 +16 %ecx
238 +12 %edx
239 +8 free
240 +4 free
241 %esp free
242 */
243#if LONG_DOUBLE_SIZE != 12
244# error "long double size must be 12 bytes"
245#endif
246 # Allocate space for La_i86_retval and subtract 12 free bytes.
247 subl $(LRV_SIZE - 12), %esp
248 cfi_adjust_cfa_offset (LRV_SIZE - 12)
249 movl %eax, LRV_EAX_OFFSET(%esp)
250 movl %edx, LRV_EDX_OFFSET(%esp)
251 fstpt LRV_ST0_OFFSET(%esp)
252 fstpt LRV_ST1_OFFSET(%esp)
253#ifdef HAVE_MPX_SUPPORT
254 bndmov %bnd0, LRV_BND0_OFFSET(%esp)
255 bndmov %bnd1, LRV_BND1_OFFSET(%esp)
256#else
257 .byte 0x66,0x0f,0x1b,0x44,0x24,LRV_BND0_OFFSET
258 .byte 0x66,0x0f,0x1b,0x4c,0x24,LRV_BND1_OFFSET
259#endif
260 pushl %esp
261 cfi_adjust_cfa_offset (4)
262 # Address of La_i86_regs area.
263 leal (LRV_SIZE + 4)(%esp), %ecx
264 # PLT2
265 movl (LRV_SIZE + 4 + LR_SIZE)(%esp), %eax
266 # PLT1
267 movl (LRV_SIZE + 4 + LR_SIZE + 4)(%esp), %edx
268 call _dl_call_pltexit
269 movl LRV_EAX_OFFSET(%esp), %eax
270 movl LRV_EDX_OFFSET(%esp), %edx
271 fldt LRV_ST1_OFFSET(%esp)
272 fldt LRV_ST0_OFFSET(%esp)
273#ifdef HAVE_MPX_SUPPORT
274 bndmov LRV_BND0_OFFSET(%esp), %bnd0
275 bndmov LRV_BND1_OFFSET(%esp), %bnd1
276#else
277 .byte 0x66,0x0f,0x1a,0x44,0x24,LRV_BND0_OFFSET
278 .byte 0x66,0x0f,0x1a,0x4c,0x24,LRV_BND1_OFFSET
279#endif
280 # Restore stack before return.
281 addl $(LRV_SIZE + 4 + LR_SIZE + 4), %esp
282 cfi_adjust_cfa_offset (-(LRV_SIZE + 4 + LR_SIZE + 4))
283 PRESERVE_BND_REGS_PREFIX
284 ret
285 cfi_endproc
286 .size _dl_runtime_profile, .-_dl_runtime_profile
287#endif
288

Warning: That file was not part of the compilation database. It may have many parsing errors.