clarify the purpose of this project
[nyanglibc.git] / rt / shm_open.s
blob1bc50c767b9851edcb7c2ad00f6267986dea7418
1 .text
2 .p2align 4,,15
3 .globl shm_open
4 .type shm_open, @function
5 shm_open:
6 pushq %rbp
7 movq %rsp, %rbp
8 pushq %r15
9 pushq %r14
10 pushq %r13
11 pushq %r12
12 movl %esi, %r13d
13 pushq %rbx
14 movq %rdi, %rbx
15 leaq -56(%rbp), %rdi
16 movl %edx, %r15d
17 subq $40, %rsp
18 call __shm_directory@PLT
19 testq %rax, %rax
20 je .L2
21 cmpb $47, (%rbx)
22 movq %rax, %r14
23 jne .L4
24 .p2align 4,,10
25 .p2align 3
26 .L3:
27 addq $1, %rbx
28 cmpb $47, (%rbx)
29 je .L3
30 .L4:
31 movq %rbx, %rdi
32 call strlen@PLT
33 leaq 1(%rax), %r12
34 cmpq $1, %r12
35 je .L6
36 cmpq $254, %r12
37 ja .L6
38 movl $47, %esi
39 movq %rbx, %rdi
40 call strchr@PLT
41 testq %rax, %rax
42 jne .L6
43 movq -56(%rbp), %rdx
44 movq %r14, %rsi
45 leaq 30(%rdx,%r12), %rax
46 andq $-16, %rax
47 subq %rax, %rsp
48 leaq 15(%rsp), %rcx
49 andq $-16, %rcx
50 movq %rcx, %rdi
51 movq %rcx, -72(%rbp)
52 call __mempcpy@PLT
53 movq %r12, %rdx
54 movq %rbx, %rsi
55 movq %rax, %rdi
56 call memcpy@PLT
57 leaq -60(%rbp), %rsi
58 movl $1, %edi
59 call pthread_setcancelstate@PLT
60 movq -72(%rbp), %rcx
61 movl %r13d, %esi
62 xorl %eax, %eax
63 orl $655360, %esi
64 movl %r15d, %edx
65 movq %rcx, %rdi
66 call open@PLT
67 cmpl $-1, %eax
68 movl %eax, %ebx
69 je .L13
70 .L8:
71 movl -60(%rbp), %edi
72 xorl %esi, %esi
73 call pthread_setcancelstate@PLT
74 .L1:
75 leaq -40(%rbp), %rsp
76 movl %ebx, %eax
77 popq %rbx
78 popq %r12
79 popq %r13
80 popq %r14
81 popq %r15
82 popq %rbp
83 ret
84 .p2align 4,,10
85 .p2align 3
86 .L13:
87 movq errno@gottpoff(%rip), %rax
88 cmpl $21, %fs:(%rax)
89 jne .L8
90 movl $22, %fs:(%rax)
91 jmp .L8
92 .p2align 4,,10
93 .p2align 3
94 .L2:
95 movq errno@gottpoff(%rip), %rax
96 movl $-1, %ebx
97 movl $38, %fs:(%rax)
98 jmp .L1
99 .p2align 4,,10
100 .p2align 3
101 .L6:
102 movq errno@gottpoff(%rip), %rax
103 movl $-1, %ebx
104 movl $22, %fs:(%rax)
105 jmp .L1
106 .size shm_open, .-shm_open