freebsd-nq/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S
Ed Schouten 22f2f875ad Make execution of 32-bit CloudABI executables work on amd64.
A nice thing about requiring a vDSO is that it makes it incredibly easy
to provide full support for running 32-bit processes on 64-bit systems.
Instead of letting the kernel be responsible for composing/decomposing
64-bit arguments across multiple registers/stack slots, all of this can
now be done in the vDSO. This means that there is no need to provide
duplicate copies of certain system calls, like the sys_lseek() and
freebsd32_lseek() we have for COMPAT_FREEBSD32.

This change imports a new vDSO from the CloudABI repository that has
automatically generated code in it that copies system call arguments
into a buffer, padding them to eight bytes and zero-extending any
pointers/size_t arguments. After returning from the kernel, it does the
inverse: extracting return values, in the process truncating
pointers/size_t values to 32 bits.

Obtained from:	https://github.com/NuxiNL/cloudabi
2016-08-24 10:51:33 +00:00

1224 lines
22 KiB
ArmAsm

// Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE.
//
// This file is automatically generated. Do not edit.
//
// Source: https://github.com/NuxiNL/cloudabi
#define ENTRY(name) \
.text; \
.p2align 2, 0x90; \
.global name; \
.type name, @function; \
name:
#define END(name) .size name, . - name
ENTRY(cloudabi_sys_clock_res_get)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov $0, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 12(%ebp), %ecx
mov -16(%ebp), %edx
mov %edx, 0(%ecx)
mov -12(%ebp), %edx
mov %edx, 4(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_clock_res_get)
ENTRY(cloudabi_sys_clock_time_get)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -4(%ebp)
mov $1, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 20(%ebp), %ecx
mov -16(%ebp), %edx
mov %edx, 0(%ecx)
mov -12(%ebp), %edx
mov %edx, 4(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_clock_time_get)
ENTRY(cloudabi_sys_condvar_signal)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $2, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_condvar_signal)
ENTRY(cloudabi_sys_fd_close)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov $3, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_fd_close)
ENTRY(cloudabi_sys_fd_create1)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov $4, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 12(%ebp), %ecx
mov -16(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_fd_create1)
ENTRY(cloudabi_sys_fd_create2)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov $5, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 12(%ebp), %ecx
mov -16(%ebp), %edx
mov %edx, 0(%ecx)
mov 16(%ebp), %ecx
mov -8(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_fd_create2)
ENTRY(cloudabi_sys_fd_datasync)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov $6, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_fd_datasync)
ENTRY(cloudabi_sys_fd_dup)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov $7, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 12(%ebp), %ecx
mov -16(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_fd_dup)
ENTRY(cloudabi_sys_fd_pread)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -32(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -8(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -4(%ebp)
mov $8, %eax
mov %ebp, %ecx
sub $32, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 28(%ebp), %ecx
mov -32(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_fd_pread)
ENTRY(cloudabi_sys_fd_pwrite)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -32(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -8(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -4(%ebp)
mov $9, %eax
mov %ebp, %ecx
sub $32, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 28(%ebp), %ecx
mov -32(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_fd_pwrite)
ENTRY(cloudabi_sys_fd_read)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $10, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 20(%ebp), %ecx
mov -24(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_fd_read)
ENTRY(cloudabi_sys_fd_replace)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $11, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_fd_replace)
ENTRY(cloudabi_sys_fd_seek)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -12(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $12, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 24(%ebp), %ecx
mov -24(%ebp), %edx
mov %edx, 0(%ecx)
mov -20(%ebp), %edx
mov %edx, 4(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_fd_seek)
ENTRY(cloudabi_sys_fd_stat_get)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $13, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_fd_stat_get)
ENTRY(cloudabi_sys_fd_stat_put)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $14, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_fd_stat_put)
ENTRY(cloudabi_sys_fd_sync)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov $15, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_fd_sync)
ENTRY(cloudabi_sys_fd_write)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $16, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 20(%ebp), %ecx
mov -24(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_fd_write)
ENTRY(cloudabi_sys_file_advise)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -32(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -20(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -12(%ebp)
mov 28(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $17, %eax
mov %ebp, %ecx
sub $32, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_file_advise)
ENTRY(cloudabi_sys_file_allocate)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -12(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -8(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -4(%ebp)
mov $18, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_file_allocate)
ENTRY(cloudabi_sys_file_create)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -32(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $19, %eax
mov %ebp, %ecx
sub $32, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_file_create)
ENTRY(cloudabi_sys_file_link)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -48(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -44(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -40(%ebp)
movl $0, -36(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -32(%ebp)
movl $0, -28(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 28(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 32(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $20, %eax
mov %ebp, %ecx
sub $48, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_file_link)
ENTRY(cloudabi_sys_file_open)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -40(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -36(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -32(%ebp)
movl $0, -28(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 28(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $21, %eax
mov %ebp, %ecx
sub $40, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 32(%ebp), %ecx
mov -40(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_file_open)
ENTRY(cloudabi_sys_file_readdir)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -32(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -8(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -4(%ebp)
mov $22, %eax
mov %ebp, %ecx
sub $32, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 28(%ebp), %ecx
mov -32(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_file_readdir)
ENTRY(cloudabi_sys_file_readlink)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -40(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -32(%ebp)
movl $0, -28(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $23, %eax
mov %ebp, %ecx
sub $40, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 28(%ebp), %ecx
mov -40(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_file_readlink)
ENTRY(cloudabi_sys_file_rename)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -48(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -40(%ebp)
movl $0, -36(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -32(%ebp)
movl $0, -28(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 28(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $24, %eax
mov %ebp, %ecx
sub $48, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_file_rename)
ENTRY(cloudabi_sys_file_stat_fget)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $25, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_file_stat_fget)
ENTRY(cloudabi_sys_file_stat_fput)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $26, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_file_stat_fput)
ENTRY(cloudabi_sys_file_stat_get)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -32(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -28(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $27, %eax
mov %ebp, %ecx
sub $32, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_file_stat_get)
ENTRY(cloudabi_sys_file_stat_put)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -40(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -36(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -32(%ebp)
movl $0, -28(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 28(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $28, %eax
mov %ebp, %ecx
sub $40, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_file_stat_put)
ENTRY(cloudabi_sys_file_symlink)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -40(%ebp)
movl $0, -36(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -32(%ebp)
movl $0, -28(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $29, %eax
mov %ebp, %ecx
sub $40, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_file_symlink)
ENTRY(cloudabi_sys_file_unlink)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -32(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $30, %eax
mov %ebp, %ecx
sub $32, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_file_unlink)
ENTRY(cloudabi_sys_lock_unlock)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $31, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_lock_unlock)
ENTRY(cloudabi_sys_mem_advise)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $32, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_mem_advise)
ENTRY(cloudabi_sys_mem_lock)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $33, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_mem_lock)
ENTRY(cloudabi_sys_mem_map)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -48(%ebp)
movl $0, -44(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -40(%ebp)
movl $0, -36(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -32(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 28(%ebp), %ecx
mov %ecx, -8(%ebp)
mov 32(%ebp), %ecx
mov %ecx, -4(%ebp)
mov $34, %eax
mov %ebp, %ecx
sub $48, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 36(%ebp), %ecx
mov -48(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_mem_map)
ENTRY(cloudabi_sys_mem_protect)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $35, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_mem_protect)
ENTRY(cloudabi_sys_mem_sync)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $36, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_mem_sync)
ENTRY(cloudabi_sys_mem_unlock)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $37, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_mem_unlock)
ENTRY(cloudabi_sys_mem_unmap)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $38, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_mem_unmap)
ENTRY(cloudabi_sys_poll)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $39, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 20(%ebp), %ecx
mov -24(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_poll)
ENTRY(cloudabi_sys_poll_fd)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -48(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -40(%ebp)
movl $0, -36(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -32(%ebp)
movl $0, -28(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 28(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $40, %eax
mov %ebp, %ecx
sub $48, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 32(%ebp), %ecx
mov -48(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_poll_fd)
ENTRY(cloudabi_sys_proc_exec)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -40(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -32(%ebp)
movl $0, -28(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -24(%ebp)
movl $0, -20(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 24(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $41, %eax
mov %ebp, %ecx
sub $40, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_proc_exec)
ENTRY(cloudabi_sys_proc_exit)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov $42, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
END(cloudabi_sys_proc_exit)
ENTRY(cloudabi_sys_proc_fork)
push %ebp
mov %esp, %ebp
mov $43, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 8(%ebp), %ecx
mov -16(%ebp), %edx
mov %edx, 0(%ecx)
mov 12(%ebp), %ecx
mov -8(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_proc_fork)
ENTRY(cloudabi_sys_proc_raise)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov $44, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_proc_raise)
ENTRY(cloudabi_sys_random_get)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $45, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_random_get)
ENTRY(cloudabi_sys_sock_accept)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $46, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 16(%ebp), %ecx
mov -16(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_sock_accept)
ENTRY(cloudabi_sys_sock_bind)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -32(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $47, %eax
mov %ebp, %ecx
sub $32, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_sock_bind)
ENTRY(cloudabi_sys_sock_connect)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -32(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 20(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $48, %eax
mov %ebp, %ecx
sub $32, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_sock_connect)
ENTRY(cloudabi_sys_sock_listen)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $49, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_sock_listen)
ENTRY(cloudabi_sys_sock_recv)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $50, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_sock_recv)
ENTRY(cloudabi_sys_sock_send)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
movl $0, -4(%ebp)
mov $51, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_sock_send)
ENTRY(cloudabi_sys_sock_shutdown)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $52, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_sock_shutdown)
ENTRY(cloudabi_sys_sock_stat_get)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -24(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 16(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $53, %eax
mov %ebp, %ecx
sub $24, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_sock_stat_get)
ENTRY(cloudabi_sys_thread_create)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov $54, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
test %eax, %eax
jnz 1f
mov 12(%ebp), %ecx
mov -16(%ebp), %edx
mov %edx, 0(%ecx)
1:
pop %ebp
ret
END(cloudabi_sys_thread_create)
ENTRY(cloudabi_sys_thread_exit)
push %ebp
mov %esp, %ebp
mov 8(%ebp), %ecx
mov %ecx, -16(%ebp)
movl $0, -12(%ebp)
mov 12(%ebp), %ecx
mov %ecx, -8(%ebp)
mov $55, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
END(cloudabi_sys_thread_exit)
ENTRY(cloudabi_sys_thread_yield)
push %ebp
mov %esp, %ebp
mov $56, %eax
mov %ebp, %ecx
sub $16, %ecx
int $0x80
pop %ebp
ret
END(cloudabi_sys_thread_yield)