diff options
Diffstat (limited to 'sys/contrib')
-rw-r--r-- | sys/contrib/cloudabi/cloudabi32_types.h | 232 | ||||
-rw-r--r-- | sys/contrib/cloudabi/cloudabi64_types.h | 311 | ||||
-rw-r--r-- | sys/contrib/cloudabi/cloudabi_types_common.h | 541 | ||||
-rw-r--r-- | sys/contrib/cloudabi/cloudabi_vdso_aarch64.S | 491 | ||||
-rw-r--r-- | sys/contrib/cloudabi/cloudabi_vdso_armv6.S | 451 | ||||
-rw-r--r-- | sys/contrib/cloudabi/cloudabi_vdso_i686.S | 477 | ||||
-rw-r--r-- | sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S | 1223 | ||||
-rw-r--r-- | sys/contrib/cloudabi/cloudabi_vdso_x86_64.S | 511 | ||||
-rw-r--r-- | sys/contrib/cloudabi/syscalls32.master | 315 | ||||
-rw-r--r-- | sys/contrib/cloudabi/syscalls64.master (renamed from sys/contrib/cloudabi/syscalls.master) | 49 |
10 files changed, 4180 insertions, 421 deletions
diff --git a/sys/contrib/cloudabi/cloudabi32_types.h b/sys/contrib/cloudabi/cloudabi32_types.h new file mode 100644 index 0000000..71d6429 --- /dev/null +++ b/sys/contrib/cloudabi/cloudabi32_types.h @@ -0,0 +1,232 @@ +// 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 + +#ifndef CLOUDABI32_TYPES_H +#define CLOUDABI32_TYPES_H + +#include "cloudabi_types_common.h" + +typedef struct { + _Alignas(4) cloudabi_auxtype_t a_type; + union { + _Alignas(4) uint32_t a_val; + _Alignas(4) uint32_t a_ptr; + }; +} cloudabi32_auxv_t; +_Static_assert(offsetof(cloudabi32_auxv_t, a_type) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_auxv_t, a_val) == 4, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_auxv_t, a_ptr) == 4, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_auxv_t) == 8, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_auxv_t) == 4, "Incorrect layout"); + +typedef struct { + _Alignas(4) uint32_t iov_base; + _Alignas(4) uint32_t iov_len; +} cloudabi32_ciovec_t; +_Static_assert(offsetof(cloudabi32_ciovec_t, iov_base) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_ciovec_t, iov_len) == 4, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_ciovec_t) == 8, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_ciovec_t) == 4, "Incorrect layout"); + +typedef struct { + _Alignas(8) cloudabi_userdata_t userdata; + _Alignas(2) cloudabi_errno_t error; + _Alignas(1) cloudabi_eventtype_t type; + union { + struct { + _Alignas(8) cloudabi_userdata_t identifier; + } clock; + struct { + _Alignas(4) uint32_t condvar; + } condvar; + struct { + _Alignas(8) cloudabi_filesize_t nbytes; + _Alignas(4) cloudabi_fd_t fd; + _Alignas(2) cloudabi_eventrwflags_t flags; + } fd_readwrite; + struct { + _Alignas(4) uint32_t lock; + } lock; + struct { + _Alignas(4) cloudabi_fd_t fd; + _Alignas(1) cloudabi_signal_t signal; + _Alignas(4) cloudabi_exitcode_t exitcode; + } proc_terminate; + }; +} cloudabi32_event_t; +_Static_assert(offsetof(cloudabi32_event_t, userdata) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_event_t, error) == 8, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_event_t, type) == 10, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_event_t, clock.identifier) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_event_t, condvar.condvar) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_event_t, fd_readwrite.nbytes) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_event_t, fd_readwrite.fd) == 24, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_event_t, fd_readwrite.flags) == 28, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_event_t, lock.lock) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_event_t, proc_terminate.fd) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_event_t, proc_terminate.signal) == 20, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_event_t, proc_terminate.exitcode) == 24, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_event_t) == 32, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_event_t) == 8, "Incorrect layout"); + +typedef struct { + _Alignas(4) uint32_t iov_base; + _Alignas(4) uint32_t iov_len; +} cloudabi32_iovec_t; +_Static_assert(offsetof(cloudabi32_iovec_t, iov_base) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_iovec_t, iov_len) == 4, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_iovec_t) == 8, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_iovec_t) == 4, "Incorrect layout"); + +typedef void cloudabi32_processentry_t(uint32_t auxv); + +typedef struct { + _Alignas(4) uint32_t ri_data; + _Alignas(4) uint32_t ri_datalen; + _Alignas(4) uint32_t ri_fds; + _Alignas(4) uint32_t ri_fdslen; + _Alignas(2) cloudabi_msgflags_t ri_flags; +} cloudabi32_recv_in_t; +_Static_assert(offsetof(cloudabi32_recv_in_t, ri_data) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_recv_in_t, ri_datalen) == 4, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_recv_in_t, ri_fds) == 8, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_recv_in_t, ri_fdslen) == 12, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_recv_in_t, ri_flags) == 16, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_recv_in_t) == 20, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_recv_in_t) == 4, "Incorrect layout"); + +typedef struct { + _Alignas(4) uint32_t si_data; + _Alignas(4) uint32_t si_datalen; + _Alignas(4) uint32_t si_fds; + _Alignas(4) uint32_t si_fdslen; + _Alignas(2) cloudabi_msgflags_t si_flags; +} cloudabi32_send_in_t; +_Static_assert(offsetof(cloudabi32_send_in_t, si_data) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_send_in_t, si_datalen) == 4, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_send_in_t, si_fds) == 8, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_send_in_t, si_fdslen) == 12, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_send_in_t, si_flags) == 16, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_send_in_t) == 20, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_send_in_t) == 4, "Incorrect layout"); + +typedef struct { + _Alignas(4) uint32_t so_datalen; +} cloudabi32_send_out_t; +_Static_assert(offsetof(cloudabi32_send_out_t, so_datalen) == 0, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_send_out_t) == 4, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_send_out_t) == 4, "Incorrect layout"); + +typedef struct { + _Alignas(8) cloudabi_userdata_t userdata; + _Alignas(2) cloudabi_subflags_t flags; + _Alignas(1) cloudabi_eventtype_t type; + union { + struct { + _Alignas(8) cloudabi_userdata_t identifier; + _Alignas(4) cloudabi_clockid_t clock_id; + _Alignas(8) cloudabi_timestamp_t timeout; + _Alignas(8) cloudabi_timestamp_t precision; + _Alignas(2) cloudabi_subclockflags_t flags; + } clock; + struct { + _Alignas(4) uint32_t condvar; + _Alignas(4) uint32_t lock; + _Alignas(1) cloudabi_scope_t condvar_scope; + _Alignas(1) cloudabi_scope_t lock_scope; + } condvar; + struct { + _Alignas(4) cloudabi_fd_t fd; + _Alignas(2) cloudabi_subrwflags_t flags; + } fd_readwrite; + struct { + _Alignas(4) uint32_t lock; + _Alignas(1) cloudabi_scope_t lock_scope; + } lock; + struct { + _Alignas(4) cloudabi_fd_t fd; + } proc_terminate; + }; +} cloudabi32_subscription_t; +_Static_assert(offsetof(cloudabi32_subscription_t, userdata) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, flags) == 8, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, type) == 10, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, clock.identifier) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, clock.clock_id) == 24, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, clock.timeout) == 32, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, clock.precision) == 40, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, clock.flags) == 48, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, condvar.condvar) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, condvar.lock) == 20, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, condvar.condvar_scope) == 24, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, condvar.lock_scope) == 25, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, fd_readwrite.fd) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, fd_readwrite.flags) == 20, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, lock.lock) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, lock.lock_scope) == 20, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_subscription_t, proc_terminate.fd) == 16, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_subscription_t) == 56, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_subscription_t) == 8, "Incorrect layout"); + +typedef struct { + _Alignas(4) uint32_t parent; +} cloudabi32_tcb_t; +_Static_assert(offsetof(cloudabi32_tcb_t, parent) == 0, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_tcb_t) == 4, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_tcb_t) == 4, "Incorrect layout"); + +typedef void cloudabi32_threadentry_t(cloudabi_tid_t tid, uint32_t aux); + +typedef struct { + _Alignas(4) uint32_t ro_datalen; + _Alignas(4) uint32_t ro_fdslen; + _Alignas(2) cloudabi_sockaddr_t ro_sockname; + _Alignas(2) cloudabi_sockaddr_t ro_peername; + _Alignas(2) cloudabi_msgflags_t ro_flags; +} cloudabi32_recv_out_t; +_Static_assert(offsetof(cloudabi32_recv_out_t, ro_datalen) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_recv_out_t, ro_fdslen) == 4, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_recv_out_t, ro_sockname) == 8, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_recv_out_t, ro_peername) == 28, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_recv_out_t, ro_flags) == 48, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_recv_out_t) == 52, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_recv_out_t) == 4, "Incorrect layout"); + +typedef struct { + _Alignas(4) uint32_t entry_point; + _Alignas(4) uint32_t stack; + _Alignas(4) uint32_t stack_size; + _Alignas(4) uint32_t argument; +} cloudabi32_threadattr_t; +_Static_assert(offsetof(cloudabi32_threadattr_t, entry_point) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_threadattr_t, stack) == 4, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_threadattr_t, stack_size) == 8, "Incorrect layout"); +_Static_assert(offsetof(cloudabi32_threadattr_t, argument) == 12, "Incorrect layout"); +_Static_assert(sizeof(cloudabi32_threadattr_t) == 16, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi32_threadattr_t) == 4, "Incorrect layout"); + +#endif diff --git a/sys/contrib/cloudabi/cloudabi64_types.h b/sys/contrib/cloudabi/cloudabi64_types.h index cb354d4..5d54e7e 100644 --- a/sys/contrib/cloudabi/cloudabi64_types.h +++ b/sys/contrib/cloudabi/cloudabi64_types.h @@ -31,11 +31,11 @@ #include "cloudabi_types_common.h" typedef struct { - _Alignas(4) cloudabi_auxtype_t a_type; - union { - _Alignas(8) uint64_t a_val; - _Alignas(8) uint64_t a_ptr; - }; + _Alignas(4) cloudabi_auxtype_t a_type; + union { + _Alignas(8) uint64_t a_val; + _Alignas(8) uint64_t a_ptr; + }; } cloudabi64_auxv_t; _Static_assert(offsetof(cloudabi64_auxv_t, a_type) == 0, "Incorrect layout"); _Static_assert(offsetof(cloudabi64_auxv_t, a_val) == 8, "Incorrect layout"); @@ -44,58 +44,68 @@ _Static_assert(sizeof(cloudabi64_auxv_t) == 16, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_auxv_t) == 8, "Incorrect layout"); typedef struct { - _Alignas(8) uint64_t iov_base; - _Alignas(8) uint64_t iov_len; + _Alignas(8) uint64_t iov_base; + _Alignas(8) uint64_t iov_len; } cloudabi64_ciovec_t; -_Static_assert(offsetof(cloudabi64_ciovec_t, iov_base) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_ciovec_t, iov_base) == 0, + "Incorrect layout"); _Static_assert(offsetof(cloudabi64_ciovec_t, iov_len) == 8, "Incorrect layout"); _Static_assert(sizeof(cloudabi64_ciovec_t) == 16, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_ciovec_t) == 8, "Incorrect layout"); typedef struct { - _Alignas(8) cloudabi_userdata_t userdata; - _Alignas(2) cloudabi_errno_t error; - _Alignas(1) cloudabi_eventtype_t type; - union { - struct { - _Alignas(8) cloudabi_userdata_t identifier; - } clock; - struct { - _Alignas(8) uint64_t condvar; - } condvar; - struct { - _Alignas(8) cloudabi_filesize_t nbytes; - _Alignas(4) cloudabi_fd_t fd; - _Alignas(2) cloudabi_eventrwflags_t flags; - } fd_readwrite; - struct { - _Alignas(8) uint64_t lock; - } lock; - struct { - _Alignas(4) cloudabi_fd_t fd; - _Alignas(1) cloudabi_signal_t signal; - _Alignas(4) cloudabi_exitcode_t exitcode; - } proc_terminate; - }; + _Alignas(8) cloudabi_userdata_t userdata; + _Alignas(2) cloudabi_errno_t error; + _Alignas(1) cloudabi_eventtype_t type; + union { + struct { + _Alignas(8) cloudabi_userdata_t identifier; + } clock; + struct { + _Alignas(8) uint64_t condvar; + } condvar; + struct { + _Alignas(8) cloudabi_filesize_t nbytes; + _Alignas(4) cloudabi_fd_t fd; + _Alignas(2) cloudabi_eventrwflags_t flags; + } fd_readwrite; + struct { + _Alignas(8) uint64_t lock; + } lock; + struct { + _Alignas(4) cloudabi_fd_t fd; + _Alignas(1) cloudabi_signal_t signal; + _Alignas(4) cloudabi_exitcode_t exitcode; + } proc_terminate; + }; } cloudabi64_event_t; _Static_assert(offsetof(cloudabi64_event_t, userdata) == 0, "Incorrect layout"); _Static_assert(offsetof(cloudabi64_event_t, error) == 8, "Incorrect layout"); _Static_assert(offsetof(cloudabi64_event_t, type) == 10, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_event_t, clock.identifier) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_event_t, condvar.condvar) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.nbytes) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.fd) == 24, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.flags) == 28, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_event_t, lock.lock) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.fd) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.signal) == 20, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.exitcode) == 24, "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_event_t, clock.identifier) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_event_t, condvar.condvar) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.nbytes) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.fd) == 24, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.flags) == 28, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_event_t, lock.lock) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.fd) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.signal) == 20, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.exitcode) == 24, + "Incorrect layout"); _Static_assert(sizeof(cloudabi64_event_t) == 32, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_event_t) == 8, "Incorrect layout"); typedef struct { - _Alignas(8) uint64_t iov_base; - _Alignas(8) uint64_t iov_len; + _Alignas(8) uint64_t iov_base; + _Alignas(8) uint64_t iov_len; } cloudabi64_iovec_t; _Static_assert(offsetof(cloudabi64_iovec_t, iov_base) == 0, "Incorrect layout"); _Static_assert(offsetof(cloudabi64_iovec_t, iov_len) == 8, "Incorrect layout"); @@ -105,96 +115,120 @@ _Static_assert(_Alignof(cloudabi64_iovec_t) == 8, "Incorrect layout"); typedef void cloudabi64_processentry_t(uint64_t auxv); typedef struct { - _Alignas(8) uint64_t ri_data; - _Alignas(8) uint64_t ri_datalen; - _Alignas(8) uint64_t ri_fds; - _Alignas(8) uint64_t ri_fdslen; - _Alignas(2) cloudabi_msgflags_t ri_flags; + _Alignas(8) uint64_t ri_data; + _Alignas(8) uint64_t ri_datalen; + _Alignas(8) uint64_t ri_fds; + _Alignas(8) uint64_t ri_fdslen; + _Alignas(2) cloudabi_msgflags_t ri_flags; } cloudabi64_recv_in_t; -_Static_assert(offsetof(cloudabi64_recv_in_t, ri_data) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_in_t, ri_datalen) == 8, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_in_t, ri_fds) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_in_t, ri_fdslen) == 24, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_in_t, ri_flags) == 32, "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_in_t, ri_data) == 0, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_in_t, ri_datalen) == 8, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_in_t, ri_fds) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_in_t, ri_fdslen) == 24, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_in_t, ri_flags) == 32, + "Incorrect layout"); _Static_assert(sizeof(cloudabi64_recv_in_t) == 40, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_recv_in_t) == 8, "Incorrect layout"); typedef struct { - _Alignas(8) uint64_t si_data; - _Alignas(8) uint64_t si_datalen; - _Alignas(8) uint64_t si_fds; - _Alignas(8) uint64_t si_fdslen; - _Alignas(2) cloudabi_msgflags_t si_flags; + _Alignas(8) uint64_t si_data; + _Alignas(8) uint64_t si_datalen; + _Alignas(8) uint64_t si_fds; + _Alignas(8) uint64_t si_fdslen; + _Alignas(2) cloudabi_msgflags_t si_flags; } cloudabi64_send_in_t; -_Static_assert(offsetof(cloudabi64_send_in_t, si_data) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_send_in_t, si_datalen) == 8, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_send_in_t, si_fds) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_send_in_t, si_fdslen) == 24, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_send_in_t, si_flags) == 32, "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_send_in_t, si_data) == 0, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_send_in_t, si_datalen) == 8, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_send_in_t, si_fds) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_send_in_t, si_fdslen) == 24, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_send_in_t, si_flags) == 32, + "Incorrect layout"); _Static_assert(sizeof(cloudabi64_send_in_t) == 40, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_send_in_t) == 8, "Incorrect layout"); -typedef struct { - _Alignas(8) uint64_t so_datalen; -} cloudabi64_send_out_t; -_Static_assert(offsetof(cloudabi64_send_out_t, so_datalen) == 0, "Incorrect layout"); +typedef struct { _Alignas(8) uint64_t so_datalen; } cloudabi64_send_out_t; +_Static_assert(offsetof(cloudabi64_send_out_t, so_datalen) == 0, + "Incorrect layout"); _Static_assert(sizeof(cloudabi64_send_out_t) == 8, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_send_out_t) == 8, "Incorrect layout"); typedef struct { - _Alignas(8) cloudabi_userdata_t userdata; - _Alignas(2) cloudabi_subflags_t flags; - _Alignas(1) cloudabi_eventtype_t type; - union { - struct { - _Alignas(8) cloudabi_userdata_t identifier; - _Alignas(4) cloudabi_clockid_t clock_id; - _Alignas(8) cloudabi_timestamp_t timeout; - _Alignas(8) cloudabi_timestamp_t precision; - _Alignas(2) cloudabi_subclockflags_t flags; - } clock; - struct { - _Alignas(8) uint64_t condvar; - _Alignas(8) uint64_t lock; - _Alignas(1) cloudabi_scope_t condvar_scope; - _Alignas(1) cloudabi_scope_t lock_scope; - } condvar; - struct { - _Alignas(4) cloudabi_fd_t fd; - _Alignas(2) cloudabi_subrwflags_t flags; - } fd_readwrite; - struct { - _Alignas(8) uint64_t lock; - _Alignas(1) cloudabi_scope_t lock_scope; - } lock; - struct { - _Alignas(4) cloudabi_fd_t fd; - } proc_terminate; - }; + _Alignas(8) cloudabi_userdata_t userdata; + _Alignas(2) cloudabi_subflags_t flags; + _Alignas(1) cloudabi_eventtype_t type; + union { + struct { + _Alignas(8) cloudabi_userdata_t identifier; + _Alignas(4) cloudabi_clockid_t clock_id; + _Alignas(8) cloudabi_timestamp_t timeout; + _Alignas(8) cloudabi_timestamp_t precision; + _Alignas(2) cloudabi_subclockflags_t flags; + } clock; + struct { + _Alignas(8) uint64_t condvar; + _Alignas(8) uint64_t lock; + _Alignas(1) cloudabi_scope_t condvar_scope; + _Alignas(1) cloudabi_scope_t lock_scope; + } condvar; + struct { + _Alignas(4) cloudabi_fd_t fd; + _Alignas(2) cloudabi_subrwflags_t flags; + } fd_readwrite; + struct { + _Alignas(8) uint64_t lock; + _Alignas(1) cloudabi_scope_t lock_scope; + } lock; + struct { + _Alignas(4) cloudabi_fd_t fd; + } proc_terminate; + }; } cloudabi64_subscription_t; -_Static_assert(offsetof(cloudabi64_subscription_t, userdata) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, flags) == 8, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, type) == 10, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, clock.identifier) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, clock.clock_id) == 24, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, clock.timeout) == 32, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, clock.precision) == 40, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, clock.flags) == 48, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, condvar.condvar) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, condvar.lock) == 24, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, condvar.condvar_scope) == 32, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, condvar.lock_scope) == 33, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, fd_readwrite.fd) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, fd_readwrite.flags) == 20, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, lock.lock) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, lock.lock_scope) == 24, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_subscription_t, proc_terminate.fd) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, userdata) == 0, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, flags) == 8, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, type) == 10, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, clock.identifier) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, clock.clock_id) == 24, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, clock.timeout) == 32, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, clock.precision) == 40, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, clock.flags) == 48, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, condvar.condvar) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, condvar.lock) == 24, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, condvar.condvar_scope) == 32, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, condvar.lock_scope) == 33, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, fd_readwrite.fd) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, fd_readwrite.flags) == 20, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, lock.lock) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, lock.lock_scope) == 24, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_subscription_t, proc_terminate.fd) == 16, + "Incorrect layout"); _Static_assert(sizeof(cloudabi64_subscription_t) == 56, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_subscription_t) == 8, "Incorrect layout"); -typedef struct { - _Alignas(8) uint64_t parent; -} cloudabi64_tcb_t; +typedef struct { _Alignas(8) uint64_t parent; } cloudabi64_tcb_t; _Static_assert(offsetof(cloudabi64_tcb_t, parent) == 0, "Incorrect layout"); _Static_assert(sizeof(cloudabi64_tcb_t) == 8, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_tcb_t) == 8, "Incorrect layout"); @@ -202,30 +236,39 @@ _Static_assert(_Alignof(cloudabi64_tcb_t) == 8, "Incorrect layout"); typedef void cloudabi64_threadentry_t(cloudabi_tid_t tid, uint64_t aux); typedef struct { - _Alignas(8) uint64_t ro_datalen; - _Alignas(8) uint64_t ro_fdslen; - _Alignas(2) cloudabi_sockaddr_t ro_sockname; - _Alignas(2) cloudabi_sockaddr_t ro_peername; - _Alignas(2) cloudabi_msgflags_t ro_flags; + _Alignas(8) uint64_t ro_datalen; + _Alignas(8) uint64_t ro_fdslen; + _Alignas(2) cloudabi_sockaddr_t ro_sockname; + _Alignas(2) cloudabi_sockaddr_t ro_peername; + _Alignas(2) cloudabi_msgflags_t ro_flags; } cloudabi64_recv_out_t; -_Static_assert(offsetof(cloudabi64_recv_out_t, ro_datalen) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_out_t, ro_fdslen) == 8, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_out_t, ro_sockname) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_out_t, ro_peername) == 36, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_recv_out_t, ro_flags) == 56, "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_out_t, ro_datalen) == 0, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_out_t, ro_fdslen) == 8, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_out_t, ro_sockname) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_out_t, ro_peername) == 36, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_recv_out_t, ro_flags) == 56, + "Incorrect layout"); _Static_assert(sizeof(cloudabi64_recv_out_t) == 64, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_recv_out_t) == 8, "Incorrect layout"); typedef struct { - _Alignas(8) uint64_t entry_point; - _Alignas(8) uint64_t stack; - _Alignas(8) uint64_t stack_size; - _Alignas(8) uint64_t argument; + _Alignas(8) uint64_t entry_point; + _Alignas(8) uint64_t stack; + _Alignas(8) uint64_t stack_size; + _Alignas(8) uint64_t argument; } cloudabi64_threadattr_t; -_Static_assert(offsetof(cloudabi64_threadattr_t, entry_point) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_threadattr_t, stack) == 8, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_threadattr_t, stack_size) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi64_threadattr_t, argument) == 24, "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_threadattr_t, entry_point) == 0, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_threadattr_t, stack) == 8, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_threadattr_t, stack_size) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi64_threadattr_t, argument) == 24, + "Incorrect layout"); _Static_assert(sizeof(cloudabi64_threadattr_t) == 32, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_threadattr_t) == 8, "Incorrect layout"); diff --git a/sys/contrib/cloudabi/cloudabi_types_common.h b/sys/contrib/cloudabi/cloudabi_types_common.h index 83c61b9..0297e2a9 100644 --- a/sys/contrib/cloudabi/cloudabi_types_common.h +++ b/sys/contrib/cloudabi/cloudabi_types_common.h @@ -29,7 +29,7 @@ #define CLOUDABI_TYPES_COMMON_H #if defined(__FreeBSD__) && defined(_KERNEL) -#include <sys/stdint.h> +#include <sys/types.h> #elif defined(__linux__) && defined(__KERNEL__) #include <linux/types.h> #else @@ -38,33 +38,34 @@ #endif typedef uint8_t cloudabi_advice_t; -#define CLOUDABI_ADVICE_DONTNEED 1 -#define CLOUDABI_ADVICE_NOREUSE 2 -#define CLOUDABI_ADVICE_NORMAL 3 -#define CLOUDABI_ADVICE_RANDOM 4 +#define CLOUDABI_ADVICE_DONTNEED 1 +#define CLOUDABI_ADVICE_NOREUSE 2 +#define CLOUDABI_ADVICE_NORMAL 3 +#define CLOUDABI_ADVICE_RANDOM 4 #define CLOUDABI_ADVICE_SEQUENTIAL 5 -#define CLOUDABI_ADVICE_WILLNEED 6 +#define CLOUDABI_ADVICE_WILLNEED 6 typedef uint32_t cloudabi_auxtype_t; -#define CLOUDABI_AT_ARGDATA 256 +#define CLOUDABI_AT_ARGDATA 256 #define CLOUDABI_AT_ARGDATALEN 257 -#define CLOUDABI_AT_BASE 7 -#define CLOUDABI_AT_CANARY 258 -#define CLOUDABI_AT_CANARYLEN 259 -#define CLOUDABI_AT_NCPUS 260 -#define CLOUDABI_AT_NULL 0 -#define CLOUDABI_AT_PAGESZ 6 -#define CLOUDABI_AT_PHDR 3 -#define CLOUDABI_AT_PHNUM 4 -#define CLOUDABI_AT_TID 261 +#define CLOUDABI_AT_BASE 7 +#define CLOUDABI_AT_CANARY 258 +#define CLOUDABI_AT_CANARYLEN 259 +#define CLOUDABI_AT_NCPUS 260 +#define CLOUDABI_AT_NULL 0 +#define CLOUDABI_AT_PAGESZ 6 +#define CLOUDABI_AT_PHDR 3 +#define CLOUDABI_AT_PHNUM 4 +#define CLOUDABI_AT_SYSINFO_EHDR 262 +#define CLOUDABI_AT_TID 261 typedef uint32_t cloudabi_backlog_t; typedef uint32_t cloudabi_clockid_t; -#define CLOUDABI_CLOCK_MONOTONIC 1 +#define CLOUDABI_CLOCK_MONOTONIC 1 #define CLOUDABI_CLOCK_PROCESS_CPUTIME_ID 2 -#define CLOUDABI_CLOCK_REALTIME 3 -#define CLOUDABI_CLOCK_THREAD_CPUTIME_ID 4 +#define CLOUDABI_CLOCK_REALTIME 3 +#define CLOUDABI_CLOCK_THREAD_CPUTIME_ID 4 typedef uint32_t cloudabi_condvar_t; #define CLOUDABI_CONDVAR_HAS_NO_WAITERS 0 @@ -75,110 +76,110 @@ typedef uint64_t cloudabi_dircookie_t; #define CLOUDABI_DIRCOOKIE_START 0 typedef uint16_t cloudabi_errno_t; -#define CLOUDABI_E2BIG 1 -#define CLOUDABI_EACCES 2 -#define CLOUDABI_EADDRINUSE 3 -#define CLOUDABI_EADDRNOTAVAIL 4 -#define CLOUDABI_EAFNOSUPPORT 5 -#define CLOUDABI_EAGAIN 6 -#define CLOUDABI_EALREADY 7 -#define CLOUDABI_EBADF 8 -#define CLOUDABI_EBADMSG 9 -#define CLOUDABI_EBUSY 10 -#define CLOUDABI_ECANCELED 11 -#define CLOUDABI_ECHILD 12 -#define CLOUDABI_ECONNABORTED 13 -#define CLOUDABI_ECONNREFUSED 14 -#define CLOUDABI_ECONNRESET 15 -#define CLOUDABI_EDEADLK 16 -#define CLOUDABI_EDESTADDRREQ 17 -#define CLOUDABI_EDOM 18 -#define CLOUDABI_EDQUOT 19 -#define CLOUDABI_EEXIST 20 -#define CLOUDABI_EFAULT 21 -#define CLOUDABI_EFBIG 22 -#define CLOUDABI_EHOSTUNREACH 23 -#define CLOUDABI_EIDRM 24 -#define CLOUDABI_EILSEQ 25 -#define CLOUDABI_EINPROGRESS 26 -#define CLOUDABI_EINTR 27 -#define CLOUDABI_EINVAL 28 -#define CLOUDABI_EIO 29 -#define CLOUDABI_EISCONN 30 -#define CLOUDABI_EISDIR 31 -#define CLOUDABI_ELOOP 32 -#define CLOUDABI_EMFILE 33 -#define CLOUDABI_EMLINK 34 -#define CLOUDABI_EMSGSIZE 35 -#define CLOUDABI_EMULTIHOP 36 -#define CLOUDABI_ENAMETOOLONG 37 -#define CLOUDABI_ENETDOWN 38 -#define CLOUDABI_ENETRESET 39 -#define CLOUDABI_ENETUNREACH 40 -#define CLOUDABI_ENFILE 41 -#define CLOUDABI_ENOBUFS 42 -#define CLOUDABI_ENODEV 43 -#define CLOUDABI_ENOENT 44 -#define CLOUDABI_ENOEXEC 45 -#define CLOUDABI_ENOLCK 46 -#define CLOUDABI_ENOLINK 47 -#define CLOUDABI_ENOMEM 48 -#define CLOUDABI_ENOMSG 49 -#define CLOUDABI_ENOPROTOOPT 50 -#define CLOUDABI_ENOSPC 51 -#define CLOUDABI_ENOSYS 52 -#define CLOUDABI_ENOTCONN 53 -#define CLOUDABI_ENOTDIR 54 -#define CLOUDABI_ENOTEMPTY 55 +#define CLOUDABI_E2BIG 1 +#define CLOUDABI_EACCES 2 +#define CLOUDABI_EADDRINUSE 3 +#define CLOUDABI_EADDRNOTAVAIL 4 +#define CLOUDABI_EAFNOSUPPORT 5 +#define CLOUDABI_EAGAIN 6 +#define CLOUDABI_EALREADY 7 +#define CLOUDABI_EBADF 8 +#define CLOUDABI_EBADMSG 9 +#define CLOUDABI_EBUSY 10 +#define CLOUDABI_ECANCELED 11 +#define CLOUDABI_ECHILD 12 +#define CLOUDABI_ECONNABORTED 13 +#define CLOUDABI_ECONNREFUSED 14 +#define CLOUDABI_ECONNRESET 15 +#define CLOUDABI_EDEADLK 16 +#define CLOUDABI_EDESTADDRREQ 17 +#define CLOUDABI_EDOM 18 +#define CLOUDABI_EDQUOT 19 +#define CLOUDABI_EEXIST 20 +#define CLOUDABI_EFAULT 21 +#define CLOUDABI_EFBIG 22 +#define CLOUDABI_EHOSTUNREACH 23 +#define CLOUDABI_EIDRM 24 +#define CLOUDABI_EILSEQ 25 +#define CLOUDABI_EINPROGRESS 26 +#define CLOUDABI_EINTR 27 +#define CLOUDABI_EINVAL 28 +#define CLOUDABI_EIO 29 +#define CLOUDABI_EISCONN 30 +#define CLOUDABI_EISDIR 31 +#define CLOUDABI_ELOOP 32 +#define CLOUDABI_EMFILE 33 +#define CLOUDABI_EMLINK 34 +#define CLOUDABI_EMSGSIZE 35 +#define CLOUDABI_EMULTIHOP 36 +#define CLOUDABI_ENAMETOOLONG 37 +#define CLOUDABI_ENETDOWN 38 +#define CLOUDABI_ENETRESET 39 +#define CLOUDABI_ENETUNREACH 40 +#define CLOUDABI_ENFILE 41 +#define CLOUDABI_ENOBUFS 42 +#define CLOUDABI_ENODEV 43 +#define CLOUDABI_ENOENT 44 +#define CLOUDABI_ENOEXEC 45 +#define CLOUDABI_ENOLCK 46 +#define CLOUDABI_ENOLINK 47 +#define CLOUDABI_ENOMEM 48 +#define CLOUDABI_ENOMSG 49 +#define CLOUDABI_ENOPROTOOPT 50 +#define CLOUDABI_ENOSPC 51 +#define CLOUDABI_ENOSYS 52 +#define CLOUDABI_ENOTCONN 53 +#define CLOUDABI_ENOTDIR 54 +#define CLOUDABI_ENOTEMPTY 55 #define CLOUDABI_ENOTRECOVERABLE 56 -#define CLOUDABI_ENOTSOCK 57 -#define CLOUDABI_ENOTSUP 58 -#define CLOUDABI_ENOTTY 59 -#define CLOUDABI_ENXIO 60 -#define CLOUDABI_EOVERFLOW 61 -#define CLOUDABI_EOWNERDEAD 62 -#define CLOUDABI_EPERM 63 -#define CLOUDABI_EPIPE 64 -#define CLOUDABI_EPROTO 65 +#define CLOUDABI_ENOTSOCK 57 +#define CLOUDABI_ENOTSUP 58 +#define CLOUDABI_ENOTTY 59 +#define CLOUDABI_ENXIO 60 +#define CLOUDABI_EOVERFLOW 61 +#define CLOUDABI_EOWNERDEAD 62 +#define CLOUDABI_EPERM 63 +#define CLOUDABI_EPIPE 64 +#define CLOUDABI_EPROTO 65 #define CLOUDABI_EPROTONOSUPPORT 66 -#define CLOUDABI_EPROTOTYPE 67 -#define CLOUDABI_ERANGE 68 -#define CLOUDABI_EROFS 69 -#define CLOUDABI_ESPIPE 70 -#define CLOUDABI_ESRCH 71 -#define CLOUDABI_ESTALE 72 -#define CLOUDABI_ETIMEDOUT 73 -#define CLOUDABI_ETXTBSY 74 -#define CLOUDABI_EXDEV 75 -#define CLOUDABI_ENOTCAPABLE 76 +#define CLOUDABI_EPROTOTYPE 67 +#define CLOUDABI_ERANGE 68 +#define CLOUDABI_EROFS 69 +#define CLOUDABI_ESPIPE 70 +#define CLOUDABI_ESRCH 71 +#define CLOUDABI_ESTALE 72 +#define CLOUDABI_ETIMEDOUT 73 +#define CLOUDABI_ETXTBSY 74 +#define CLOUDABI_EXDEV 75 +#define CLOUDABI_ENOTCAPABLE 76 typedef uint16_t cloudabi_eventrwflags_t; #define CLOUDABI_EVENT_FD_READWRITE_HANGUP 0x0001 typedef uint8_t cloudabi_eventtype_t; -#define CLOUDABI_EVENTTYPE_CLOCK 1 -#define CLOUDABI_EVENTTYPE_CONDVAR 2 -#define CLOUDABI_EVENTTYPE_FD_READ 3 -#define CLOUDABI_EVENTTYPE_FD_WRITE 4 -#define CLOUDABI_EVENTTYPE_LOCK_RDLOCK 5 -#define CLOUDABI_EVENTTYPE_LOCK_WRLOCK 6 +#define CLOUDABI_EVENTTYPE_CLOCK 1 +#define CLOUDABI_EVENTTYPE_CONDVAR 2 +#define CLOUDABI_EVENTTYPE_FD_READ 3 +#define CLOUDABI_EVENTTYPE_FD_WRITE 4 +#define CLOUDABI_EVENTTYPE_LOCK_RDLOCK 5 +#define CLOUDABI_EVENTTYPE_LOCK_WRLOCK 6 #define CLOUDABI_EVENTTYPE_PROC_TERMINATE 7 typedef uint32_t cloudabi_exitcode_t; typedef uint32_t cloudabi_fd_t; #define CLOUDABI_PROCESS_CHILD 0xffffffff -#define CLOUDABI_MAP_ANON_FD 0xffffffff +#define CLOUDABI_MAP_ANON_FD 0xffffffff typedef uint16_t cloudabi_fdflags_t; -#define CLOUDABI_FDFLAG_APPEND 0x0001 -#define CLOUDABI_FDFLAG_DSYNC 0x0002 +#define CLOUDABI_FDFLAG_APPEND 0x0001 +#define CLOUDABI_FDFLAG_DSYNC 0x0002 #define CLOUDABI_FDFLAG_NONBLOCK 0x0004 -#define CLOUDABI_FDFLAG_RSYNC 0x0008 -#define CLOUDABI_FDFLAG_SYNC 0x0010 +#define CLOUDABI_FDFLAG_RSYNC 0x0008 +#define CLOUDABI_FDFLAG_SYNC 0x0010 typedef uint16_t cloudabi_fdsflags_t; -#define CLOUDABI_FDSTAT_FLAGS 0x0001 +#define CLOUDABI_FDSTAT_FLAGS 0x0001 #define CLOUDABI_FDSTAT_RIGHTS 0x0002 typedef int64_t cloudabi_filedelta_t; @@ -186,155 +187,155 @@ typedef int64_t cloudabi_filedelta_t; typedef uint64_t cloudabi_filesize_t; typedef uint8_t cloudabi_filetype_t; -#define CLOUDABI_FILETYPE_UNKNOWN 0 -#define CLOUDABI_FILETYPE_BLOCK_DEVICE 16 -#define CLOUDABI_FILETYPE_CHARACTER_DEVICE 17 -#define CLOUDABI_FILETYPE_DIRECTORY 32 -#define CLOUDABI_FILETYPE_FIFO 48 -#define CLOUDABI_FILETYPE_POLL 64 -#define CLOUDABI_FILETYPE_PROCESS 80 -#define CLOUDABI_FILETYPE_REGULAR_FILE 96 -#define CLOUDABI_FILETYPE_SHARED_MEMORY 112 -#define CLOUDABI_FILETYPE_SOCKET_DGRAM 128 +#define CLOUDABI_FILETYPE_UNKNOWN 0 +#define CLOUDABI_FILETYPE_BLOCK_DEVICE 16 +#define CLOUDABI_FILETYPE_CHARACTER_DEVICE 17 +#define CLOUDABI_FILETYPE_DIRECTORY 32 +#define CLOUDABI_FILETYPE_FIFO 48 +#define CLOUDABI_FILETYPE_POLL 64 +#define CLOUDABI_FILETYPE_PROCESS 80 +#define CLOUDABI_FILETYPE_REGULAR_FILE 96 +#define CLOUDABI_FILETYPE_SHARED_MEMORY 112 +#define CLOUDABI_FILETYPE_SOCKET_DGRAM 128 #define CLOUDABI_FILETYPE_SOCKET_SEQPACKET 129 -#define CLOUDABI_FILETYPE_SOCKET_STREAM 130 -#define CLOUDABI_FILETYPE_SYMBOLIC_LINK 144 +#define CLOUDABI_FILETYPE_SOCKET_STREAM 130 +#define CLOUDABI_FILETYPE_SYMBOLIC_LINK 144 typedef uint16_t cloudabi_fsflags_t; -#define CLOUDABI_FILESTAT_ATIM 0x0001 +#define CLOUDABI_FILESTAT_ATIM 0x0001 #define CLOUDABI_FILESTAT_ATIM_NOW 0x0002 -#define CLOUDABI_FILESTAT_MTIM 0x0004 +#define CLOUDABI_FILESTAT_MTIM 0x0004 #define CLOUDABI_FILESTAT_MTIM_NOW 0x0008 -#define CLOUDABI_FILESTAT_SIZE 0x0010 +#define CLOUDABI_FILESTAT_SIZE 0x0010 typedef uint64_t cloudabi_inode_t; typedef uint32_t cloudabi_linkcount_t; typedef uint32_t cloudabi_lock_t; -#define CLOUDABI_LOCK_UNLOCKED 0x00000000 -#define CLOUDABI_LOCK_WRLOCKED 0x40000000 +#define CLOUDABI_LOCK_UNLOCKED 0x00000000 +#define CLOUDABI_LOCK_WRLOCKED 0x40000000 #define CLOUDABI_LOCK_KERNEL_MANAGED 0x80000000 -#define CLOUDABI_LOCK_BOGUS 0x80000000 +#define CLOUDABI_LOCK_BOGUS 0x80000000 typedef uint32_t cloudabi_lookupflags_t; #define CLOUDABI_LOOKUP_SYMLINK_FOLLOW 0x00000001 typedef uint8_t cloudabi_mflags_t; -#define CLOUDABI_MAP_ANON 0x01 -#define CLOUDABI_MAP_FIXED 0x02 +#define CLOUDABI_MAP_ANON 0x01 +#define CLOUDABI_MAP_FIXED 0x02 #define CLOUDABI_MAP_PRIVATE 0x04 -#define CLOUDABI_MAP_SHARED 0x08 +#define CLOUDABI_MAP_SHARED 0x08 typedef uint8_t cloudabi_mprot_t; -#define CLOUDABI_PROT_EXEC 0x01 +#define CLOUDABI_PROT_EXEC 0x01 #define CLOUDABI_PROT_WRITE 0x02 -#define CLOUDABI_PROT_READ 0x04 +#define CLOUDABI_PROT_READ 0x04 typedef uint8_t cloudabi_msflags_t; -#define CLOUDABI_MS_ASYNC 0x01 +#define CLOUDABI_MS_ASYNC 0x01 #define CLOUDABI_MS_INVALIDATE 0x02 -#define CLOUDABI_MS_SYNC 0x04 +#define CLOUDABI_MS_SYNC 0x04 typedef uint16_t cloudabi_msgflags_t; -#define CLOUDABI_MSG_CTRUNC 0x0001 -#define CLOUDABI_MSG_EOR 0x0002 -#define CLOUDABI_MSG_PEEK 0x0004 -#define CLOUDABI_MSG_TRUNC 0x0008 +#define CLOUDABI_MSG_CTRUNC 0x0001 +#define CLOUDABI_MSG_EOR 0x0002 +#define CLOUDABI_MSG_PEEK 0x0004 +#define CLOUDABI_MSG_TRUNC 0x0008 #define CLOUDABI_MSG_WAITALL 0x0010 typedef uint32_t cloudabi_nthreads_t; typedef uint16_t cloudabi_oflags_t; -#define CLOUDABI_O_CREAT 0x0001 +#define CLOUDABI_O_CREAT 0x0001 #define CLOUDABI_O_DIRECTORY 0x0002 -#define CLOUDABI_O_EXCL 0x0004 -#define CLOUDABI_O_TRUNC 0x0008 +#define CLOUDABI_O_EXCL 0x0004 +#define CLOUDABI_O_TRUNC 0x0008 typedef uint64_t cloudabi_rights_t; -#define CLOUDABI_RIGHT_FD_DATASYNC 0x0000000000000001 -#define CLOUDABI_RIGHT_FD_READ 0x0000000000000002 -#define CLOUDABI_RIGHT_FD_SEEK 0x0000000000000004 -#define CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS 0x0000000000000008 -#define CLOUDABI_RIGHT_FD_SYNC 0x0000000000000010 -#define CLOUDABI_RIGHT_FD_TELL 0x0000000000000020 -#define CLOUDABI_RIGHT_FD_WRITE 0x0000000000000040 -#define CLOUDABI_RIGHT_FILE_ADVISE 0x0000000000000080 -#define CLOUDABI_RIGHT_FILE_ALLOCATE 0x0000000000000100 -#define CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY 0x0000000000000200 -#define CLOUDABI_RIGHT_FILE_CREATE_FILE 0x0000000000000400 -#define CLOUDABI_RIGHT_FILE_CREATE_FIFO 0x0000000000000800 -#define CLOUDABI_RIGHT_FILE_LINK_SOURCE 0x0000000000001000 -#define CLOUDABI_RIGHT_FILE_LINK_TARGET 0x0000000000002000 -#define CLOUDABI_RIGHT_FILE_OPEN 0x0000000000004000 -#define CLOUDABI_RIGHT_FILE_READDIR 0x0000000000008000 -#define CLOUDABI_RIGHT_FILE_READLINK 0x0000000000010000 -#define CLOUDABI_RIGHT_FILE_RENAME_SOURCE 0x0000000000020000 -#define CLOUDABI_RIGHT_FILE_RENAME_TARGET 0x0000000000040000 -#define CLOUDABI_RIGHT_FILE_STAT_FGET 0x0000000000080000 -#define CLOUDABI_RIGHT_FILE_STAT_FPUT_SIZE 0x0000000000100000 -#define CLOUDABI_RIGHT_FILE_STAT_FPUT_TIMES 0x0000000000200000 -#define CLOUDABI_RIGHT_FILE_STAT_GET 0x0000000000400000 -#define CLOUDABI_RIGHT_FILE_STAT_PUT_TIMES 0x0000000000800000 -#define CLOUDABI_RIGHT_FILE_SYMLINK 0x0000000001000000 -#define CLOUDABI_RIGHT_FILE_UNLINK 0x0000000002000000 -#define CLOUDABI_RIGHT_MEM_MAP 0x0000000004000000 -#define CLOUDABI_RIGHT_MEM_MAP_EXEC 0x0000000008000000 -#define CLOUDABI_RIGHT_POLL_FD_READWRITE 0x0000000010000000 -#define CLOUDABI_RIGHT_POLL_MODIFY 0x0000000020000000 -#define CLOUDABI_RIGHT_POLL_PROC_TERMINATE 0x0000000040000000 -#define CLOUDABI_RIGHT_POLL_WAIT 0x0000000080000000 -#define CLOUDABI_RIGHT_PROC_EXEC 0x0000000100000000 -#define CLOUDABI_RIGHT_SOCK_ACCEPT 0x0000000200000000 -#define CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY 0x0000000400000000 -#define CLOUDABI_RIGHT_SOCK_BIND_SOCKET 0x0000000800000000 +#define CLOUDABI_RIGHT_FD_DATASYNC 0x0000000000000001 +#define CLOUDABI_RIGHT_FD_READ 0x0000000000000002 +#define CLOUDABI_RIGHT_FD_SEEK 0x0000000000000004 +#define CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS 0x0000000000000008 +#define CLOUDABI_RIGHT_FD_SYNC 0x0000000000000010 +#define CLOUDABI_RIGHT_FD_TELL 0x0000000000000020 +#define CLOUDABI_RIGHT_FD_WRITE 0x0000000000000040 +#define CLOUDABI_RIGHT_FILE_ADVISE 0x0000000000000080 +#define CLOUDABI_RIGHT_FILE_ALLOCATE 0x0000000000000100 +#define CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY 0x0000000000000200 +#define CLOUDABI_RIGHT_FILE_CREATE_FILE 0x0000000000000400 +#define CLOUDABI_RIGHT_FILE_CREATE_FIFO 0x0000000000000800 +#define CLOUDABI_RIGHT_FILE_LINK_SOURCE 0x0000000000001000 +#define CLOUDABI_RIGHT_FILE_LINK_TARGET 0x0000000000002000 +#define CLOUDABI_RIGHT_FILE_OPEN 0x0000000000004000 +#define CLOUDABI_RIGHT_FILE_READDIR 0x0000000000008000 +#define CLOUDABI_RIGHT_FILE_READLINK 0x0000000000010000 +#define CLOUDABI_RIGHT_FILE_RENAME_SOURCE 0x0000000000020000 +#define CLOUDABI_RIGHT_FILE_RENAME_TARGET 0x0000000000040000 +#define CLOUDABI_RIGHT_FILE_STAT_FGET 0x0000000000080000 +#define CLOUDABI_RIGHT_FILE_STAT_FPUT_SIZE 0x0000000000100000 +#define CLOUDABI_RIGHT_FILE_STAT_FPUT_TIMES 0x0000000000200000 +#define CLOUDABI_RIGHT_FILE_STAT_GET 0x0000000000400000 +#define CLOUDABI_RIGHT_FILE_STAT_PUT_TIMES 0x0000000000800000 +#define CLOUDABI_RIGHT_FILE_SYMLINK 0x0000000001000000 +#define CLOUDABI_RIGHT_FILE_UNLINK 0x0000000002000000 +#define CLOUDABI_RIGHT_MEM_MAP 0x0000000004000000 +#define CLOUDABI_RIGHT_MEM_MAP_EXEC 0x0000000008000000 +#define CLOUDABI_RIGHT_POLL_FD_READWRITE 0x0000000010000000 +#define CLOUDABI_RIGHT_POLL_MODIFY 0x0000000020000000 +#define CLOUDABI_RIGHT_POLL_PROC_TERMINATE 0x0000000040000000 +#define CLOUDABI_RIGHT_POLL_WAIT 0x0000000080000000 +#define CLOUDABI_RIGHT_PROC_EXEC 0x0000000100000000 +#define CLOUDABI_RIGHT_SOCK_ACCEPT 0x0000000200000000 +#define CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY 0x0000000400000000 +#define CLOUDABI_RIGHT_SOCK_BIND_SOCKET 0x0000000800000000 #define CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY 0x0000001000000000 -#define CLOUDABI_RIGHT_SOCK_CONNECT_SOCKET 0x0000002000000000 -#define CLOUDABI_RIGHT_SOCK_LISTEN 0x0000004000000000 -#define CLOUDABI_RIGHT_SOCK_SHUTDOWN 0x0000008000000000 -#define CLOUDABI_RIGHT_SOCK_STAT_GET 0x0000010000000000 +#define CLOUDABI_RIGHT_SOCK_CONNECT_SOCKET 0x0000002000000000 +#define CLOUDABI_RIGHT_SOCK_LISTEN 0x0000004000000000 +#define CLOUDABI_RIGHT_SOCK_SHUTDOWN 0x0000008000000000 +#define CLOUDABI_RIGHT_SOCK_STAT_GET 0x0000010000000000 typedef uint8_t cloudabi_sa_family_t; #define CLOUDABI_AF_UNSPEC 0 -#define CLOUDABI_AF_INET 1 -#define CLOUDABI_AF_INET6 2 -#define CLOUDABI_AF_UNIX 3 +#define CLOUDABI_AF_INET 1 +#define CLOUDABI_AF_INET6 2 +#define CLOUDABI_AF_UNIX 3 typedef uint8_t cloudabi_scope_t; #define CLOUDABI_SCOPE_PRIVATE 4 -#define CLOUDABI_SCOPE_SHARED 8 +#define CLOUDABI_SCOPE_SHARED 8 typedef uint8_t cloudabi_sdflags_t; #define CLOUDABI_SHUT_RD 0x01 #define CLOUDABI_SHUT_WR 0x02 typedef uint8_t cloudabi_signal_t; -#define CLOUDABI_SIGABRT 1 -#define CLOUDABI_SIGALRM 2 -#define CLOUDABI_SIGBUS 3 -#define CLOUDABI_SIGCHLD 4 -#define CLOUDABI_SIGCONT 5 -#define CLOUDABI_SIGFPE 6 -#define CLOUDABI_SIGHUP 7 -#define CLOUDABI_SIGILL 8 -#define CLOUDABI_SIGINT 9 -#define CLOUDABI_SIGKILL 10 -#define CLOUDABI_SIGPIPE 11 -#define CLOUDABI_SIGQUIT 12 -#define CLOUDABI_SIGSEGV 13 -#define CLOUDABI_SIGSTOP 14 -#define CLOUDABI_SIGSYS 15 -#define CLOUDABI_SIGTERM 16 -#define CLOUDABI_SIGTRAP 17 -#define CLOUDABI_SIGTSTP 18 -#define CLOUDABI_SIGTTIN 19 -#define CLOUDABI_SIGTTOU 20 -#define CLOUDABI_SIGURG 21 -#define CLOUDABI_SIGUSR1 22 -#define CLOUDABI_SIGUSR2 23 +#define CLOUDABI_SIGABRT 1 +#define CLOUDABI_SIGALRM 2 +#define CLOUDABI_SIGBUS 3 +#define CLOUDABI_SIGCHLD 4 +#define CLOUDABI_SIGCONT 5 +#define CLOUDABI_SIGFPE 6 +#define CLOUDABI_SIGHUP 7 +#define CLOUDABI_SIGILL 8 +#define CLOUDABI_SIGINT 9 +#define CLOUDABI_SIGKILL 10 +#define CLOUDABI_SIGPIPE 11 +#define CLOUDABI_SIGQUIT 12 +#define CLOUDABI_SIGSEGV 13 +#define CLOUDABI_SIGSTOP 14 +#define CLOUDABI_SIGSYS 15 +#define CLOUDABI_SIGTERM 16 +#define CLOUDABI_SIGTRAP 17 +#define CLOUDABI_SIGTSTP 18 +#define CLOUDABI_SIGTTIN 19 +#define CLOUDABI_SIGTTOU 20 +#define CLOUDABI_SIGURG 21 +#define CLOUDABI_SIGUSR1 22 +#define CLOUDABI_SIGUSR2 23 #define CLOUDABI_SIGVTALRM 24 -#define CLOUDABI_SIGXCPU 25 -#define CLOUDABI_SIGXFSZ 26 +#define CLOUDABI_SIGXCPU 25 +#define CLOUDABI_SIGXFSZ 26 typedef uint8_t cloudabi_ssflags_t; #define CLOUDABI_SOCKSTAT_CLEAR_ERROR 0x01 @@ -346,11 +347,11 @@ typedef uint16_t cloudabi_subclockflags_t; #define CLOUDABI_SUBSCRIPTION_CLOCK_ABSTIME 0x0001 typedef uint16_t cloudabi_subflags_t; -#define CLOUDABI_SUBSCRIPTION_ADD 0x0001 -#define CLOUDABI_SUBSCRIPTION_CLEAR 0x0002 -#define CLOUDABI_SUBSCRIPTION_DELETE 0x0004 +#define CLOUDABI_SUBSCRIPTION_ADD 0x0001 +#define CLOUDABI_SUBSCRIPTION_CLEAR 0x0002 +#define CLOUDABI_SUBSCRIPTION_DELETE 0x0004 #define CLOUDABI_SUBSCRIPTION_DISABLE 0x0008 -#define CLOUDABI_SUBSCRIPTION_ENABLE 0x0010 +#define CLOUDABI_SUBSCRIPTION_ENABLE 0x0010 #define CLOUDABI_SUBSCRIPTION_ONESHOT 0x0020 typedef uint16_t cloudabi_subrwflags_t; @@ -371,10 +372,10 @@ typedef uint8_t cloudabi_whence_t; #define CLOUDABI_WHENCE_SET 3 typedef struct { - _Alignas(8) cloudabi_dircookie_t d_next; - _Alignas(8) cloudabi_inode_t d_ino; - _Alignas(4) uint32_t d_namlen; - _Alignas(1) cloudabi_filetype_t d_type; + _Alignas(8) cloudabi_dircookie_t d_next; + _Alignas(8) cloudabi_inode_t d_ino; + _Alignas(4) uint32_t d_namlen; + _Alignas(1) cloudabi_filetype_t d_type; } cloudabi_dirent_t; _Static_assert(offsetof(cloudabi_dirent_t, d_next) == 0, "Incorrect layout"); _Static_assert(offsetof(cloudabi_dirent_t, d_ino) == 8, "Incorrect layout"); @@ -384,42 +385,51 @@ _Static_assert(sizeof(cloudabi_dirent_t) == 24, "Incorrect layout"); _Static_assert(_Alignof(cloudabi_dirent_t) == 8, "Incorrect layout"); typedef struct { - _Alignas(1) cloudabi_filetype_t fs_filetype; - _Alignas(2) cloudabi_fdflags_t fs_flags; - _Alignas(8) cloudabi_rights_t fs_rights_base; - _Alignas(8) cloudabi_rights_t fs_rights_inheriting; + _Alignas(1) cloudabi_filetype_t fs_filetype; + _Alignas(2) cloudabi_fdflags_t fs_flags; + _Alignas(8) cloudabi_rights_t fs_rights_base; + _Alignas(8) cloudabi_rights_t fs_rights_inheriting; } cloudabi_fdstat_t; -_Static_assert(offsetof(cloudabi_fdstat_t, fs_filetype) == 0, "Incorrect layout"); +_Static_assert(offsetof(cloudabi_fdstat_t, fs_filetype) == 0, + "Incorrect layout"); _Static_assert(offsetof(cloudabi_fdstat_t, fs_flags) == 2, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_fdstat_t, fs_rights_base) == 8, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_fdstat_t, fs_rights_inheriting) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi_fdstat_t, fs_rights_base) == 8, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_fdstat_t, fs_rights_inheriting) == 16, + "Incorrect layout"); _Static_assert(sizeof(cloudabi_fdstat_t) == 24, "Incorrect layout"); _Static_assert(_Alignof(cloudabi_fdstat_t) == 8, "Incorrect layout"); typedef struct { - _Alignas(8) cloudabi_device_t st_dev; - _Alignas(8) cloudabi_inode_t st_ino; - _Alignas(1) cloudabi_filetype_t st_filetype; - _Alignas(4) cloudabi_linkcount_t st_nlink; - _Alignas(8) cloudabi_filesize_t st_size; - _Alignas(8) cloudabi_timestamp_t st_atim; - _Alignas(8) cloudabi_timestamp_t st_mtim; - _Alignas(8) cloudabi_timestamp_t st_ctim; + _Alignas(8) cloudabi_device_t st_dev; + _Alignas(8) cloudabi_inode_t st_ino; + _Alignas(1) cloudabi_filetype_t st_filetype; + _Alignas(4) cloudabi_linkcount_t st_nlink; + _Alignas(8) cloudabi_filesize_t st_size; + _Alignas(8) cloudabi_timestamp_t st_atim; + _Alignas(8) cloudabi_timestamp_t st_mtim; + _Alignas(8) cloudabi_timestamp_t st_ctim; } cloudabi_filestat_t; _Static_assert(offsetof(cloudabi_filestat_t, st_dev) == 0, "Incorrect layout"); _Static_assert(offsetof(cloudabi_filestat_t, st_ino) == 8, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_filestat_t, st_filetype) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_filestat_t, st_nlink) == 20, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_filestat_t, st_size) == 24, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_filestat_t, st_atim) == 32, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_filestat_t, st_mtim) == 40, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_filestat_t, st_ctim) == 48, "Incorrect layout"); +_Static_assert(offsetof(cloudabi_filestat_t, st_filetype) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_filestat_t, st_nlink) == 20, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_filestat_t, st_size) == 24, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_filestat_t, st_atim) == 32, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_filestat_t, st_mtim) == 40, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_filestat_t, st_ctim) == 48, + "Incorrect layout"); _Static_assert(sizeof(cloudabi_filestat_t) == 56, "Incorrect layout"); _Static_assert(_Alignof(cloudabi_filestat_t) == 8, "Incorrect layout"); typedef struct { - _Alignas(4) cloudabi_fd_t fd; - _Alignas(4) cloudabi_lookupflags_t flags; + _Alignas(4) cloudabi_fd_t fd; + _Alignas(4) cloudabi_lookupflags_t flags; } cloudabi_lookup_t; _Static_assert(offsetof(cloudabi_lookup_t, fd) == 0, "Incorrect layout"); _Static_assert(offsetof(cloudabi_lookup_t, flags) == 4, "Incorrect layout"); @@ -427,36 +437,45 @@ _Static_assert(sizeof(cloudabi_lookup_t) == 8, "Incorrect layout"); _Static_assert(_Alignof(cloudabi_lookup_t) == 4, "Incorrect layout"); typedef struct { - _Alignas(1) cloudabi_sa_family_t sa_family; - union { - struct { - _Alignas(1) uint8_t addr[4]; - _Alignas(2) uint16_t port; - } sa_inet; - struct { - _Alignas(1) uint8_t addr[16]; - _Alignas(2) uint16_t port; - } sa_inet6; - }; + _Alignas(1) cloudabi_sa_family_t sa_family; + union { + struct { + _Alignas(1) uint8_t addr[4]; + _Alignas(2) uint16_t port; + } sa_inet; + struct { + _Alignas(1) uint8_t addr[16]; + _Alignas(2) uint16_t port; + } sa_inet6; + }; } cloudabi_sockaddr_t; -_Static_assert(offsetof(cloudabi_sockaddr_t, sa_family) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet.addr) == 2, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet.port) == 6, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet6.addr) == 2, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet6.port) == 18, "Incorrect layout"); +_Static_assert(offsetof(cloudabi_sockaddr_t, sa_family) == 0, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet.addr) == 2, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet.port) == 6, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet6.addr) == 2, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet6.port) == 18, + "Incorrect layout"); _Static_assert(sizeof(cloudabi_sockaddr_t) == 20, "Incorrect layout"); _Static_assert(_Alignof(cloudabi_sockaddr_t) == 2, "Incorrect layout"); typedef struct { - _Alignas(2) cloudabi_sockaddr_t ss_sockname; - _Alignas(2) cloudabi_sockaddr_t ss_peername; - _Alignas(2) cloudabi_errno_t ss_error; - _Alignas(4) cloudabi_sstate_t ss_state; + _Alignas(2) cloudabi_sockaddr_t ss_sockname; + _Alignas(2) cloudabi_sockaddr_t ss_peername; + _Alignas(2) cloudabi_errno_t ss_error; + _Alignas(4) cloudabi_sstate_t ss_state; } cloudabi_sockstat_t; -_Static_assert(offsetof(cloudabi_sockstat_t, ss_sockname) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockstat_t, ss_peername) == 20, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockstat_t, ss_error) == 40, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_sockstat_t, ss_state) == 44, "Incorrect layout"); +_Static_assert(offsetof(cloudabi_sockstat_t, ss_sockname) == 0, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_sockstat_t, ss_peername) == 20, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_sockstat_t, ss_error) == 40, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_sockstat_t, ss_state) == 44, + "Incorrect layout"); _Static_assert(sizeof(cloudabi_sockstat_t) == 48, "Incorrect layout"); _Static_assert(_Alignof(cloudabi_sockstat_t) == 4, "Incorrect layout"); diff --git a/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S b/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S new file mode 100644 index 0000000..3acebc1 --- /dev/null +++ b/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S @@ -0,0 +1,491 @@ +// 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; \ + .global name; \ + .type name, @function; \ +name: + +#define END(name) .size name, . - name + +ENTRY(cloudabi_sys_clock_res_get) + str x1, [sp, #-8] + mov w8, #0 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_clock_res_get) + +ENTRY(cloudabi_sys_clock_time_get) + str x2, [sp, #-8] + mov w8, #1 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_clock_time_get) + +ENTRY(cloudabi_sys_condvar_signal) + mov w8, #2 + svc #0 + ret +END(cloudabi_sys_condvar_signal) + +ENTRY(cloudabi_sys_fd_close) + mov w8, #3 + svc #0 + ret +END(cloudabi_sys_fd_close) + +ENTRY(cloudabi_sys_fd_create1) + str x1, [sp, #-8] + mov w8, #4 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str w0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_fd_create1) + +ENTRY(cloudabi_sys_fd_create2) + stp x1, x2, [sp, #-16] + mov w8, #5 + svc #0 + ldp x2, x3, [sp, #-16] + b.cs 1f + str w0, [x2] + str w1, [x3] + mov w0, wzr +1: + ret +END(cloudabi_sys_fd_create2) + +ENTRY(cloudabi_sys_fd_datasync) + mov w8, #6 + svc #0 + ret +END(cloudabi_sys_fd_datasync) + +ENTRY(cloudabi_sys_fd_dup) + str x1, [sp, #-8] + mov w8, #7 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str w0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_fd_dup) + +ENTRY(cloudabi_sys_fd_pread) + str x4, [sp, #-8] + mov w8, #8 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_fd_pread) + +ENTRY(cloudabi_sys_fd_pwrite) + str x4, [sp, #-8] + mov w8, #9 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_fd_pwrite) + +ENTRY(cloudabi_sys_fd_read) + str x3, [sp, #-8] + mov w8, #10 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_fd_read) + +ENTRY(cloudabi_sys_fd_replace) + mov w8, #11 + svc #0 + ret +END(cloudabi_sys_fd_replace) + +ENTRY(cloudabi_sys_fd_seek) + str x3, [sp, #-8] + mov w8, #12 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_fd_seek) + +ENTRY(cloudabi_sys_fd_stat_get) + mov w8, #13 + svc #0 + ret +END(cloudabi_sys_fd_stat_get) + +ENTRY(cloudabi_sys_fd_stat_put) + mov w8, #14 + svc #0 + ret +END(cloudabi_sys_fd_stat_put) + +ENTRY(cloudabi_sys_fd_sync) + mov w8, #15 + svc #0 + ret +END(cloudabi_sys_fd_sync) + +ENTRY(cloudabi_sys_fd_write) + str x3, [sp, #-8] + mov w8, #16 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_fd_write) + +ENTRY(cloudabi_sys_file_advise) + mov w8, #17 + svc #0 + ret +END(cloudabi_sys_file_advise) + +ENTRY(cloudabi_sys_file_allocate) + mov w8, #18 + svc #0 + ret +END(cloudabi_sys_file_allocate) + +ENTRY(cloudabi_sys_file_create) + mov w8, #19 + svc #0 + ret +END(cloudabi_sys_file_create) + +ENTRY(cloudabi_sys_file_link) + mov w8, #20 + svc #0 + ret +END(cloudabi_sys_file_link) + +ENTRY(cloudabi_sys_file_open) + str x5, [sp, #-8] + mov w8, #21 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str w0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_file_open) + +ENTRY(cloudabi_sys_file_readdir) + str x4, [sp, #-8] + mov w8, #22 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_file_readdir) + +ENTRY(cloudabi_sys_file_readlink) + str x5, [sp, #-8] + mov w8, #23 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_file_readlink) + +ENTRY(cloudabi_sys_file_rename) + mov w8, #24 + svc #0 + ret +END(cloudabi_sys_file_rename) + +ENTRY(cloudabi_sys_file_stat_fget) + mov w8, #25 + svc #0 + ret +END(cloudabi_sys_file_stat_fget) + +ENTRY(cloudabi_sys_file_stat_fput) + mov w8, #26 + svc #0 + ret +END(cloudabi_sys_file_stat_fput) + +ENTRY(cloudabi_sys_file_stat_get) + mov w8, #27 + svc #0 + ret +END(cloudabi_sys_file_stat_get) + +ENTRY(cloudabi_sys_file_stat_put) + mov w8, #28 + svc #0 + ret +END(cloudabi_sys_file_stat_put) + +ENTRY(cloudabi_sys_file_symlink) + mov w8, #29 + svc #0 + ret +END(cloudabi_sys_file_symlink) + +ENTRY(cloudabi_sys_file_unlink) + mov w8, #30 + svc #0 + ret +END(cloudabi_sys_file_unlink) + +ENTRY(cloudabi_sys_lock_unlock) + mov w8, #31 + svc #0 + ret +END(cloudabi_sys_lock_unlock) + +ENTRY(cloudabi_sys_mem_advise) + mov w8, #32 + svc #0 + ret +END(cloudabi_sys_mem_advise) + +ENTRY(cloudabi_sys_mem_lock) + mov w8, #33 + svc #0 + ret +END(cloudabi_sys_mem_lock) + +ENTRY(cloudabi_sys_mem_map) + str x6, [sp, #-8] + mov w8, #34 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_mem_map) + +ENTRY(cloudabi_sys_mem_protect) + mov w8, #35 + svc #0 + ret +END(cloudabi_sys_mem_protect) + +ENTRY(cloudabi_sys_mem_sync) + mov w8, #36 + svc #0 + ret +END(cloudabi_sys_mem_sync) + +ENTRY(cloudabi_sys_mem_unlock) + mov w8, #37 + svc #0 + ret +END(cloudabi_sys_mem_unlock) + +ENTRY(cloudabi_sys_mem_unmap) + mov w8, #38 + svc #0 + ret +END(cloudabi_sys_mem_unmap) + +ENTRY(cloudabi_sys_poll) + str x3, [sp, #-8] + mov w8, #39 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_poll) + +ENTRY(cloudabi_sys_poll_fd) + str x6, [sp, #-8] + mov w8, #40 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str x0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_poll_fd) + +ENTRY(cloudabi_sys_proc_exec) + mov w8, #41 + svc #0 + ret +END(cloudabi_sys_proc_exec) + +ENTRY(cloudabi_sys_proc_exit) + mov w8, #42 + svc #0 +END(cloudabi_sys_proc_exit) + +ENTRY(cloudabi_sys_proc_fork) + stp x0, x1, [sp, #-16] + mov w8, #43 + svc #0 + ldp x2, x3, [sp, #-16] + b.cs 1f + str w0, [x2] + str w1, [x3] + mov w0, wzr +1: + ret +END(cloudabi_sys_proc_fork) + +ENTRY(cloudabi_sys_proc_raise) + mov w8, #44 + svc #0 + ret +END(cloudabi_sys_proc_raise) + +ENTRY(cloudabi_sys_random_get) + mov w8, #45 + svc #0 + ret +END(cloudabi_sys_random_get) + +ENTRY(cloudabi_sys_sock_accept) + str x2, [sp, #-8] + mov w8, #46 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str w0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_sock_accept) + +ENTRY(cloudabi_sys_sock_bind) + mov w8, #47 + svc #0 + ret +END(cloudabi_sys_sock_bind) + +ENTRY(cloudabi_sys_sock_connect) + mov w8, #48 + svc #0 + ret +END(cloudabi_sys_sock_connect) + +ENTRY(cloudabi_sys_sock_listen) + mov w8, #49 + svc #0 + ret +END(cloudabi_sys_sock_listen) + +ENTRY(cloudabi_sys_sock_recv) + mov w8, #50 + svc #0 + ret +END(cloudabi_sys_sock_recv) + +ENTRY(cloudabi_sys_sock_send) + mov w8, #51 + svc #0 + ret +END(cloudabi_sys_sock_send) + +ENTRY(cloudabi_sys_sock_shutdown) + mov w8, #52 + svc #0 + ret +END(cloudabi_sys_sock_shutdown) + +ENTRY(cloudabi_sys_sock_stat_get) + mov w8, #53 + svc #0 + ret +END(cloudabi_sys_sock_stat_get) + +ENTRY(cloudabi_sys_thread_create) + str x1, [sp, #-8] + mov w8, #54 + svc #0 + ldr x2, [sp, #-8] + b.cs 1f + str w0, [x2] + mov w0, wzr +1: + ret +END(cloudabi_sys_thread_create) + +ENTRY(cloudabi_sys_thread_exit) + mov w8, #55 + svc #0 +END(cloudabi_sys_thread_exit) + +ENTRY(cloudabi_sys_thread_yield) + mov w8, #56 + svc #0 + ret +END(cloudabi_sys_thread_yield) diff --git a/sys/contrib/cloudabi/cloudabi_vdso_armv6.S b/sys/contrib/cloudabi/cloudabi_vdso_armv6.S new file mode 100644 index 0000000..b4d68cc --- /dev/null +++ b/sys/contrib/cloudabi/cloudabi_vdso_armv6.S @@ -0,0 +1,451 @@ +// 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; \ + .global name; \ + .type name, %function; \ +name: + +#define END(name) .size name, . - name + +ENTRY(cloudabi_sys_clock_res_get) + str r1, [sp, #-4] + mov ip, #0 + swi 0 + ldrcc r2, [sp, #-4] + strcc r0, [r2, 0] + strcc r1, [r2, 4] + movcc r0, $0 + bx lr +END(cloudabi_sys_clock_res_get) + +ENTRY(cloudabi_sys_clock_time_get) + mov ip, #1 + swi 0 + ldrcc r2, [sp, #0] + strcc r0, [r2, 0] + strcc r1, [r2, 4] + movcc r0, $0 + bx lr +END(cloudabi_sys_clock_time_get) + +ENTRY(cloudabi_sys_condvar_signal) + mov ip, #2 + swi 0 + bx lr +END(cloudabi_sys_condvar_signal) + +ENTRY(cloudabi_sys_fd_close) + mov ip, #3 + swi 0 + bx lr +END(cloudabi_sys_fd_close) + +ENTRY(cloudabi_sys_fd_create1) + str r1, [sp, #-4] + mov ip, #4 + swi 0 + ldrcc r2, [sp, #-4] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_fd_create1) + +ENTRY(cloudabi_sys_fd_create2) + str r1, [sp, #-4] + str r2, [sp, #-8] + mov ip, #5 + swi 0 + ldrcc r2, [sp, #-4] + ldrcc r3, [sp, #-8] + strcc r0, [r2] + strcc r1, [r3] + movcc r0, $0 + bx lr +END(cloudabi_sys_fd_create2) + +ENTRY(cloudabi_sys_fd_datasync) + mov ip, #6 + swi 0 + bx lr +END(cloudabi_sys_fd_datasync) + +ENTRY(cloudabi_sys_fd_dup) + str r1, [sp, #-4] + mov ip, #7 + swi 0 + ldrcc r2, [sp, #-4] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_fd_dup) + +ENTRY(cloudabi_sys_fd_pread) + mov ip, #8 + swi 0 + ldrcc r2, [sp, #8] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_fd_pread) + +ENTRY(cloudabi_sys_fd_pwrite) + mov ip, #9 + swi 0 + ldrcc r2, [sp, #8] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_fd_pwrite) + +ENTRY(cloudabi_sys_fd_read) + str r3, [sp, #-4] + mov ip, #10 + swi 0 + ldrcc r2, [sp, #-4] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_fd_read) + +ENTRY(cloudabi_sys_fd_replace) + mov ip, #11 + swi 0 + bx lr +END(cloudabi_sys_fd_replace) + +ENTRY(cloudabi_sys_fd_seek) + mov ip, #12 + swi 0 + ldrcc r2, [sp, #4] + strcc r0, [r2, 0] + strcc r1, [r2, 4] + movcc r0, $0 + bx lr +END(cloudabi_sys_fd_seek) + +ENTRY(cloudabi_sys_fd_stat_get) + mov ip, #13 + swi 0 + bx lr +END(cloudabi_sys_fd_stat_get) + +ENTRY(cloudabi_sys_fd_stat_put) + mov ip, #14 + swi 0 + bx lr +END(cloudabi_sys_fd_stat_put) + +ENTRY(cloudabi_sys_fd_sync) + mov ip, #15 + swi 0 + bx lr +END(cloudabi_sys_fd_sync) + +ENTRY(cloudabi_sys_fd_write) + str r3, [sp, #-4] + mov ip, #16 + swi 0 + ldrcc r2, [sp, #-4] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_fd_write) + +ENTRY(cloudabi_sys_file_advise) + mov ip, #17 + swi 0 + bx lr +END(cloudabi_sys_file_advise) + +ENTRY(cloudabi_sys_file_allocate) + mov ip, #18 + swi 0 + bx lr +END(cloudabi_sys_file_allocate) + +ENTRY(cloudabi_sys_file_create) + mov ip, #19 + swi 0 + bx lr +END(cloudabi_sys_file_create) + +ENTRY(cloudabi_sys_file_link) + mov ip, #20 + swi 0 + bx lr +END(cloudabi_sys_file_link) + +ENTRY(cloudabi_sys_file_open) + mov ip, #21 + swi 0 + ldrcc r2, [sp, #8] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_file_open) + +ENTRY(cloudabi_sys_file_readdir) + mov ip, #22 + swi 0 + ldrcc r2, [sp, #8] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_file_readdir) + +ENTRY(cloudabi_sys_file_readlink) + mov ip, #23 + swi 0 + ldrcc r2, [sp, #4] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_file_readlink) + +ENTRY(cloudabi_sys_file_rename) + mov ip, #24 + swi 0 + bx lr +END(cloudabi_sys_file_rename) + +ENTRY(cloudabi_sys_file_stat_fget) + mov ip, #25 + swi 0 + bx lr +END(cloudabi_sys_file_stat_fget) + +ENTRY(cloudabi_sys_file_stat_fput) + mov ip, #26 + swi 0 + bx lr +END(cloudabi_sys_file_stat_fput) + +ENTRY(cloudabi_sys_file_stat_get) + mov ip, #27 + swi 0 + bx lr +END(cloudabi_sys_file_stat_get) + +ENTRY(cloudabi_sys_file_stat_put) + mov ip, #28 + swi 0 + bx lr +END(cloudabi_sys_file_stat_put) + +ENTRY(cloudabi_sys_file_symlink) + mov ip, #29 + swi 0 + bx lr +END(cloudabi_sys_file_symlink) + +ENTRY(cloudabi_sys_file_unlink) + mov ip, #30 + swi 0 + bx lr +END(cloudabi_sys_file_unlink) + +ENTRY(cloudabi_sys_lock_unlock) + mov ip, #31 + swi 0 + bx lr +END(cloudabi_sys_lock_unlock) + +ENTRY(cloudabi_sys_mem_advise) + mov ip, #32 + swi 0 + bx lr +END(cloudabi_sys_mem_advise) + +ENTRY(cloudabi_sys_mem_lock) + mov ip, #33 + swi 0 + bx lr +END(cloudabi_sys_mem_lock) + +ENTRY(cloudabi_sys_mem_map) + mov ip, #34 + swi 0 + ldrcc r2, [sp, #16] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_mem_map) + +ENTRY(cloudabi_sys_mem_protect) + mov ip, #35 + swi 0 + bx lr +END(cloudabi_sys_mem_protect) + +ENTRY(cloudabi_sys_mem_sync) + mov ip, #36 + swi 0 + bx lr +END(cloudabi_sys_mem_sync) + +ENTRY(cloudabi_sys_mem_unlock) + mov ip, #37 + swi 0 + bx lr +END(cloudabi_sys_mem_unlock) + +ENTRY(cloudabi_sys_mem_unmap) + mov ip, #38 + swi 0 + bx lr +END(cloudabi_sys_mem_unmap) + +ENTRY(cloudabi_sys_poll) + str r3, [sp, #-4] + mov ip, #39 + swi 0 + ldrcc r2, [sp, #-4] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_poll) + +ENTRY(cloudabi_sys_poll_fd) + mov ip, #40 + swi 0 + ldrcc r2, [sp, #8] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_poll_fd) + +ENTRY(cloudabi_sys_proc_exec) + mov ip, #41 + swi 0 + bx lr +END(cloudabi_sys_proc_exec) + +ENTRY(cloudabi_sys_proc_exit) + mov ip, #42 + swi 0 +END(cloudabi_sys_proc_exit) + +ENTRY(cloudabi_sys_proc_fork) + str r0, [sp, #-4] + str r1, [sp, #-8] + mov ip, #43 + swi 0 + ldrcc r2, [sp, #-4] + ldrcc r3, [sp, #-8] + strcc r0, [r2] + strcc r1, [r3] + movcc r0, $0 + bx lr +END(cloudabi_sys_proc_fork) + +ENTRY(cloudabi_sys_proc_raise) + mov ip, #44 + swi 0 + bx lr +END(cloudabi_sys_proc_raise) + +ENTRY(cloudabi_sys_random_get) + mov ip, #45 + swi 0 + bx lr +END(cloudabi_sys_random_get) + +ENTRY(cloudabi_sys_sock_accept) + str r2, [sp, #-4] + mov ip, #46 + swi 0 + ldrcc r2, [sp, #-4] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_sock_accept) + +ENTRY(cloudabi_sys_sock_bind) + mov ip, #47 + swi 0 + bx lr +END(cloudabi_sys_sock_bind) + +ENTRY(cloudabi_sys_sock_connect) + mov ip, #48 + swi 0 + bx lr +END(cloudabi_sys_sock_connect) + +ENTRY(cloudabi_sys_sock_listen) + mov ip, #49 + swi 0 + bx lr +END(cloudabi_sys_sock_listen) + +ENTRY(cloudabi_sys_sock_recv) + mov ip, #50 + swi 0 + bx lr +END(cloudabi_sys_sock_recv) + +ENTRY(cloudabi_sys_sock_send) + mov ip, #51 + swi 0 + bx lr +END(cloudabi_sys_sock_send) + +ENTRY(cloudabi_sys_sock_shutdown) + mov ip, #52 + swi 0 + bx lr +END(cloudabi_sys_sock_shutdown) + +ENTRY(cloudabi_sys_sock_stat_get) + mov ip, #53 + swi 0 + bx lr +END(cloudabi_sys_sock_stat_get) + +ENTRY(cloudabi_sys_thread_create) + str r1, [sp, #-4] + mov ip, #54 + swi 0 + ldrcc r2, [sp, #-4] + strcc r0, [r2] + movcc r0, $0 + bx lr +END(cloudabi_sys_thread_create) + +ENTRY(cloudabi_sys_thread_exit) + mov ip, #55 + swi 0 +END(cloudabi_sys_thread_exit) + +ENTRY(cloudabi_sys_thread_yield) + mov ip, #56 + swi 0 + bx lr +END(cloudabi_sys_thread_yield) diff --git a/sys/contrib/cloudabi/cloudabi_vdso_i686.S b/sys/contrib/cloudabi/cloudabi_vdso_i686.S new file mode 100644 index 0000000..d02c6e1 --- /dev/null +++ b/sys/contrib/cloudabi/cloudabi_vdso_i686.S @@ -0,0 +1,477 @@ +// 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) + mov $0, %eax + int $0x80 + jc 1f + mov 8(%esp), %ecx + mov %eax, 0(%ecx) + mov %edx, 4(%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_clock_res_get) + +ENTRY(cloudabi_sys_clock_time_get) + mov $1, %eax + int $0x80 + jc 1f + mov 16(%esp), %ecx + mov %eax, 0(%ecx) + mov %edx, 4(%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_clock_time_get) + +ENTRY(cloudabi_sys_condvar_signal) + mov $2, %eax + int $0x80 + ret +END(cloudabi_sys_condvar_signal) + +ENTRY(cloudabi_sys_fd_close) + mov $3, %eax + int $0x80 + ret +END(cloudabi_sys_fd_close) + +ENTRY(cloudabi_sys_fd_create1) + mov $4, %eax + int $0x80 + jc 1f + mov 8(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_create1) + +ENTRY(cloudabi_sys_fd_create2) + mov $5, %eax + int $0x80 + jc 1f + mov 8(%esp), %ecx + mov %eax, (%ecx) + mov 12(%esp), %ecx + mov %edx, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_create2) + +ENTRY(cloudabi_sys_fd_datasync) + mov $6, %eax + int $0x80 + ret +END(cloudabi_sys_fd_datasync) + +ENTRY(cloudabi_sys_fd_dup) + mov $7, %eax + int $0x80 + jc 1f + mov 8(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_dup) + +ENTRY(cloudabi_sys_fd_pread) + mov $8, %eax + int $0x80 + jc 1f + mov 24(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_pread) + +ENTRY(cloudabi_sys_fd_pwrite) + mov $9, %eax + int $0x80 + jc 1f + mov 24(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_pwrite) + +ENTRY(cloudabi_sys_fd_read) + mov $10, %eax + int $0x80 + jc 1f + mov 16(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_read) + +ENTRY(cloudabi_sys_fd_replace) + mov $11, %eax + int $0x80 + ret +END(cloudabi_sys_fd_replace) + +ENTRY(cloudabi_sys_fd_seek) + mov $12, %eax + int $0x80 + jc 1f + mov 20(%esp), %ecx + mov %eax, 0(%ecx) + mov %edx, 4(%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_seek) + +ENTRY(cloudabi_sys_fd_stat_get) + mov $13, %eax + int $0x80 + ret +END(cloudabi_sys_fd_stat_get) + +ENTRY(cloudabi_sys_fd_stat_put) + mov $14, %eax + int $0x80 + ret +END(cloudabi_sys_fd_stat_put) + +ENTRY(cloudabi_sys_fd_sync) + mov $15, %eax + int $0x80 + ret +END(cloudabi_sys_fd_sync) + +ENTRY(cloudabi_sys_fd_write) + mov $16, %eax + int $0x80 + jc 1f + mov 16(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_write) + +ENTRY(cloudabi_sys_file_advise) + mov $17, %eax + int $0x80 + ret +END(cloudabi_sys_file_advise) + +ENTRY(cloudabi_sys_file_allocate) + mov $18, %eax + int $0x80 + ret +END(cloudabi_sys_file_allocate) + +ENTRY(cloudabi_sys_file_create) + mov $19, %eax + int $0x80 + ret +END(cloudabi_sys_file_create) + +ENTRY(cloudabi_sys_file_link) + mov $20, %eax + int $0x80 + ret +END(cloudabi_sys_file_link) + +ENTRY(cloudabi_sys_file_open) + mov $21, %eax + int $0x80 + jc 1f + mov 28(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_file_open) + +ENTRY(cloudabi_sys_file_readdir) + mov $22, %eax + int $0x80 + jc 1f + mov 24(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_file_readdir) + +ENTRY(cloudabi_sys_file_readlink) + mov $23, %eax + int $0x80 + jc 1f + mov 24(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_file_readlink) + +ENTRY(cloudabi_sys_file_rename) + mov $24, %eax + int $0x80 + ret +END(cloudabi_sys_file_rename) + +ENTRY(cloudabi_sys_file_stat_fget) + mov $25, %eax + int $0x80 + ret +END(cloudabi_sys_file_stat_fget) + +ENTRY(cloudabi_sys_file_stat_fput) + mov $26, %eax + int $0x80 + ret +END(cloudabi_sys_file_stat_fput) + +ENTRY(cloudabi_sys_file_stat_get) + mov $27, %eax + int $0x80 + ret +END(cloudabi_sys_file_stat_get) + +ENTRY(cloudabi_sys_file_stat_put) + mov $28, %eax + int $0x80 + ret +END(cloudabi_sys_file_stat_put) + +ENTRY(cloudabi_sys_file_symlink) + mov $29, %eax + int $0x80 + ret +END(cloudabi_sys_file_symlink) + +ENTRY(cloudabi_sys_file_unlink) + mov $30, %eax + int $0x80 + ret +END(cloudabi_sys_file_unlink) + +ENTRY(cloudabi_sys_lock_unlock) + mov $31, %eax + int $0x80 + ret +END(cloudabi_sys_lock_unlock) + +ENTRY(cloudabi_sys_mem_advise) + mov $32, %eax + int $0x80 + ret +END(cloudabi_sys_mem_advise) + +ENTRY(cloudabi_sys_mem_lock) + mov $33, %eax + int $0x80 + ret +END(cloudabi_sys_mem_lock) + +ENTRY(cloudabi_sys_mem_map) + mov $34, %eax + int $0x80 + jc 1f + mov 32(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_mem_map) + +ENTRY(cloudabi_sys_mem_protect) + mov $35, %eax + int $0x80 + ret +END(cloudabi_sys_mem_protect) + +ENTRY(cloudabi_sys_mem_sync) + mov $36, %eax + int $0x80 + ret +END(cloudabi_sys_mem_sync) + +ENTRY(cloudabi_sys_mem_unlock) + mov $37, %eax + int $0x80 + ret +END(cloudabi_sys_mem_unlock) + +ENTRY(cloudabi_sys_mem_unmap) + mov $38, %eax + int $0x80 + ret +END(cloudabi_sys_mem_unmap) + +ENTRY(cloudabi_sys_poll) + mov $39, %eax + int $0x80 + jc 1f + mov 16(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_poll) + +ENTRY(cloudabi_sys_poll_fd) + mov $40, %eax + int $0x80 + jc 1f + mov 28(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_poll_fd) + +ENTRY(cloudabi_sys_proc_exec) + mov $41, %eax + int $0x80 + ret +END(cloudabi_sys_proc_exec) + +ENTRY(cloudabi_sys_proc_exit) + mov $42, %eax + int $0x80 +END(cloudabi_sys_proc_exit) + +ENTRY(cloudabi_sys_proc_fork) + mov $43, %eax + int $0x80 + jc 1f + mov 4(%esp), %ecx + mov %eax, (%ecx) + mov 8(%esp), %ecx + mov %edx, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_proc_fork) + +ENTRY(cloudabi_sys_proc_raise) + mov $44, %eax + int $0x80 + ret +END(cloudabi_sys_proc_raise) + +ENTRY(cloudabi_sys_random_get) + mov $45, %eax + int $0x80 + ret +END(cloudabi_sys_random_get) + +ENTRY(cloudabi_sys_sock_accept) + mov $46, %eax + int $0x80 + jc 1f + mov 12(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_sock_accept) + +ENTRY(cloudabi_sys_sock_bind) + mov $47, %eax + int $0x80 + ret +END(cloudabi_sys_sock_bind) + +ENTRY(cloudabi_sys_sock_connect) + mov $48, %eax + int $0x80 + ret +END(cloudabi_sys_sock_connect) + +ENTRY(cloudabi_sys_sock_listen) + mov $49, %eax + int $0x80 + ret +END(cloudabi_sys_sock_listen) + +ENTRY(cloudabi_sys_sock_recv) + mov $50, %eax + int $0x80 + ret +END(cloudabi_sys_sock_recv) + +ENTRY(cloudabi_sys_sock_send) + mov $51, %eax + int $0x80 + ret +END(cloudabi_sys_sock_send) + +ENTRY(cloudabi_sys_sock_shutdown) + mov $52, %eax + int $0x80 + ret +END(cloudabi_sys_sock_shutdown) + +ENTRY(cloudabi_sys_sock_stat_get) + mov $53, %eax + int $0x80 + ret +END(cloudabi_sys_sock_stat_get) + +ENTRY(cloudabi_sys_thread_create) + mov $54, %eax + int $0x80 + jc 1f + mov 8(%esp), %ecx + mov %eax, (%ecx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_thread_create) + +ENTRY(cloudabi_sys_thread_exit) + mov $55, %eax + int $0x80 +END(cloudabi_sys_thread_exit) + +ENTRY(cloudabi_sys_thread_yield) + mov $56, %eax + int $0x80 + ret +END(cloudabi_sys_thread_yield) diff --git a/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S b/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S new file mode 100644 index 0000000..74f59db --- /dev/null +++ b/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S @@ -0,0 +1,1223 @@ +// 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) diff --git a/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S b/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S new file mode 100644 index 0000000..049cb0d --- /dev/null +++ b/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S @@ -0,0 +1,511 @@ +// 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 4, 0x90; \ + .global name; \ + .type name, @function; \ +name: + +#define END(name) .size name, . - name + +ENTRY(cloudabi_sys_clock_res_get) + push %rsi + mov $0, %eax + syscall + pop %rcx + jc 1f + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_clock_res_get) + +ENTRY(cloudabi_sys_clock_time_get) + push %rdx + mov $1, %eax + syscall + pop %rcx + jc 1f + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_clock_time_get) + +ENTRY(cloudabi_sys_condvar_signal) + mov $2, %eax + syscall + ret +END(cloudabi_sys_condvar_signal) + +ENTRY(cloudabi_sys_fd_close) + mov $3, %eax + syscall + ret +END(cloudabi_sys_fd_close) + +ENTRY(cloudabi_sys_fd_create1) + push %rsi + mov $4, %eax + syscall + pop %rcx + jc 1f + mov %eax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_create1) + +ENTRY(cloudabi_sys_fd_create2) + push %rsi + push %rdx + mov $5, %eax + syscall + pop %rsi + pop %rcx + jc 1f + mov %eax, (%rcx) + mov %edx, (%rsi) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_create2) + +ENTRY(cloudabi_sys_fd_datasync) + mov $6, %eax + syscall + ret +END(cloudabi_sys_fd_datasync) + +ENTRY(cloudabi_sys_fd_dup) + push %rsi + mov $7, %eax + syscall + pop %rcx + jc 1f + mov %eax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_dup) + +ENTRY(cloudabi_sys_fd_pread) + mov %rcx, %r10 + push %r8 + mov $8, %eax + syscall + pop %rcx + jc 1f + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_pread) + +ENTRY(cloudabi_sys_fd_pwrite) + mov %rcx, %r10 + push %r8 + mov $9, %eax + syscall + pop %rcx + jc 1f + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_pwrite) + +ENTRY(cloudabi_sys_fd_read) + push %rcx + mov $10, %eax + syscall + pop %rcx + jc 1f + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_read) + +ENTRY(cloudabi_sys_fd_replace) + mov $11, %eax + syscall + ret +END(cloudabi_sys_fd_replace) + +ENTRY(cloudabi_sys_fd_seek) + push %rcx + mov $12, %eax + syscall + pop %rcx + jc 1f + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_seek) + +ENTRY(cloudabi_sys_fd_stat_get) + mov $13, %eax + syscall + ret +END(cloudabi_sys_fd_stat_get) + +ENTRY(cloudabi_sys_fd_stat_put) + mov $14, %eax + syscall + ret +END(cloudabi_sys_fd_stat_put) + +ENTRY(cloudabi_sys_fd_sync) + mov $15, %eax + syscall + ret +END(cloudabi_sys_fd_sync) + +ENTRY(cloudabi_sys_fd_write) + push %rcx + mov $16, %eax + syscall + pop %rcx + jc 1f + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_fd_write) + +ENTRY(cloudabi_sys_file_advise) + mov %rcx, %r10 + mov $17, %eax + syscall + ret +END(cloudabi_sys_file_advise) + +ENTRY(cloudabi_sys_file_allocate) + mov $18, %eax + syscall + ret +END(cloudabi_sys_file_allocate) + +ENTRY(cloudabi_sys_file_create) + mov %rcx, %r10 + mov $19, %eax + syscall + ret +END(cloudabi_sys_file_create) + +ENTRY(cloudabi_sys_file_link) + mov %rcx, %r10 + mov $20, %eax + syscall + ret +END(cloudabi_sys_file_link) + +ENTRY(cloudabi_sys_file_open) + mov %rcx, %r10 + push %r9 + mov $21, %eax + syscall + pop %rcx + jc 1f + mov %eax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_file_open) + +ENTRY(cloudabi_sys_file_readdir) + mov %rcx, %r10 + push %r8 + mov $22, %eax + syscall + pop %rcx + jc 1f + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_file_readdir) + +ENTRY(cloudabi_sys_file_readlink) + mov %rcx, %r10 + push %r9 + mov $23, %eax + syscall + pop %rcx + jc 1f + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_file_readlink) + +ENTRY(cloudabi_sys_file_rename) + mov %rcx, %r10 + mov $24, %eax + syscall + ret +END(cloudabi_sys_file_rename) + +ENTRY(cloudabi_sys_file_stat_fget) + mov $25, %eax + syscall + ret +END(cloudabi_sys_file_stat_fget) + +ENTRY(cloudabi_sys_file_stat_fput) + mov $26, %eax + syscall + ret +END(cloudabi_sys_file_stat_fput) + +ENTRY(cloudabi_sys_file_stat_get) + mov %rcx, %r10 + mov $27, %eax + syscall + ret +END(cloudabi_sys_file_stat_get) + +ENTRY(cloudabi_sys_file_stat_put) + mov %rcx, %r10 + mov $28, %eax + syscall + ret +END(cloudabi_sys_file_stat_put) + +ENTRY(cloudabi_sys_file_symlink) + mov %rcx, %r10 + mov $29, %eax + syscall + ret +END(cloudabi_sys_file_symlink) + +ENTRY(cloudabi_sys_file_unlink) + mov %rcx, %r10 + mov $30, %eax + syscall + ret +END(cloudabi_sys_file_unlink) + +ENTRY(cloudabi_sys_lock_unlock) + mov $31, %eax + syscall + ret +END(cloudabi_sys_lock_unlock) + +ENTRY(cloudabi_sys_mem_advise) + mov $32, %eax + syscall + ret +END(cloudabi_sys_mem_advise) + +ENTRY(cloudabi_sys_mem_lock) + mov $33, %eax + syscall + ret +END(cloudabi_sys_mem_lock) + +ENTRY(cloudabi_sys_mem_map) + mov %rcx, %r10 + mov $34, %eax + syscall + jc 1f + mov 8(%rsp), %rcx + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_mem_map) + +ENTRY(cloudabi_sys_mem_protect) + mov $35, %eax + syscall + ret +END(cloudabi_sys_mem_protect) + +ENTRY(cloudabi_sys_mem_sync) + mov $36, %eax + syscall + ret +END(cloudabi_sys_mem_sync) + +ENTRY(cloudabi_sys_mem_unlock) + mov $37, %eax + syscall + ret +END(cloudabi_sys_mem_unlock) + +ENTRY(cloudabi_sys_mem_unmap) + mov $38, %eax + syscall + ret +END(cloudabi_sys_mem_unmap) + +ENTRY(cloudabi_sys_poll) + push %rcx + mov $39, %eax + syscall + pop %rcx + jc 1f + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_poll) + +ENTRY(cloudabi_sys_poll_fd) + mov %rcx, %r10 + mov $40, %eax + syscall + jc 1f + mov 8(%rsp), %rcx + mov %rax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_poll_fd) + +ENTRY(cloudabi_sys_proc_exec) + mov %rcx, %r10 + mov $41, %eax + syscall + ret +END(cloudabi_sys_proc_exec) + +ENTRY(cloudabi_sys_proc_exit) + mov $42, %eax + syscall +END(cloudabi_sys_proc_exit) + +ENTRY(cloudabi_sys_proc_fork) + push %rdi + push %rsi + mov $43, %eax + syscall + pop %rsi + pop %rcx + jc 1f + mov %eax, (%rcx) + mov %edx, (%rsi) + xor %eax, %eax +1: + ret +END(cloudabi_sys_proc_fork) + +ENTRY(cloudabi_sys_proc_raise) + mov $44, %eax + syscall + ret +END(cloudabi_sys_proc_raise) + +ENTRY(cloudabi_sys_random_get) + mov $45, %eax + syscall + ret +END(cloudabi_sys_random_get) + +ENTRY(cloudabi_sys_sock_accept) + push %rdx + mov $46, %eax + syscall + pop %rcx + jc 1f + mov %eax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_sock_accept) + +ENTRY(cloudabi_sys_sock_bind) + mov %rcx, %r10 + mov $47, %eax + syscall + ret +END(cloudabi_sys_sock_bind) + +ENTRY(cloudabi_sys_sock_connect) + mov %rcx, %r10 + mov $48, %eax + syscall + ret +END(cloudabi_sys_sock_connect) + +ENTRY(cloudabi_sys_sock_listen) + mov $49, %eax + syscall + ret +END(cloudabi_sys_sock_listen) + +ENTRY(cloudabi_sys_sock_recv) + mov $50, %eax + syscall + ret +END(cloudabi_sys_sock_recv) + +ENTRY(cloudabi_sys_sock_send) + mov $51, %eax + syscall + ret +END(cloudabi_sys_sock_send) + +ENTRY(cloudabi_sys_sock_shutdown) + mov $52, %eax + syscall + ret +END(cloudabi_sys_sock_shutdown) + +ENTRY(cloudabi_sys_sock_stat_get) + mov $53, %eax + syscall + ret +END(cloudabi_sys_sock_stat_get) + +ENTRY(cloudabi_sys_thread_create) + push %rsi + mov $54, %eax + syscall + pop %rcx + jc 1f + mov %eax, (%rcx) + xor %eax, %eax +1: + ret +END(cloudabi_sys_thread_create) + +ENTRY(cloudabi_sys_thread_exit) + mov $55, %eax + syscall +END(cloudabi_sys_thread_exit) + +ENTRY(cloudabi_sys_thread_yield) + mov $56, %eax + syscall + ret +END(cloudabi_sys_thread_yield) diff --git a/sys/contrib/cloudabi/syscalls32.master b/sys/contrib/cloudabi/syscalls32.master new file mode 100644 index 0000000..aa3314b --- /dev/null +++ b/sys/contrib/cloudabi/syscalls32.master @@ -0,0 +1,315 @@ + $FreeBSD$ + +; 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 + +#include <sys/sysent.h> +#include <sys/sysproto.h> + +#include <contrib/cloudabi/cloudabi32_types.h> + +#include <compat/cloudabi32/cloudabi32_proto.h> + +0 AUE_NULL STD { cloudabi_timestamp_t \ + cloudabi_sys_clock_res_get( \ + cloudabi_clockid_t clock_id); } + +1 AUE_NULL STD { cloudabi_timestamp_t \ + cloudabi_sys_clock_time_get( \ + cloudabi_clockid_t clock_id, \ + cloudabi_timestamp_t precision); } + +2 AUE_NULL STD { void cloudabi_sys_condvar_signal( \ + cloudabi_condvar_t *condvar, \ + cloudabi_scope_t scope, \ + cloudabi_nthreads_t nwaiters); } + +3 AUE_NULL STD { void cloudabi_sys_fd_close( \ + cloudabi_fd_t fd); } + +4 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_fd_create1( \ + cloudabi_filetype_t type); } + +5 AUE_NULL STD { void cloudabi_sys_fd_create2( \ + cloudabi_filetype_t type); } + +6 AUE_NULL STD { void cloudabi_sys_fd_datasync( \ + cloudabi_fd_t fd); } + +7 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_fd_dup( \ + cloudabi_fd_t from); } + +8 AUE_NULL STD { size_t cloudabi32_sys_fd_pread( \ + cloudabi_fd_t fd, \ + const cloudabi32_iovec_t *iov, \ + size_t iovcnt, \ + cloudabi_filesize_t offset); } + +9 AUE_NULL STD { size_t cloudabi32_sys_fd_pwrite( \ + cloudabi_fd_t fd, \ + const cloudabi32_ciovec_t *iov, \ + size_t iovcnt, \ + cloudabi_filesize_t offset); } + +10 AUE_NULL STD { size_t cloudabi32_sys_fd_read( \ + cloudabi_fd_t fd, \ + const cloudabi32_iovec_t *iov, \ + size_t iovcnt); } + +11 AUE_NULL STD { void cloudabi_sys_fd_replace( \ + cloudabi_fd_t from, \ + cloudabi_fd_t to); } + +12 AUE_NULL STD { cloudabi_filesize_t \ + cloudabi_sys_fd_seek( \ + cloudabi_fd_t fd, \ + cloudabi_filedelta_t offset, \ + cloudabi_whence_t whence); } + +13 AUE_NULL STD { void cloudabi_sys_fd_stat_get( \ + cloudabi_fd_t fd, \ + cloudabi_fdstat_t *buf); } + +14 AUE_NULL STD { void cloudabi_sys_fd_stat_put( \ + cloudabi_fd_t fd, \ + const cloudabi_fdstat_t *buf, \ + cloudabi_fdsflags_t flags); } + +15 AUE_NULL STD { void cloudabi_sys_fd_sync( \ + cloudabi_fd_t fd); } + +16 AUE_NULL STD { size_t cloudabi32_sys_fd_write( \ + cloudabi_fd_t fd, \ + const cloudabi32_ciovec_t *iov, \ + size_t iovcnt); } + +17 AUE_NULL STD { void cloudabi_sys_file_advise( \ + cloudabi_fd_t fd, \ + cloudabi_filesize_t offset, \ + cloudabi_filesize_t len, \ + cloudabi_advice_t advice); } + +18 AUE_NULL STD { void cloudabi_sys_file_allocate( \ + cloudabi_fd_t fd, \ + cloudabi_filesize_t offset, \ + cloudabi_filesize_t len); } + +19 AUE_NULL STD { void cloudabi_sys_file_create( \ + cloudabi_fd_t fd, \ + const char *path, \ + size_t pathlen, \ + cloudabi_filetype_t type); } + +20 AUE_NULL STD { void cloudabi_sys_file_link( \ + cloudabi_lookup_t fd1, \ + const char *path1, \ + size_t path1len, \ + cloudabi_fd_t fd2, \ + const char *path2, \ + size_t path2len); } + +21 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_file_open( \ + cloudabi_lookup_t dirfd, \ + const char *path, \ + size_t pathlen, \ + cloudabi_oflags_t oflags, \ + const cloudabi_fdstat_t *fds); } + +22 AUE_NULL STD { size_t cloudabi_sys_file_readdir( \ + cloudabi_fd_t fd, \ + void *buf, \ + size_t nbyte, \ + cloudabi_dircookie_t cookie); } + +23 AUE_NULL STD { size_t cloudabi_sys_file_readlink( \ + cloudabi_fd_t fd, \ + const char *path, \ + size_t pathlen, \ + char *buf, \ + size_t bufsize); } + +24 AUE_NULL STD { void cloudabi_sys_file_rename( \ + cloudabi_fd_t oldfd, \ + const char *old, \ + size_t oldlen, \ + cloudabi_fd_t newfd, \ + const char *new, \ + size_t newlen); } + +25 AUE_NULL STD { void cloudabi_sys_file_stat_fget( \ + cloudabi_fd_t fd, \ + cloudabi_filestat_t *buf); } + +26 AUE_NULL STD { void cloudabi_sys_file_stat_fput( \ + cloudabi_fd_t fd, \ + const cloudabi_filestat_t *buf, \ + cloudabi_fsflags_t flags); } + +27 AUE_NULL STD { void cloudabi_sys_file_stat_get( \ + cloudabi_lookup_t fd, \ + const char *path, \ + size_t pathlen, \ + cloudabi_filestat_t *buf); } + +28 AUE_NULL STD { void cloudabi_sys_file_stat_put( \ + cloudabi_lookup_t fd, \ + const char *path, \ + size_t pathlen, \ + const cloudabi_filestat_t *buf, \ + cloudabi_fsflags_t flags); } + +29 AUE_NULL STD { void cloudabi_sys_file_symlink( \ + const char *path1, \ + size_t path1len, \ + cloudabi_fd_t fd, \ + const char *path2, \ + size_t path2len); } + +30 AUE_NULL STD { void cloudabi_sys_file_unlink( \ + cloudabi_fd_t fd, \ + const char *path, \ + size_t pathlen, \ + cloudabi_ulflags_t flags); } + +31 AUE_NULL STD { void cloudabi_sys_lock_unlock( \ + cloudabi_lock_t *lock, \ + cloudabi_scope_t scope); } + +32 AUE_NULL STD { void cloudabi_sys_mem_advise( \ + void *addr, \ + size_t len, \ + cloudabi_advice_t advice); } + +33 AUE_NULL STD { void cloudabi_sys_mem_lock( \ + const void *addr, \ + size_t len); } + +34 AUE_NULL STD { void cloudabi_sys_mem_map( \ + void *addr, \ + size_t len, \ + cloudabi_mprot_t prot, \ + cloudabi_mflags_t flags, \ + cloudabi_fd_t fd, \ + cloudabi_filesize_t off); } + +35 AUE_NULL STD { void cloudabi_sys_mem_protect( \ + void *addr, \ + size_t len, \ + cloudabi_mprot_t prot); } + +36 AUE_NULL STD { void cloudabi_sys_mem_sync( \ + void *addr, \ + size_t len, \ + cloudabi_msflags_t flags); } + +37 AUE_NULL STD { void cloudabi_sys_mem_unlock( \ + const void *addr, \ + size_t len); } + +38 AUE_NULL STD { void cloudabi_sys_mem_unmap( \ + void *addr, \ + size_t len); } + +39 AUE_NULL STD { size_t cloudabi32_sys_poll( \ + const cloudabi32_subscription_t *in, \ + cloudabi32_event_t *out, \ + size_t nsubscriptions); } + +40 AUE_NULL STD { size_t cloudabi32_sys_poll_fd( \ + cloudabi_fd_t fd, \ + const cloudabi32_subscription_t *in, \ + size_t nin, \ + cloudabi32_event_t *out, \ + size_t nout, \ + const cloudabi32_subscription_t *timeout); } + +41 AUE_NULL STD { void cloudabi_sys_proc_exec( \ + cloudabi_fd_t fd, \ + const void *data, \ + size_t datalen, \ + const cloudabi_fd_t *fds, \ + size_t fdslen); } + +42 AUE_NULL STD { void cloudabi_sys_proc_exit( \ + cloudabi_exitcode_t rval); } + +43 AUE_NULL STD { void cloudabi_sys_proc_fork(); } + +44 AUE_NULL STD { void cloudabi_sys_proc_raise( \ + cloudabi_signal_t sig); } + +45 AUE_NULL STD { void cloudabi_sys_random_get( \ + void *buf, \ + size_t nbyte); } + +46 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_sock_accept( \ + cloudabi_fd_t sock, \ + cloudabi_sockstat_t *buf); } + +47 AUE_NULL STD { void cloudabi_sys_sock_bind( \ + cloudabi_fd_t sock, \ + cloudabi_fd_t fd, \ + const char *path, \ + size_t pathlen); } + +48 AUE_NULL STD { void cloudabi_sys_sock_connect( \ + cloudabi_fd_t sock, \ + cloudabi_fd_t fd, \ + const char *path, \ + size_t pathlen); } + +49 AUE_NULL STD { void cloudabi_sys_sock_listen( \ + cloudabi_fd_t sock, \ + cloudabi_backlog_t backlog); } + +50 AUE_NULL STD { void cloudabi32_sys_sock_recv( \ + cloudabi_fd_t sock, \ + const cloudabi32_recv_in_t *in, \ + cloudabi32_recv_out_t *out); } + +51 AUE_NULL STD { void cloudabi32_sys_sock_send( \ + cloudabi_fd_t sock, \ + const cloudabi32_send_in_t *in, \ + cloudabi32_send_out_t *out); } + +52 AUE_NULL STD { void cloudabi_sys_sock_shutdown( \ + cloudabi_fd_t sock, \ + cloudabi_sdflags_t how); } + +53 AUE_NULL STD { void cloudabi_sys_sock_stat_get( \ + cloudabi_fd_t sock, \ + cloudabi_sockstat_t *buf, \ + cloudabi_ssflags_t flags); } + +54 AUE_NULL STD { cloudabi_tid_t cloudabi32_sys_thread_create( \ + cloudabi32_threadattr_t *attr); } + +55 AUE_NULL STD { void cloudabi_sys_thread_exit( \ + cloudabi_lock_t *lock, \ + cloudabi_scope_t scope); } + +56 AUE_NULL STD { void cloudabi_sys_thread_yield(); } diff --git a/sys/contrib/cloudabi/syscalls.master b/sys/contrib/cloudabi/syscalls64.master index 7da55c5..b2378bd 100644 --- a/sys/contrib/cloudabi/syscalls.master +++ b/sys/contrib/cloudabi/syscalls64.master @@ -239,80 +239,77 @@ cloudabi64_event_t *out, \ size_t nsubscriptions); } -40 AUE_NULL STD { void cloudabi_sys_proc_exec( \ +40 AUE_NULL STD { size_t cloudabi64_sys_poll_fd( \ + cloudabi_fd_t fd, \ + const cloudabi64_subscription_t *in, \ + size_t nin, \ + cloudabi64_event_t *out, \ + size_t nout, \ + const cloudabi64_subscription_t *timeout); } + +41 AUE_NULL STD { void cloudabi_sys_proc_exec( \ cloudabi_fd_t fd, \ const void *data, \ size_t datalen, \ const cloudabi_fd_t *fds, \ size_t fdslen); } -41 AUE_NULL STD { void cloudabi_sys_proc_exit( \ +42 AUE_NULL STD { void cloudabi_sys_proc_exit( \ cloudabi_exitcode_t rval); } -42 AUE_NULL STD { void cloudabi_sys_proc_fork(); } +43 AUE_NULL STD { void cloudabi_sys_proc_fork(); } -43 AUE_NULL STD { void cloudabi_sys_proc_raise( \ +44 AUE_NULL STD { void cloudabi_sys_proc_raise( \ cloudabi_signal_t sig); } -44 AUE_NULL STD { void cloudabi_sys_random_get( \ +45 AUE_NULL STD { void cloudabi_sys_random_get( \ void *buf, \ size_t nbyte); } -45 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_sock_accept( \ +46 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_sock_accept( \ cloudabi_fd_t sock, \ cloudabi_sockstat_t *buf); } -46 AUE_NULL STD { void cloudabi_sys_sock_bind( \ +47 AUE_NULL STD { void cloudabi_sys_sock_bind( \ cloudabi_fd_t sock, \ cloudabi_fd_t fd, \ const char *path, \ size_t pathlen); } -47 AUE_NULL STD { void cloudabi_sys_sock_connect( \ +48 AUE_NULL STD { void cloudabi_sys_sock_connect( \ cloudabi_fd_t sock, \ cloudabi_fd_t fd, \ const char *path, \ size_t pathlen); } -48 AUE_NULL STD { void cloudabi_sys_sock_listen( \ +49 AUE_NULL STD { void cloudabi_sys_sock_listen( \ cloudabi_fd_t sock, \ cloudabi_backlog_t backlog); } -49 AUE_NULL STD { void cloudabi64_sys_sock_recv( \ +50 AUE_NULL STD { void cloudabi64_sys_sock_recv( \ cloudabi_fd_t sock, \ const cloudabi64_recv_in_t *in, \ cloudabi64_recv_out_t *out); } -50 AUE_NULL STD { void cloudabi64_sys_sock_send( \ +51 AUE_NULL STD { void cloudabi64_sys_sock_send( \ cloudabi_fd_t sock, \ const cloudabi64_send_in_t *in, \ cloudabi64_send_out_t *out); } -51 AUE_NULL STD { void cloudabi_sys_sock_shutdown( \ +52 AUE_NULL STD { void cloudabi_sys_sock_shutdown( \ cloudabi_fd_t sock, \ cloudabi_sdflags_t how); } -52 AUE_NULL STD { void cloudabi_sys_sock_stat_get( \ +53 AUE_NULL STD { void cloudabi_sys_sock_stat_get( \ cloudabi_fd_t sock, \ cloudabi_sockstat_t *buf, \ cloudabi_ssflags_t flags); } -53 AUE_NULL STD { cloudabi_tid_t cloudabi64_sys_thread_create( \ +54 AUE_NULL STD { cloudabi_tid_t cloudabi64_sys_thread_create( \ cloudabi64_threadattr_t *attr); } -54 AUE_NULL STD { void cloudabi_sys_thread_exit( \ +55 AUE_NULL STD { void cloudabi_sys_thread_exit( \ cloudabi_lock_t *lock, \ cloudabi_scope_t scope); } -55 AUE_NULL STD { void cloudabi_sys_thread_tcb_set( \ - void *tcb); } - 56 AUE_NULL STD { void cloudabi_sys_thread_yield(); } - -57 AUE_NULL STD { size_t cloudabi64_sys_poll_fd( \ - cloudabi_fd_t fd, \ - const cloudabi64_subscription_t *in, \ - size_t nin, \ - cloudabi64_event_t *out, \ - size_t nout, \ - const cloudabi64_subscription_t *timeout); } |