clarify the purpose of this project
[nyanglibc.git] / posix / fexecve.shared.s
blob09dfecdf4b79bc70c544585e6331cfa841118622
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 .section .rodata.str1.1,"aMS",@progbits,1
7 .LC0:
8 .string ""
9 .LC1:
10 .string "/proc/self/fd/%d"
11 .LC2:
12 .string "/proc/self/fd"
13 #NO_APP
14 .text
15 .p2align 4,,15
16 .globl fexecve
17 .type fexecve, @function
18 fexecve:
19 pushq %r14
20 pushq %r13
21 pushq %r12
22 pushq %rbp
23 pushq %rbx
24 movq %rdx, %rbx
25 subq $176, %rsp
26 testq %rsi, %rsi
27 sete %dl
28 testq %rbx, %rbx
29 sete %al
30 orb %al, %dl
31 jne .L9
32 testl %edi, %edi
33 movl %edi, %r12d
34 js .L9
35 movq %rsi, %r14
36 movq %rsi, %rdx
37 movl $4096, %r8d
38 movq %rbx, %r10
39 leaq .LC0(%rip), %rsi
40 movl $322, %eax
41 #APP
42 # 43 "../sysdeps/unix/sysv/linux/fexecve.c" 1
43 syscall
45 # 0 "" 2
46 #NO_APP
47 cmpq $-4096, %rax
48 ja .L5
49 movq __libc_errno@gottpoff(%rip), %r13
50 movl %fs:0(%r13), %ebp
51 .L6:
52 cmpl $38, %ebp
53 jne .L4
54 movl %r12d, %ecx
55 leaq .LC1(%rip), %rdx
56 movq %rsp, %r12
57 movl $27, %esi
58 movq %r12, %rdi
59 xorl %eax, %eax
60 call __GI___snprintf
61 movq %rbx, %rdx
62 movq %r14, %rsi
63 movq %r12, %rdi
64 call __execve
65 leaq 32(%rsp), %rsi
66 leaq .LC2(%rip), %rdi
67 movl %fs:0(%r13), %ebx
68 call __GI___stat64
69 testl %eax, %eax
70 je .L7
71 cmpl $2, %fs:0(%r13)
72 cmove %ebp, %ebx
73 .L7:
74 movl %ebx, %fs:0(%r13)
75 jmp .L4
76 .p2align 4,,10
77 .p2align 3
78 .L9:
79 movq __libc_errno@gottpoff(%rip), %rax
80 movl $22, %fs:(%rax)
81 .L4:
82 addq $176, %rsp
83 movl $-1, %eax
84 popq %rbx
85 popq %rbp
86 popq %r12
87 popq %r13
88 popq %r14
89 ret
90 .p2align 4,,10
91 .p2align 3
92 .L5:
93 movq __libc_errno@gottpoff(%rip), %r13
94 movl %eax, %ebp
95 negl %ebp
96 movl %ebp, %fs:0(%r13)
97 jmp .L6
98 .size fexecve, .-fexecve
99 .hidden __execve