clarify the purpose of this project
[nyanglibc.git] / resource / ulimit.s
blob29f2fd1ec516bf178632304f36f57a0f0f571508
1 .text
2 .p2align 4,,15
3 .globl __ulimit
4 .type __ulimit, @function
5 __ulimit:
6 pushq %rbx
7 subq $96, %rsp
8 cmpl $2, %edi
9 leaq 112(%rsp), %rax
10 movq %rsi, 56(%rsp)
11 movl $8, 24(%rsp)
12 movq %rax, 32(%rsp)
13 leaq 48(%rsp), %rax
14 movq %rax, 40(%rsp)
15 je .L3
16 cmpl $4, %edi
17 je .L4
18 cmpl $1, %edi
19 je .L18
20 movq __libc_errno@gottpoff(%rip), %rax
21 movl $22, %fs:(%rax)
22 .L15:
23 movq $-1, %rbx
24 addq $96, %rsp
25 movq %rbx, %rax
26 popq %rbx
27 ret
28 .p2align 4,,10
29 .p2align 3
30 .L18:
31 movq %rsp, %rsi
32 call __getrlimit
33 testl %eax, %eax
34 jne .L15
35 movq (%rsp), %rax
36 movabsq $9223372036854775807, %rbx
37 movq %rax, %rdx
38 shrq $9, %rdx
39 cmpq $-1, %rax
40 cmovne %rdx, %rbx
41 addq $96, %rsp
42 movq %rbx, %rax
43 popq %rbx
44 ret
45 .p2align 4,,10
46 .p2align 3
47 .L4:
48 movl $4, %edi
49 call __sysconf
50 addq $96, %rsp
51 movq %rax, %rbx
52 movq %rbx, %rax
53 popq %rbx
54 ret
55 .L3:
56 movq 40(%rsp), %rax
57 movl $16, 24(%rsp)
58 movq 8(%rax), %rbx
59 movabsq $36028797018963967, %rax
60 cmpq %rax, %rbx
61 jbe .L10
62 movq $-1, %rax
63 movabsq $9223372036854775807, %rbx
64 movq %rax, (%rsp)
65 movq %rax, 8(%rsp)
66 .L11:
67 movq %rsp, %rsi
68 movl $1, %edi
69 call __setrlimit
70 cmpl $-1, %eax
71 je .L15
72 addq $96, %rsp
73 movq %rbx, %rax
74 popq %rbx
75 ret
76 .L10:
77 movq %rbx, %rax
78 salq $9, %rax
79 movq %rax, (%rsp)
80 movq %rax, 8(%rsp)
81 jmp .L11
82 .size __ulimit, .-__ulimit
83 .weak ulimit
84 .set ulimit,__ulimit
85 .hidden __setrlimit
86 .hidden __sysconf
87 .hidden __getrlimit