clarify the purpose of this project
[nyanglibc.git] / login / ptsname.s
blobf634b2b95e451c5b85ed8b39824577c8194cf04b
1 .text
2 .p2align 4,,15
3 .globl __ptsname_r
4 .hidden __ptsname_r
5 .type __ptsname_r, @function
6 __ptsname_r:
7 pushq %r15
8 pushq %r14
9 movq %rdx, %r14
10 pushq %r13
11 pushq %r12
12 xorl %eax, %eax
13 pushq %rbp
14 pushq %rbx
15 movq %rsi, %r13
16 movl $2147767344, %esi
17 subq $56, %rsp
18 movq __libc_errno@gottpoff(%rip), %rbp
19 leaq 12(%rsp), %rdx
20 movl %fs:0(%rbp), %r15d
21 call __ioctl
22 testl %eax, %eax
23 je .L7
24 movl %fs:0(%rbp), %ebx
25 .L1:
26 addq $56, %rsp
27 movl %ebx, %eax
28 popq %rbx
29 popq %rbp
30 popq %r12
31 popq %r13
32 popq %r14
33 popq %r15
34 ret
35 .p2align 4,,10
36 .p2align 3
37 .L7:
38 movl 12(%rsp), %edi
39 leaq 16(%rsp), %r12
40 leaq 36(%rsp), %rsi
41 xorl %ecx, %ecx
42 movl $10, %edx
43 movl %eax, %ebx
44 movb $0, 36(%rsp)
45 call _itoa_word
46 leaq 21(%r12), %rdx
47 subq %rax, %rdx
48 leaq 9(%rdx), %rcx
49 cmpq %r14, %rcx
50 ja .L8
51 movabsq $8319397760812278831, %rcx
52 leaq 9(%r13), %rdi
53 movq %rax, %rsi
54 movq %rcx, 0(%r13)
55 movl $47, %ecx
56 movw %cx, 8(%r13)
57 call memcpy@PLT
58 movl %r15d, %fs:0(%rbp)
59 jmp .L1
60 .p2align 4,,10
61 .p2align 3
62 .L8:
63 movl $34, %fs:0(%rbp)
64 movl $34, %ebx
65 jmp .L1
66 .size __ptsname_r, .-__ptsname_r
67 .weak ptsname_r
68 .set ptsname_r,__ptsname_r
69 .p2align 4,,15
70 .globl ptsname
71 .type ptsname, @function
72 ptsname:
73 leaq buffer(%rip), %rsi
74 subq $8, %rsp
75 movl $30, %edx
76 call __ptsname_r
77 testl %eax, %eax
78 leaq buffer(%rip), %rax
79 movl $0, %edx
80 cmovne %rdx, %rax
81 addq $8, %rsp
82 ret
83 .size ptsname, .-ptsname
84 .local buffer
85 .comm buffer,30,16
86 .hidden _itoa_word
87 .hidden __ioctl