1// Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors.
2//
3// Redistribution and use in source and binary forms, with or without
4// modification, are permitted provided that the following conditions
5// are met:
6// 1. Redistributions of source code must retain the above copyright
7//    notice, this list of conditions and the following disclaimer.
8// 2. Redistributions in binary form must reproduce the above copyright
9//    notice, this list of conditions and the following disclaimer in the
10//    documentation and/or other materials provided with the distribution.
11//
12// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15// ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22// SUCH DAMAGE.
23//
24// This file is automatically generated. Do not edit.
25//
26// Source: https://github.com/NuxiNL/cloudabi
27
28#define ENTRY(name)      \
29  .text;                 \
30  .p2align 4, 0x90;      \
31  .global name;          \
32  .type name, @function; \
33name:
34
35#define END(name) .size name, . - name
36
37ENTRY(cloudabi_sys_clock_res_get)
38  push %rsi
39  mov $0, %eax
40  syscall
41  pop %rcx
42  jc 1f
43  mov %rax, (%rcx)
44  xor %eax, %eax
451:
46  ret
47END(cloudabi_sys_clock_res_get)
48
49ENTRY(cloudabi_sys_clock_time_get)
50  push %rdx
51  mov $1, %eax
52  syscall
53  pop %rcx
54  jc 1f
55  mov %rax, (%rcx)
56  xor %eax, %eax
571:
58  ret
59END(cloudabi_sys_clock_time_get)
60
61ENTRY(cloudabi_sys_condvar_signal)
62  mov $2, %eax
63  syscall
64  ret
65END(cloudabi_sys_condvar_signal)
66
67ENTRY(cloudabi_sys_fd_close)
68  mov $3, %eax
69  syscall
70  ret
71END(cloudabi_sys_fd_close)
72
73ENTRY(cloudabi_sys_fd_create1)
74  push %rsi
75  mov $4, %eax
76  syscall
77  pop %rcx
78  jc 1f
79  mov %eax, (%rcx)
80  xor %eax, %eax
811:
82  ret
83END(cloudabi_sys_fd_create1)
84
85ENTRY(cloudabi_sys_fd_create2)
86  push %rsi
87  push %rdx
88  mov $5, %eax
89  syscall
90  pop %rsi
91  pop %rcx
92  jc 1f
93  mov %eax, (%rcx)
94  mov %edx, (%rsi)
95  xor %eax, %eax
961:
97  ret
98END(cloudabi_sys_fd_create2)
99
100ENTRY(cloudabi_sys_fd_datasync)
101  mov $6, %eax
102  syscall
103  ret
104END(cloudabi_sys_fd_datasync)
105
106ENTRY(cloudabi_sys_fd_dup)
107  push %rsi
108  mov $7, %eax
109  syscall
110  pop %rcx
111  jc 1f
112  mov %eax, (%rcx)
113  xor %eax, %eax
1141:
115  ret
116END(cloudabi_sys_fd_dup)
117
118ENTRY(cloudabi_sys_fd_pread)
119  mov %rcx, %r10
120  push %r8
121  mov $8, %eax
122  syscall
123  pop %rcx
124  jc 1f
125  mov %rax, (%rcx)
126  xor %eax, %eax
1271:
128  ret
129END(cloudabi_sys_fd_pread)
130
131ENTRY(cloudabi_sys_fd_pwrite)
132  mov %rcx, %r10
133  push %r8
134  mov $9, %eax
135  syscall
136  pop %rcx
137  jc 1f
138  mov %rax, (%rcx)
139  xor %eax, %eax
1401:
141  ret
142END(cloudabi_sys_fd_pwrite)
143
144ENTRY(cloudabi_sys_fd_read)
145  push %rcx
146  mov $10, %eax
147  syscall
148  pop %rcx
149  jc 1f
150  mov %rax, (%rcx)
151  xor %eax, %eax
1521:
153  ret
154END(cloudabi_sys_fd_read)
155
156ENTRY(cloudabi_sys_fd_replace)
157  mov $11, %eax
158  syscall
159  ret
160END(cloudabi_sys_fd_replace)
161
162ENTRY(cloudabi_sys_fd_seek)
163  push %rcx
164  mov $12, %eax
165  syscall
166  pop %rcx
167  jc 1f
168  mov %rax, (%rcx)
169  xor %eax, %eax
1701:
171  ret
172END(cloudabi_sys_fd_seek)
173
174ENTRY(cloudabi_sys_fd_stat_get)
175  mov $13, %eax
176  syscall
177  ret
178END(cloudabi_sys_fd_stat_get)
179
180ENTRY(cloudabi_sys_fd_stat_put)
181  mov $14, %eax
182  syscall
183  ret
184END(cloudabi_sys_fd_stat_put)
185
186ENTRY(cloudabi_sys_fd_sync)
187  mov $15, %eax
188  syscall
189  ret
190END(cloudabi_sys_fd_sync)
191
192ENTRY(cloudabi_sys_fd_write)
193  push %rcx
194  mov $16, %eax
195  syscall
196  pop %rcx
197  jc 1f
198  mov %rax, (%rcx)
199  xor %eax, %eax
2001:
201  ret
202END(cloudabi_sys_fd_write)
203
204ENTRY(cloudabi_sys_file_advise)
205  mov %rcx, %r10
206  mov $17, %eax
207  syscall
208  ret
209END(cloudabi_sys_file_advise)
210
211ENTRY(cloudabi_sys_file_allocate)
212  mov $18, %eax
213  syscall
214  ret
215END(cloudabi_sys_file_allocate)
216
217ENTRY(cloudabi_sys_file_create)
218  mov %rcx, %r10
219  mov $19, %eax
220  syscall
221  ret
222END(cloudabi_sys_file_create)
223
224ENTRY(cloudabi_sys_file_link)
225  mov %rcx, %r10
226  mov $20, %eax
227  syscall
228  ret
229END(cloudabi_sys_file_link)
230
231ENTRY(cloudabi_sys_file_open)
232  mov %rcx, %r10
233  push %r9
234  mov $21, %eax
235  syscall
236  pop %rcx
237  jc 1f
238  mov %eax, (%rcx)
239  xor %eax, %eax
2401:
241  ret
242END(cloudabi_sys_file_open)
243
244ENTRY(cloudabi_sys_file_readdir)
245  mov %rcx, %r10
246  push %r8
247  mov $22, %eax
248  syscall
249  pop %rcx
250  jc 1f
251  mov %rax, (%rcx)
252  xor %eax, %eax
2531:
254  ret
255END(cloudabi_sys_file_readdir)
256
257ENTRY(cloudabi_sys_file_readlink)
258  mov %rcx, %r10
259  push %r9
260  mov $23, %eax
261  syscall
262  pop %rcx
263  jc 1f
264  mov %rax, (%rcx)
265  xor %eax, %eax
2661:
267  ret
268END(cloudabi_sys_file_readlink)
269
270ENTRY(cloudabi_sys_file_rename)
271  mov %rcx, %r10
272  mov $24, %eax
273  syscall
274  ret
275END(cloudabi_sys_file_rename)
276
277ENTRY(cloudabi_sys_file_stat_fget)
278  mov $25, %eax
279  syscall
280  ret
281END(cloudabi_sys_file_stat_fget)
282
283ENTRY(cloudabi_sys_file_stat_fput)
284  mov $26, %eax
285  syscall
286  ret
287END(cloudabi_sys_file_stat_fput)
288
289ENTRY(cloudabi_sys_file_stat_get)
290  mov %rcx, %r10
291  mov $27, %eax
292  syscall
293  ret
294END(cloudabi_sys_file_stat_get)
295
296ENTRY(cloudabi_sys_file_stat_put)
297  mov %rcx, %r10
298  mov $28, %eax
299  syscall
300  ret
301END(cloudabi_sys_file_stat_put)
302
303ENTRY(cloudabi_sys_file_symlink)
304  mov %rcx, %r10
305  mov $29, %eax
306  syscall
307  ret
308END(cloudabi_sys_file_symlink)
309
310ENTRY(cloudabi_sys_file_unlink)
311  mov %rcx, %r10
312  mov $30, %eax
313  syscall
314  ret
315END(cloudabi_sys_file_unlink)
316
317ENTRY(cloudabi_sys_lock_unlock)
318  mov $31, %eax
319  syscall
320  ret
321END(cloudabi_sys_lock_unlock)
322
323ENTRY(cloudabi_sys_mem_advise)
324  mov $32, %eax
325  syscall
326  ret
327END(cloudabi_sys_mem_advise)
328
329ENTRY(cloudabi_sys_mem_map)
330  mov %rcx, %r10
331  mov $33, %eax
332  syscall
333  jc 1f
334  mov 8(%rsp), %rcx
335  mov %rax, (%rcx)
336  xor %eax, %eax
3371:
338  ret
339END(cloudabi_sys_mem_map)
340
341ENTRY(cloudabi_sys_mem_protect)
342  mov $34, %eax
343  syscall
344  ret
345END(cloudabi_sys_mem_protect)
346
347ENTRY(cloudabi_sys_mem_sync)
348  mov $35, %eax
349  syscall
350  ret
351END(cloudabi_sys_mem_sync)
352
353ENTRY(cloudabi_sys_mem_unmap)
354  mov $36, %eax
355  syscall
356  ret
357END(cloudabi_sys_mem_unmap)
358
359ENTRY(cloudabi_sys_poll)
360  push %rcx
361  mov $37, %eax
362  syscall
363  pop %rcx
364  jc 1f
365  mov %rax, (%rcx)
366  xor %eax, %eax
3671:
368  ret
369END(cloudabi_sys_poll)
370
371ENTRY(cloudabi_sys_proc_exec)
372  mov %rcx, %r10
373  mov $38, %eax
374  syscall
375  ret
376END(cloudabi_sys_proc_exec)
377
378ENTRY(cloudabi_sys_proc_exit)
379  mov $39, %eax
380  syscall
381END(cloudabi_sys_proc_exit)
382
383ENTRY(cloudabi_sys_proc_fork)
384  push %rdi
385  push %rsi
386  mov $40, %eax
387  syscall
388  pop %rsi
389  pop %rcx
390  jc 1f
391  mov %eax, (%rcx)
392  mov %edx, (%rsi)
393  xor %eax, %eax
3941:
395  ret
396END(cloudabi_sys_proc_fork)
397
398ENTRY(cloudabi_sys_proc_raise)
399  mov $41, %eax
400  syscall
401  ret
402END(cloudabi_sys_proc_raise)
403
404ENTRY(cloudabi_sys_random_get)
405  mov $42, %eax
406  syscall
407  ret
408END(cloudabi_sys_random_get)
409
410ENTRY(cloudabi_sys_sock_recv)
411  mov $43, %eax
412  syscall
413  ret
414END(cloudabi_sys_sock_recv)
415
416ENTRY(cloudabi_sys_sock_send)
417  mov $44, %eax
418  syscall
419  ret
420END(cloudabi_sys_sock_send)
421
422ENTRY(cloudabi_sys_sock_shutdown)
423  mov $45, %eax
424  syscall
425  ret
426END(cloudabi_sys_sock_shutdown)
427
428ENTRY(cloudabi_sys_thread_create)
429  push %rsi
430  mov $46, %eax
431  syscall
432  pop %rcx
433  jc 1f
434  mov %eax, (%rcx)
435  xor %eax, %eax
4361:
437  ret
438END(cloudabi_sys_thread_create)
439
440ENTRY(cloudabi_sys_thread_exit)
441  mov $47, %eax
442  syscall
443END(cloudabi_sys_thread_exit)
444
445ENTRY(cloudabi_sys_thread_yield)
446  mov $48, %eax
447  syscall
448  ret
449END(cloudabi_sys_thread_yield)
450