aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/cloudabi64
Commit message (Collapse)AuthorAgeFilesLines
* Drop cloudabiKonstantin Belousov2021-09-2113-3005/+0
| | | | | | | | | | | | | According to https://github.com/NuxiNL/cloudlibc: CloudABI is no longer being maintained. It was an awesome experiment, but it never got enough traction to be sustainable. There is no reason to keep it in FreeBSD. Approved by: ed (private mail) Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D31923
* regen syscall files after d51198d63b63Ed Maste2021-05-131-91/+91
|
* Regen after r366145.Edward Tomasz Napierala2020-09-252-49/+62
| | | | | | | Sponsored by: DARPA Notes: svn path=/head/; revision=366147
* compat: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-13/+0
| | | | Notes: svn path=/head/; revision=365080
* sysent targets: further cleanup and deduplicationKyle Evans2020-01-181-24/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | r355473 vastly improved the readability and cleanliness of these Makefiles. Every single one of them follows the same pattern and duplicates the exact same logic. Now that we have GENERATED/SRCS, split SRCS up into the two parameters we'll use for ${MAKESYSCALLS} rather than assuming a specific ordering of SRCS and include a common sysent.mk to handle the rest. This makes it less tedious to make sweeping changes. Some default values are provided for GENERATED/SYSENT_*; almost all of these just use a 'syscalls.master' and 'syscalls.conf' in cwd, and they all use effectively the same filenames with an arbitrary prefix. Most ABIs will be able to get away with just setting GENERATED_PREFIX and including ^/sys/conf/sysent.mk, while others only need light additions. kern/Makefile is the notable exception, as it doesn't take a SYSENT_CONF and the generated files are spread out between ^/sys/kern and ^/sys/sys, but it otherwise fits the pattern enough to use the common version. Reviewed by: brooks, imp Nice!: emaste Differential Revision: https://reviews.freebsd.org/D23197 Notes: svn path=/head/; revision=356868
* Set .ORDER for makesyscalls generated filesKyle Evans2020-01-101-0/+3
| | | | | | | | | | | | | | | | | | | | When either makesyscalls.lua or syscalls.master changes, all of the ${GENERATED} targets are now out-of-date. With make jobs > 1, this means we will run the makesyscalls script in parallel for the same ABI, generating the same set of output files. Prior to r356603 , there is a large window for interlacing output for some of the generated files that we were generating in-place rather than staging in a temp dir. After that, we still should't need to run the script more than once per-ABI as the first invocation should update all of them. Add .ORDER to do so cleanly. Reviewed by: brooks Discussed with: sjg Differential Revision: https://reviews.freebsd.org/D23099 Notes: svn path=/head/; revision=356604
* sysent: Reduce duplication and improve readability.Brooks Davis2019-12-061-8/+13
| | | | | | | | | | | | | Use the power of variable to avoid spelling out source and generated files too many times. The previous Makefiles were hard to read, hard to edit, and badly formatted. Reviewed by: kevans, emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22714 Notes: svn path=/head/; revision=355473
* Use uintptr_t instead of register_t * for the stack base.John Baldwin2019-12-032-13/+13
| | | | | | | | | | | | | | | | | | | - Use ustringp for the location of the argv and environment strings and allow destp to travel further down the stack for the stackgap and auxv regions. - Update the Linux copyout_strings variants to move destp down the stack as was done for the native ABIs in r263349. - Stop allocating a space for a stack gap in the Linux ABIs. This used to hold translated system call arguments, but hasn't been used since r159992. Reviewed by: kib Tested on: md64 (amd64, i386, linux64), i386 (i386, linux) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22501 Notes: svn path=/head/; revision=355373
* Convert in-tree sysent targets to use new makesyscalls.luaKyle Evans2019-11-181-3/+5
| | | | | | | | | | | | flua is bootstrapped as part of the build for those on older versions/revisions that don't yet have flua installed. Once upgraded past r354833, "make sysent" will again naturally work as expected. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D21894 Notes: svn path=/head/; revision=354835
* Check for errors from copyout() and suword*() in sv_copyout_args/strings.John Baldwin2019-11-182-5/+5
| | | | | | | | | | Reviewed by: brooks, kib Tested on: amd64 (amd64, i386, linux64), i386 (i386, linux) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22401 Notes: svn path=/head/; revision=354827
* Regen after r347228 and r352693.Brooks Davis2019-09-305-5/+11
| | | | | | | No functional change. Notes: svn path=/head/; revision=352918
* makesyscalls.sh: always use absolute path for syscalls.confBrooks Davis2019-05-301-2/+2
| | | | | | | | | | | | | | | | | syscalls.conf is included using "." which per the Open Group: If file does not contain a <slash>, the shell shall use the search path specified by PATH to find the directory containing file. POSIX shells don't fall back to the current working directory. Submitted by: Nathaniel Wesley Filardo <nwf20@cl.cam.ac.uk> Reviewed by: bdrewery Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D20476 Notes: svn path=/head/; revision=348446
* Add helper functions to copy strings into struct image_args.Brooks Davis2018-11-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Given a zeroed struct image_args with an allocated buf member, exec_args_add_fname() must be called to install a file name (or NULL). Then zero or more calls to exec_args_add_env() followed by zero or more calls to exec_args_add_env(). exec_args_adjust_args() may be called after args and/or env to allow an interpreter to be prepended to the argument list. To allow code reuse when adding arg and env variables, begin_envv should be accessed with the accessor exec_args_get_begin_envv() which handles the case when no environment entries have been added. Use these functions to simplify exec_copyin_args() and freebsd32_exec_copyin_args(). Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15468 Notes: svn path=/head/; revision=341263
* Regenerated assorted syscall related files after:Brooks Davis2018-10-091-0/+1
| | | | | | | | | | | | | | | - r327895: Implement 'domainset'... - r329876: Use linux types for linux-specific syscalls Diff generated with: find . -name syscalls.conf | xargs dirname | \ xargs -n1 -I DIR make -C DIR sysent Approved by: re (kib) Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=339269
* Don't use an .OBJDIR for 'make sysent'.Bryan Drewery2018-01-291-0/+3
| | | | | | | | Reported by: emaste, jhb Sponsored by: Dell EMC Notes: svn path=/head/; revision=328560
* Use mallocarray(9) in CloudABI kernel code where possible.Ed Schouten2018-01-071-2/+2
| | | | | | | Submitted by: pfg@ Notes: svn path=/head/; revision=327684
* Allow timed waits with relative timeouts on locks and condvars.Ed Schouten2018-01-041-12/+15
| | | | | | | | | | | | | | | | Even though pthreads doesn't support this, there are various alternative APIs that use this. For example, uv_cond_timedwait() accepts a relative timeout. So does Rust's std::sync::Condvar::wait_timeout(). Though I personally think that relative timeouts are bad (due to imprecision for repeated operations), it does seem that people want this. Extend the existing futex functions to keep track of whether an absolute timeout is used in a boolean flag. MFC after: 1 month Notes: svn path=/head/; revision=327560
* Upgrade to CloudABI v0.17.Ed Schouten2017-11-084-24/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compared to the previous version, v0.16, there are a couple of minor changes: - CLOUDABI_AT_PID: Process identifiers for CloudABI processes. Initially, BSD process identifiers weren't exposed inside the runtime, due to them being pretty much useless inside of a cluster computing environment. When jobs are scheduled across systems, the BSD process number doesn't act as an identifier. Even on individual systems they may recycle relatively quickly. With this change, the kernel will now generate a UUIDv4 when executing a process. These UUIDs can be obtained within the process using program_getpid(). Right now, FreeBSD will not attempt to store this value. This should of course happen at some point in time, so that it may be printed by administration tools. - Removal of some unused structure members for polling. With the polling framework being simplified/redesigned, it turns out some of the structure fields were not used by the C library. We can remove these to keep things nice and tidy. Obtained from: https://github.com/NuxiNL/cloudabi Notes: svn path=/head/; revision=325555
* Import the latest CloudABI definitions, version 0.16.Ed Schouten2017-10-186-182/+69
| | | | | | | | | | | | | | | | | | | | | | | | | The most important change in this release is the removal of the poll_fd() system call; CloudABI's equivalent of kevent(). Though I think that kqueue is a lot saner than many of its alternatives, our experience is that emulating this system call on other systems accurately isn't easy. It has become a complex API, even though I'm not convinced this complexity is needed. This is why we've decided to take a different approach, by looking one layer up. We're currently adding an event loop to CloudABI's C library that is API compatible with libuv (except when incompatible with Capsicum). Initially, this event loop will be built on top of plain inefficient poll() calls. Only after this is finished, we'll work our way backwards and design a new set of system calls to optimize it. Interesting challenges will include integrating asynchronous I/O into such a system call API. libuv currently doesn't aio(4) on Linux/BSD, due to it being unreliable and having undesired semantics. Obtained from: https://github.com/NuxiNL/cloudabi Notes: svn path=/head/; revision=324727
* Complete the CloudABI networking refactoring.Ed Schouten2017-08-305-112/+37
| | | | | | | | | | | | | | Now that all of the packaged software has been adjusted to either use Flower (https://github.com/NuxiNL/flower) for making incoming/outgoing network connections or can have connections injected, there is no longer need to keep accept() around. It is now a lot easier to write networked services that are address family independent, dual-stack, testable, etc. Remove all of the bits related to accept(), but also to getsockopt(SO_ACCEPTCONN). Notes: svn path=/head/; revision=323015
* Sync CloudABI compatibility against the latest upstream version (v0.13).Ed Schouten2017-08-255-168/+43
| | | | | | | | | | | | | | | | | | | With Flower (CloudABI's network connection daemon) becoming more complete, there is no longer any need for creating any unconnected sockets. Socket pairs in combination with file descriptor passing is all that is necessary, as that is what is used by Flower to pass network connections from the public internet to listening processes. Remove all of the kernel bits that were used to implement socket(), listen(), bindat() and connectat(). In principle, accept() and SO_ACCEPTCONN may also be removed, but there are still some consumers left. Obtained from: https://github.com/NuxiNL/cloudabi MFC after: 1 month Notes: svn path=/head/; revision=322885
* Upgrade to the latest sources generated from the CloudABI specification.Ed Schouten2017-07-266-208/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CloudABI specification has had some minor changes over the last half year. No substantial features have been added, but some features that are deemed unnecessary in retrospect have been removed: - mlock()/munlock(): These calls tend to be used for two different purposes: real-time support and handling of sensitive (cryptographic) material that shouldn't end up in swap. The former use case is out of scope for CloudABI. The latter may also be handled by encrypting swap. Removing this has the advantage that we no longer need to worry about having resource limits put in place. - SOCK_SEQPACKET: Support for SOCK_SEQPACKET is rather inconsistent across various operating systems. Some operating systems supported by CloudABI (e.g., macOS) don't support it at all. Considering that they are rarely used, remove support for the time being. - getsockname(), getpeername(), etc.: A shortcoming of the sockets API is that it doesn't allow you to create socket(pair)s, having fake socket addresses associated with them. This makes it harder to test applications or transparently forward (proxy) connections to them. With CloudABI, we're slowly moving networking connectivity into a separate daemon called Flower. In addition to passing around socket file descriptors, this daemon provides address information in the form of arbitrary string labels. There is thus no longer any need for requesting socket address information from the kernel itself. This change also updates consumers of the generated code accordingly. Even though system calls end up getting renumbered, this won't cause any problems in practice. CloudABI programs always call into the kernel through a kernel-supplied vDSO that has the numbers updated as well. Obtained from: https://github.com/NuxiNL/cloudabi Notes: svn path=/head/; revision=321514
* Make file descriptor passing for CloudABI's recvmsg() work.Ed Schouten2017-03-221-28/+15
| | | | | | | | | | | | Similar to the change for sendmsg(), create a pointer size independent implementation of recvmsg() and let cloudabi32 and cloudabi64 call into it. In case userspace requests one or more file descriptors, call kern_recvit() in such a way that we get the control message headers in an mbuf. Iterate over all of the headers and copy the file descriptors to userspace. Notes: svn path=/head/; revision=315736
* Make file descriptor passing work for CloudABI's sendmsg().Ed Schouten2017-03-221-21/+14
| | | | | | | | | | | | | Reduce the potential amount of code duplication between cloudabi32 and cloudabi64 by creating a cloudabi_sock_recv() utility function. The cloudabi32 and cloudabi64 modules will then only contain code to convert the iovecs to the native pointer size. In cloudabi_sock_recv(), we can now construct an SCM_RIGHTS cmsghdr in an mbuf and pass that on to kern_sendit(). Notes: svn path=/head/; revision=315700
* Regenerate all the system call tables to drop "created from" lines.John Baldwin2017-02-104-4/+0
| | | | | | | | One of the ibcs2 files contains some actual changes (new headers) as it hasn't been regenerated after older changes to makesyscalls.sh. Notes: svn path=/head/; revision=313566
* Revert crap accidentally committedBaptiste Daroussin2017-01-281-1/+0
| | | | Notes: svn path=/head/; revision=312927
* Revert r312923 a better approach will be taken laterBaptiste Daroussin2017-01-281-0/+1
| | | | Notes: svn path=/head/; revision=312926
* Catch up with changes to structure member names.Ed Schouten2017-01-174-20/+20
| | | | | | | Pointer/length pairs are now always named ${name} and ${name}_len. Notes: svn path=/head/; revision=312355
* Regenerate sources based on the system call tables.Ed Schouten2017-01-175-94/+94
| | | | Notes: svn path=/head/; revision=312354
* Regenerate syscall provider argument strings.Mark Johnston2016-09-221-52/+52
| | | | Notes: svn path=/head/; revision=306158
* Don't forget to define __ELF_WORD_SIZE.Ed Schouten2016-08-211-0/+1
| | | | | | | | Without it, we only obtain the ELF types native to the system. In this we explicitly want the 64-bit versions. Notes: svn path=/head/; revision=304559
* Add a utility macro for converting 64-bit pointers to native pointers.Ed Schouten2016-08-214-20/+25
| | | | | | | | | | | | | | Right now we're casting uint64_t's to native pointers. This isn't causing any problems right now, but if we want to provide a 32-bit compatibility layer that works on 64-bit systems as well, this will cause problems. Casting a uint32_t to a 64-bit pointer throws a compiler error. Introduce a TO_PTR() macro that casts the value to uintptr_t before casting it to a pointer. Notes: svn path=/head/; revision=304558
* Move the linker script from cloudabi64/ to cloudabi/.Ed Schouten2016-08-211-51/+0
| | | | | | | | It turns out that it works perfectly fine for generating 32-bits vDSOs as well. While there, get rid of the extraneous .s file extension. Notes: svn path=/head/; revision=304557
* Use the right _MAX constant.Ed Schouten2016-08-211-1/+1
| | | | | | | | | | | | | Though uio_resid is of type ssize_t, we need to take into account that this source file contains an implementation specific to a certain userspace pointer size. If this file provided 32-bit implementations, this should have used INT32_MAX, even when running a 64-bit kernel. This change has no effect, but is simply in preparation for adding support for running 32-bit CloudABI executables. Notes: svn path=/head/; revision=304556
* Regenerate system call table after r304483.Ed Schouten2016-08-194-4/+4
| | | | Notes: svn path=/head/; revision=304484
* Import the new automatically generated system call table for CloudABI.Ed Schouten2016-08-196-181/+157
| | | | | | | | | | | | | | | | | | Now that we've switched over to using the vDSO on CloudABI, it becomes a lot easier for us to phase out old features. System call numbering is no longer something that's part of the ABI. It's fully based on names. As long as the numbering used by the kernel and the vDSO is consistent (which it always is), it's all right. Let's put this to the test by removing a system call (thread_tcb_set()) that's already unused for quite some time now, but was only left intact to serve as a placeholder. Sync in the new system call table that uses alphabetic sorting of system calls. Obtained from: https://github.com/NuxiNL/cloudabi Notes: svn path=/head/; revision=304478
* Provide the CloudABI vDSO to its executables.Ed Schouten2016-08-102-0/+62
| | | | | | | | | | | | | | | | | | | CloudABI executables already provide support for passing in vDSOs. This functionality is used by the emulator for OS X to inject system call handlers. On FreeBSD, we could use it to optimize calls to gettimeofday(), etc. Though I don't have any plans to optimize any system calls right now, let's go ahead and already pass in a vDSO. This will allow us to simplify the executables, as the traditional "syscall" shims can be removed entirely. It also means that we gain more flexibility with regards to adding and removing system calls. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D7438 Notes: svn path=/head/; revision=303941
* Make CloudABI's way of doing TLS more friendly to userspace emulators.Ed Schouten2016-04-063-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're currently seeing how hard it would be to run CloudABI binaries on operating systems cannot be modified easily (Windows, Mac OS X). The idea is that we want to just run them without any sandboxing. Now that CloudABI executables are PIE, this is already a bit easier, but TLS is still problematic: - CloudABI executables want to write to the %fs, which typically requires extra system calls by the emulator every time it needs to switch between CloudABI's and its own TLS. - If CloudABI executables overwrite the %fs base unconditionally, it also becomes harder for the emulator to store a backup of the old value of %fs. To solve this, let's no longer overwrite %fs, but just %fs:0. As CloudABI's C library does not use a TCB, this space can now be used by an emulator to keep track of its internal state. The executable can now safely overwrite %fs:0, as long as it makes sure that the TCB is copied over to the new TLS area. Ensure that there is an initial TLS area set up when the process starts, only containing a bogus TCB. We don't really care about its contents on FreeBSD. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5836 Notes: svn path=/head/; revision=297613
* Make Position Independent Executables work for CloudABI.Ed Schouten2016-03-311-0/+1
| | | | | | | | | | - Set BI_CAN_EXEC_DYN, so we can execute ET_DYN ELF files in addition to regular ET_EXECs. - Provide an AT_BASE entry in the auxiliary vector, so the executable knows at which address it got loaded and can apply relocations. Notes: svn path=/head/; revision=297470
* Regenerate system call table after r297468.Ed Schouten2016-03-314-7/+7
| | | | Notes: svn path=/head/; revision=297469
* Sync in the latest CloudABI system call definitions.Ed Schouten2016-03-311-6/+6
| | | | | | | | | | | | | | | | | Some time ago I made a change to merge together the memory scope definitions used by mmap (MAP_{PRIVATE,SHARED}) and lock objects (PTHREAD_PROCESS_{PRIVATE,SHARED}). Though that sounded pretty smart back then, it's backfiring. In the case of mmap it's used with other flags in a bitmask, but for locking it's an enumeration. As our plan is to automatically generate bindings for other languages, that looks a bit sloppy. Change all of the locking functions to use separate flags instead. Obtained from: https://github.com/NuxiNL/cloudabi Notes: svn path=/head/; revision=297468
* Regenerate system call table after r297247.Ed Schouten2016-03-244-23/+23
| | | | Notes: svn path=/head/; revision=297253
* Replace the CloudABI system call table by a machine generated version.Ed Schouten2016-03-2410-312/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The type definitions and constants that were used by COMPAT_CLOUDABI64 are a literal copy of some headers stored inside of CloudABI's C library, cloudlibc. What is annoying is that we can't make use of cloudlibc's system call list, as the format is completely different and doesn't provide enough information. It had to be synced in manually. We recently decided to solve this (and some other problems) by moving the ABI definitions into a separate file: https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt This file is processed by a pile of Python scripts to generate the header files like before, documentation (markdown), but in our case more importantly: a FreeBSD system call table. This change discards the old files in sys/contrib/cloudabi and replaces them by the latest copies, which requires some minor changes here and there. Because cloudabi.txt also enforces consistent names of the system call arguments, we have to patch up a small number of system call implementations to use the new argument names. The new header files can also be included directly in FreeBSD kernel space without needing any includes/defines, so we can now remove cloudabi_syscalldefs.h and cloudabi64_syscalldefs.h. Patch up the sources to include the definitions directly from sys/contrib/cloudabi instead. Notes: svn path=/head/; revision=297247
* Refactoring: move out generic bits from cloudabi64_sysvec.c.Ed Schouten2015-10-222-0/+158
| | | | | | | | | | | | | In order to make it easier to support CloudABI on ARM64, move out all of the bits from the AMD64 cloudabi_sysvec.c into a new file cloudabi_module.c that would otherwise remain identical. This reduces the AMD64 specific code to just ~160 lines. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D3974 Notes: svn path=/head/; revision=289747
* Add the last remaining system calls: send() and recv().Ed Schouten2015-08-121-4/+100
| | | | | | | | | | | There is still one TODO item for these calls: add file descriptor passing. The data structures are already prepared for this. It's just the translation that's missing. Obtained from: http://github.com/NuxiNL/freebsd Notes: svn path=/head/; revision=286680
* Make blocking CloudABI futex operations work.Ed Schouten2015-08-121-0/+121
| | | | | | | | | | | | | | | | | | | Blocking on locks and condition variables can be accomplished by polling and using the special filters CONDVAR, LOCK_RDLOCK and LOCK_WRLOCK. For now it wouldn't make sense to implement this functionality into kqueue() itself, for the reason that they are CloudABI specific and would require us to resize 'struct kevent' to hold all of the parameters of interest. Add a bandaid to the CloudABI poll system call to call into the futex code directly if it detects specific combinations of events that are used by the C library. Obtained from: https://github.com/NuxiNL/freebsd Notes: svn path=/head/; revision=286656
* Make poll() and kqueue() on CloudABI work.Ed Schouten2015-08-121-4/+242
| | | | | | | | | | | | | | | | | | | | | This change implements two functions, cloudabi64_kevent_copyin() and cloudabi64_kevent_copyout(), that convert CloudABI structures to FreeBSD's struct kevent. CloudABI uses two structures: subscription_t and event_t. The former is used for input, whereas the latter is used for output. Unlike struct kevent, fields aren't overloaded for multiple purposes or for separate event types. For poll() we call into the newly introduced kern_kevent_anonymous() function that allows us to poll without a file descriptor. This function is not only used by poll(), but also by functions such as sleep() and clock_nanosleep(). Reviewed by: jmg Obtained from: https://github.com/NuxiNL/freebsd Differential Revision: https://reviews.freebsd.org/D3308 Notes: svn path=/head/; revision=286654
* Regenerate the system call table.Ed Schouten2015-08-055-22/+67
| | | | Notes: svn path=/head/; revision=286319
* Import the latest CloudABI system call definitions and table.Ed Schouten2015-08-052-3/+18
| | | | | | | | We're going to need these for next code I'm going to send out for review: support for poll() and kqueue() on CloudABI. Notes: svn path=/head/; revision=286318
* Regenerate system call table.Ed Schouten2015-07-275-13/+13
| | | | Notes: svn path=/head/; revision=285907