summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/imp/linux_raw/arch/outline/x86.s
blob: bda234e1aa01326ab64f169f98605d511664f988 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
// Assembly code for making x86 syscalls.
//
// On x86 we use the "fastcall" convention which passes the first two
// arguments in ecx and edx. Outline.rs reorders the arguments to put
// a1 and a2 in those registers so they we don't have to move them to
// set up the kernel convention.
//
// "fastcall" expects callee to pop argument stack space, so we use
// `ret imm` instructions to clean up the stack. We don't need callee
// cleanup per se, it just comes along with using "fastcall".

    .file       "x86.s"
    .intel_syntax noprefix

    .section    .text.rustix_indirect_syscall0_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_indirect_syscall0_nr_last_fastcall
    .hidden     rustix_indirect_syscall0_nr_last_fastcall
    .type       rustix_indirect_syscall0_nr_last_fastcall, @function
rustix_indirect_syscall0_nr_last_fastcall:
    .cfi_startproc
    mov    eax,ecx
    call   edx
    ret
    .cfi_endproc
    .size rustix_indirect_syscall0_nr_last_fastcall, .-rustix_indirect_syscall0_nr_last_fastcall

    .section    .text.rustix_indirect_syscall1_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_indirect_syscall1_nr_last_fastcall
    .hidden     rustix_indirect_syscall1_nr_last_fastcall
    .type       rustix_indirect_syscall1_nr_last_fastcall, @function
rustix_indirect_syscall1_nr_last_fastcall:
    .cfi_startproc
    push   ebx
    .cfi_def_cfa_offset 8
    .cfi_offset ebx, -8
    mov    ebx,ecx
    mov    eax,edx
    call   DWORD PTR [esp+0x8]
    pop    ebx
    .cfi_def_cfa_offset 4
    ret    0x4
    .cfi_endproc
    .size rustix_indirect_syscall1_nr_last_fastcall, .-rustix_indirect_syscall1_nr_last_fastcall

    .section    .text.rustix_indirect_syscall1_noreturn_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_indirect_syscall1_noreturn_nr_last_fastcall
    .hidden     rustix_indirect_syscall1_noreturn_nr_last_fastcall
    .type       rustix_indirect_syscall1_noreturn_nr_last_fastcall, @function
rustix_indirect_syscall1_noreturn_nr_last_fastcall:
    .cfi_startproc
    mov    ebx,ecx
    mov    eax,edx
    call   DWORD PTR [esp+0x4]
    ud2
    .cfi_endproc
    .size rustix_indirect_syscall1_noreturn_nr_last_fastcall, .-rustix_indirect_syscall1_noreturn_nr_last_fastcall

    .section    .text.rustix_indirect_syscall2_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_indirect_syscall2_nr_last_fastcall
    .hidden     rustix_indirect_syscall2_nr_last_fastcall
    .type       rustix_indirect_syscall2_nr_last_fastcall, @function
rustix_indirect_syscall2_nr_last_fastcall:
    .cfi_startproc
    push   ebx
    .cfi_def_cfa_offset 8
    .cfi_offset ebx, -8
    mov    ebx,edx
    mov    eax,DWORD PTR [esp+0x8]
    call   DWORD PTR [esp+0xc]
    pop    ebx
    .cfi_def_cfa_offset 4
    ret    0x8
    .cfi_endproc
    .size rustix_indirect_syscall2_nr_last_fastcall, .-rustix_indirect_syscall2_nr_last_fastcall

    .section    .text.rustix_indirect_syscall3_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_indirect_syscall3_nr_last_fastcall
    .hidden     rustix_indirect_syscall3_nr_last_fastcall
    .type       rustix_indirect_syscall3_nr_last_fastcall, @function
rustix_indirect_syscall3_nr_last_fastcall:
    .cfi_startproc
    push   ebx
    .cfi_def_cfa_offset 8
    .cfi_offset ebx, -8
    mov    ebx,DWORD PTR [esp+0x8]
    mov    eax,DWORD PTR [esp+0xc]
    call   DWORD PTR [esp+0x10]
    pop    ebx
    .cfi_def_cfa_offset 4
    ret    0xc
    .cfi_endproc
    .size rustix_indirect_syscall3_nr_last_fastcall, .-rustix_indirect_syscall3_nr_last_fastcall

    .section    .text.rustix_indirect_syscall4_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_indirect_syscall4_nr_last_fastcall
    .hidden     rustix_indirect_syscall4_nr_last_fastcall
    .type       rustix_indirect_syscall4_nr_last_fastcall, @function
rustix_indirect_syscall4_nr_last_fastcall:
    .cfi_startproc
    push   ebx
    .cfi_def_cfa_offset 8
    push   esi
    .cfi_def_cfa_offset 12
    .cfi_offset esi, -12
    .cfi_offset ebx, -8
    mov    ebx,DWORD PTR [esp+0xc]
    mov    esi,DWORD PTR [esp+0x10]
    mov    eax,DWORD PTR [esp+0x14]
    call   DWORD PTR [esp+0x18]
    pop    esi
    .cfi_def_cfa_offset 8
    pop    ebx
    .cfi_def_cfa_offset 4
    ret    0x10
    .cfi_endproc
    .size rustix_indirect_syscall4_nr_last_fastcall, .-rustix_indirect_syscall4_nr_last_fastcall

    .section    .text.rustix_indirect_syscall5_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_indirect_syscall5_nr_last_fastcall
    .hidden     rustix_indirect_syscall5_nr_last_fastcall
    .type       rustix_indirect_syscall5_nr_last_fastcall, @function
rustix_indirect_syscall5_nr_last_fastcall:
    .cfi_startproc
    push   ebx
    .cfi_def_cfa_offset 8
    push   esi
    .cfi_def_cfa_offset 12
    push   edi
    .cfi_def_cfa_offset 16
    .cfi_offset edi, -16
    .cfi_offset esi, -12
    .cfi_offset ebx, -8
    mov    ebx,DWORD PTR [esp+0x10]
    mov    esi,DWORD PTR [esp+0x14]
    mov    edi,DWORD PTR [esp+0x18]
    mov    eax,DWORD PTR [esp+0x1c]
    call   DWORD PTR [esp+0x20]
    pop    edi
    .cfi_def_cfa_offset 12
    pop    esi
    .cfi_def_cfa_offset 8
    pop    ebx
    .cfi_def_cfa_offset 4
    ret    0x14
    .cfi_endproc
    .size rustix_indirect_syscall5_nr_last_fastcall, .-rustix_indirect_syscall5_nr_last_fastcall

    .section    .text.rustix_indirect_syscall6_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_indirect_syscall6_nr_last_fastcall
    .hidden     rustix_indirect_syscall6_nr_last_fastcall
    .type       rustix_indirect_syscall6_nr_last_fastcall, @function
rustix_indirect_syscall6_nr_last_fastcall:
    .cfi_startproc
    push   ebx
    .cfi_def_cfa_offset 8
    push   esi
    .cfi_def_cfa_offset 12
    push   edi
    .cfi_def_cfa_offset 16
    push   ebp
    .cfi_def_cfa_offset 20
    .cfi_offset ebp, -20
    .cfi_offset edi, -16
    .cfi_offset esi, -12
    .cfi_offset ebx, -8
    mov    ebx,DWORD PTR [esp+0x14]
    mov    esi,DWORD PTR [esp+0x18]
    mov    edi,DWORD PTR [esp+0x1c]
    mov    ebp,DWORD PTR [esp+0x20]
    mov    eax,DWORD PTR [esp+0x24]
    call   DWORD PTR [esp+0x28]
    pop    ebp
    .cfi_def_cfa_offset 16
    pop    edi
    .cfi_def_cfa_offset 12
    pop    esi
    .cfi_def_cfa_offset 8
    pop    ebx
    .cfi_def_cfa_offset 4
    ret    0x18
    .cfi_endproc
    .size rustix_indirect_syscall6_nr_last_fastcall, .-rustix_indirect_syscall6_nr_last_fastcall

    .section    .text.rustix_syscall0_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_syscall0_nr_last_fastcall
    .hidden     rustix_syscall0_nr_last_fastcall
    .type       rustix_syscall0_nr_last_fastcall, @function
rustix_syscall0_nr_last_fastcall:
    .cfi_startproc
    mov    eax,ecx
    int    0x80
    ret
    .cfi_endproc
    .size rustix_syscall0_nr_last_fastcall, .-rustix_syscall0_nr_last_fastcall

    .section    .text.rustix_syscall1_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_syscall1_nr_last_fastcall
    .hidden     rustix_syscall1_nr_last_fastcall
    .type       rustix_syscall1_nr_last_fastcall, @function
rustix_syscall1_nr_last_fastcall:
    .cfi_startproc
    push   ebx
    .cfi_def_cfa_offset 8
    .cfi_offset ebx, -8
    mov    eax,edx
    mov    ebx,ecx
    int    0x80
    pop    ebx
    .cfi_def_cfa_offset 4
    ret
    .cfi_endproc
    .size rustix_syscall1_nr_last_fastcall, .-rustix_syscall1_nr_last_fastcall

    .section    .text.rustix_syscall1_noreturn_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_syscall1_noreturn_nr_last_fastcall
    .hidden     rustix_syscall1_noreturn_nr_last_fastcall
    .type       rustix_syscall1_noreturn_nr_last_fastcall, @function
rustix_syscall1_noreturn_nr_last_fastcall:
    .cfi_startproc
    mov    eax,edx
    mov    ebx,ecx
    int    0x80
    ud2
    .cfi_endproc
    .size rustix_syscall1_noreturn_nr_last_fastcall, .-rustix_syscall1_noreturn_nr_last_fastcall

    .section    .text.rustix_syscall2_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_syscall2_nr_last_fastcall
    .hidden     rustix_syscall2_nr_last_fastcall
    .type       rustix_syscall2_nr_last_fastcall, @function
rustix_syscall2_nr_last_fastcall:
    .cfi_startproc
    push   ebx
    .cfi_def_cfa_offset 8
    .cfi_offset ebx, -8
    mov    ebx,edx
    mov    eax,DWORD PTR [esp+0x8]
    int    0x80
    pop    ebx
    .cfi_def_cfa_offset 4
    ret    0x4
    .cfi_endproc
    .size rustix_syscall2_nr_last_fastcall, .-rustix_syscall2_nr_last_fastcall

    .section    .text.rustix_syscall3_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_syscall3_nr_last_fastcall
    .hidden     rustix_syscall3_nr_last_fastcall
    .type       rustix_syscall3_nr_last_fastcall, @function
rustix_syscall3_nr_last_fastcall:
    .cfi_startproc
    push   ebx
    .cfi_def_cfa_offset 8
    .cfi_offset ebx, -8
    mov    ebx,DWORD PTR [esp+0x8]
    mov    eax,DWORD PTR [esp+0xc]
    int    0x80
    pop    ebx
    .cfi_def_cfa_offset 4
    ret    0x8
    .cfi_endproc
    .size rustix_syscall3_nr_last_fastcall, .-rustix_syscall3_nr_last_fastcall

    .section    .text.rustix_syscall4_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_syscall4_nr_last_fastcall
    .hidden     rustix_syscall4_nr_last_fastcall
    .type       rustix_syscall4_nr_last_fastcall, @function
rustix_syscall4_nr_last_fastcall:
    .cfi_startproc
    push   ebx
    .cfi_def_cfa_offset 8
    push   esi
    .cfi_def_cfa_offset 12
    .cfi_offset esi, -12
    .cfi_offset ebx, -8
    mov    ebx,DWORD PTR [esp+0xc]
    mov    esi,DWORD PTR [esp+0x10]
    mov    eax,DWORD PTR [esp+0x14]
    int    0x80
    pop    esi
    .cfi_def_cfa_offset 8
    pop    ebx
    .cfi_def_cfa_offset 4
    ret    0xc
    .cfi_endproc
    .size rustix_syscall4_nr_last_fastcall, .-rustix_syscall4_nr_last_fastcall

    .section    .text.rustix_syscall5_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_syscall5_nr_last_fastcall
    .hidden     rustix_syscall5_nr_last_fastcall
    .type       rustix_syscall5_nr_last_fastcall, @function
rustix_syscall5_nr_last_fastcall:
    .cfi_startproc
    push   ebx
    .cfi_def_cfa_offset 8
    push   edi
    .cfi_def_cfa_offset 12
    push   esi
    .cfi_def_cfa_offset 16
    .cfi_offset esi, -16
    .cfi_offset edi, -12
    .cfi_offset ebx, -8
    mov    ebx,DWORD PTR [esp+0x10]
    mov    esi,DWORD PTR [esp+0x14]
    mov    edi,DWORD PTR [esp+0x18]
    mov    eax,DWORD PTR [esp+0x1c]
    int    0x80
    pop    esi
    .cfi_def_cfa_offset 12
    pop    edi
    .cfi_def_cfa_offset 8
    pop    ebx
    .cfi_def_cfa_offset 4
    ret    0x10
    .cfi_endproc
    .size rustix_syscall5_nr_last_fastcall, .-rustix_syscall5_nr_last_fastcall

    .section    .text.rustix_syscall6_nr_last_fastcall,"ax",@progbits
    .p2align    4
    .weak       rustix_syscall6_nr_last_fastcall
    .hidden     rustix_syscall6_nr_last_fastcall
    .type       rustix_syscall6_nr_last_fastcall, @function
rustix_syscall6_nr_last_fastcall:
    .cfi_startproc
    push   ebp
    .cfi_def_cfa_offset 8
    push   ebx
    .cfi_def_cfa_offset 12
    push   edi
    .cfi_def_cfa_offset 16
    push   esi
    .cfi_def_cfa_offset 20
    .cfi_offset esi, -20
    .cfi_offset edi, -16
    .cfi_offset ebx, -12
    .cfi_offset ebp, -8
    mov    ebx,DWORD PTR [esp+0x14]
    mov    esi,DWORD PTR [esp+0x18]
    mov    edi,DWORD PTR [esp+0x1c]
    mov    ebp,DWORD PTR [esp+0x20]
    mov    eax,DWORD PTR [esp+0x24]
    int    0x80
    pop    esi
    .cfi_def_cfa_offset 16
    pop    edi
    .cfi_def_cfa_offset 12
    pop    ebx
    .cfi_def_cfa_offset 8
    pop    ebp
    .cfi_def_cfa_offset 4
    ret    0x14
    .cfi_endproc
    .size rustix_syscall6_nr_last_fastcall, .-rustix_syscall6_nr_last_fastcall

    .section    .text.rustix_int_0x80,"ax",@progbits
    .p2align    4
    .weak       rustix_int_0x80
    .hidden     rustix_int_0x80
    .type       rustix_int_0x80, @function
rustix_int_0x80:
    .cfi_startproc
    int    0x80
    ret
    .cfi_endproc
    .size rustix_int_0x80, .-rustix_int_0x80

    .section .note.GNU-stack,"",@progbits