clarify the purpose of this project
[nyanglibc.git] / misc / gethostname.s
blob3a23da96d987dd5ecb1bc7ef7d26cdfedab3c76b
1 .text
2 .p2align 4,,15
3 .globl __gethostname
4 .hidden __gethostname
5 .type __gethostname, @function
6 __gethostname:
7 pushq %r14
8 pushq %r13
9 movq %rdi, %r13
10 pushq %r12
11 pushq %rbp
12 movq %rsi, %r12
13 pushq %rbx
14 subq $400, %rsp
15 movq %rsp, %rbx
16 movq %rbx, %rdi
17 call __uname
18 testl %eax, %eax
19 jne .L3
20 addq $65, %rbx
21 movl %eax, %r14d
22 movq %rbx, %rdi
23 call strlen
24 leaq 1(%rax), %rbp
25 movq %r12, %rdx
26 movq %rbx, %rsi
27 movq %r13, %rdi
28 cmpq %r12, %rbp
29 cmovbe %rbp, %rdx
30 call memcpy@PLT
31 cmpq %r12, %rbp
32 ja .L6
33 .L1:
34 addq $400, %rsp
35 movl %r14d, %eax
36 popq %rbx
37 popq %rbp
38 popq %r12
39 popq %r13
40 popq %r14
41 ret
42 .p2align 4,,10
43 .p2align 3
44 .L3:
45 movl $-1, %r14d
46 jmp .L1
47 .p2align 4,,10
48 .p2align 3
49 .L6:
50 movq __libc_errno@gottpoff(%rip), %rax
51 movl $-1, %r14d
52 movl $36, %fs:(%rax)
53 jmp .L1
54 .size __gethostname, .-__gethostname
55 .weak gethostname
56 .set gethostname,__gethostname
57 .hidden strlen
58 .hidden __uname