clarify the purpose of this project
[nyanglibc.git] / stdlib / getrandom.s
blob41e95abde554d82aace725464140e80196434145
1 .text
2 .p2align 4,,15
3 .globl __getrandom
4 .hidden __getrandom
5 .type __getrandom, @function
6 __getrandom:
7 #APP
8 # 29 "../sysdeps/unix/sysv/linux/getrandom.c" 1
9 movl %fs:24,%eax
10 # 0 "" 2
11 #NO_APP
12 testl %eax, %eax
13 jne .L2
14 movl $318, %eax
15 #APP
16 # 29 "../sysdeps/unix/sysv/linux/getrandom.c" 1
17 syscall
19 # 0 "" 2
20 #NO_APP
21 cmpq $-4096, %rax
22 ja .L9
23 rep ret
24 .p2align 4,,10
25 .p2align 3
26 .L2:
27 pushq %r12
28 pushq %rbp
29 movl %edx, %r12d
30 pushq %rbx
31 movq %rsi, %rbp
32 movq %rdi, %rbx
33 subq $16, %rsp
34 call __libc_enable_asynccancel
35 movl %r12d, %edx
36 movl %eax, %r8d
37 movq %rbp, %rsi
38 movq %rbx, %rdi
39 movl $318, %eax
40 #APP
41 # 29 "../sysdeps/unix/sysv/linux/getrandom.c" 1
42 syscall
44 # 0 "" 2
45 #NO_APP
46 cmpq $-4096, %rax
47 ja .L10
48 .L4:
49 movl %r8d, %edi
50 movq %rax, 8(%rsp)
51 call __libc_disable_asynccancel
52 movq 8(%rsp), %rax
53 addq $16, %rsp
54 popq %rbx
55 popq %rbp
56 popq %r12
57 ret
58 .p2align 4,,10
59 .p2align 3
60 .L9:
61 movq __libc_errno@gottpoff(%rip), %rdx
62 negl %eax
63 movl %eax, %fs:(%rdx)
64 movq $-1, %rax
65 ret
66 .L10:
67 movq __libc_errno@gottpoff(%rip), %rdx
68 negl %eax
69 movl %eax, %fs:(%rdx)
70 movq $-1, %rax
71 jmp .L4
72 .size __getrandom, .-__getrandom
73 .weak getrandom
74 .set getrandom,__getrandom
75 .hidden __libc_disable_asynccancel
76 .hidden __libc_enable_asynccancel