]> xenbits.xensource.com Git - unikraft/unikraft.git/log
unikraft/unikraft.git
3 years agoplat/linuxu: Add initrd memory region
Alexander Jung [Mon, 12 Apr 2021 10:42:27 +0000 (12:42 +0200)]
plat/linuxu: Add initrd memory region

Add a new library parameter (initrd_file). The parameter can be used to
map a file on the host filesystem to to a new memory region on boot.

Signed-off-by: Robert Hrusecky <roberth@cs.utexas.edu>
Signed-off-by: Omar Jamil <omarj2898@gmail.com>
Signed-off-by: Sachin Beldona <sachinbeldona@utexas.edu>
Signed-off-by: Gabriel Mocanu <gabi.mocanu98@gmail.com>
Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk>
Checkpatch-Ignore: INITIALISED_STATIC
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #179

3 years agoplat/linuxu: Add fstat, open and close host system calls
Alexander Jung [Mon, 12 Apr 2021 10:39:59 +0000 (12:39 +0200)]
plat/linuxu: Add fstat, open and close host system calls

 * Add system call number for arm_32 and x86_64 for the `fstat`
   system call;
 * Implement system call wrapper function for `open`, `close` and
   `fstat`;
 * Add `MAP_PRIVATE` constant for use with `mmap`.

Signed-off-by: Robert Hrusecky <roberth@cs.utexas.edu>
Signed-off-by: Omar Jamil <omarj2898@gmail.com>
Signed-off-by: Sachin Beldona <sachinbeldona@utexas.edu>
Signed-off-by: Gabriel Mocanu <gabi.mocanu98@gmail.com>
Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #179

3 years agolib/ukcpio: Add CPIO extraction functionality
Alexander Jung [Mon, 12 Apr 2021 10:38:24 +0000 (12:38 +0200)]
lib/ukcpio: Add CPIO extraction functionality

Modeled after the FreeBSD libarchive:
https://github.com/freebsd/freebsd/blob/master/contrib/libarchive/libarchive/archive_read_support_format_cpio.c

The implementation is mostly complete except that it does not yet
support symlinks.

Signed-off-by: Robert Hrusecky <roberth@cs.utexas.edu>
Signed-off-by: Omar Jamil <omarj2898@gmail.com>
Signed-off-by: Sachin Beldona <sachinbeldona@utexas.edu>
Signed-off-by: Gabriel Mocanu <gabi.mocanu98@gmail.com>
Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #179

3 years agolib/ukcpio: Create empty CPIO extraction library
Alexander Jung [Mon, 12 Apr 2021 09:21:39 +0000 (11:21 +0200)]
lib/ukcpio: Create empty CPIO extraction library

Information about the CPIO file format can be found here:
https://www.kernel.org/doc/Documentation/early-userspace/buffer-format.txt

Signed-off-by: Robert Hrusecky <roberth@cs.utexas.edu>
Signed-off-by: Omar Jamil <omarj2898@gmail.com>
Signed-off-by: Sachin Beldona <sachinbeldona@utexas.edu>
Signed-off-by: Gabriel Mocanu <gabi.mocanu98@gmail.com>
Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #179

3 years agoplat/arm64: Fix extregs allocation on Arm
Jia He [Fri, 14 May 2021 01:21:12 +0000 (09:21 +0800)]
plat/arm64: Fix extregs allocation on Arm

Implement the extregs (currently only fpsimd registers) allocation
related helpers. Otherwise, Unikraft can't be built on Arm kvm plat
due to the missing of several helpers.

Signed-off-by: Jia He <justin.he@arm.com>
Reviewed-by: Răzvan Vîrtan <virtanrazvan@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #206

3 years agoplat/common: Add invalidate_dcache_range for arm64
Michalis Pappas [Wed, 17 Feb 2021 10:52:04 +0000 (11:52 +0100)]
plat/common: Add invalidate_dcache_range for arm64

Introduces an additional cache maintenance function that invalidates
cache without cleaning. This is useful when reading memory updated
from a different core, after turning on the caches.

Signed-off-by: Michalis Pappas <Michalis.Pappas@opensynergy.com>
Reviewed-by: Răzvan Vîrtan <virtanrazvan@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #171

3 years agoplat/kvm: Provide udelay and mdelay implementations
cristian-vijelie [Wed, 30 Jun 2021 16:22:30 +0000 (19:22 +0300)]
plat/kvm: Provide udelay and mdelay implementations

The delay functions are required by the SMP module and can be used in
places where setting up a timer in not worth the effort or cannot be
safely done (e.g., early boot code, drivers).

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
Reviewed-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #184

3 years agoplat/kvm: Fix ACPI entry in Makefile.uk
cristian-vijelie [Wed, 30 Jun 2021 16:21:37 +0000 (19:21 +0300)]
plat/kvm: Fix ACPI entry in Makefile.uk

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
Reviewed-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #184

3 years agoplat/ukplatkvm: Provide ACPI structures and functionalities
cristian-vijelie [Fri, 25 Jun 2021 16:08:22 +0000 (19:08 +0300)]
plat/ukplatkvm: Provide ACPI structures and functionalities

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
Reviewed-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #183

3 years agolib/ukboot: add bindings for tinyalloc allocator
Hugo Lefeuvre [Fri, 25 Jun 2021 11:17:23 +0000 (13:17 +0200)]
lib/ukboot: add bindings for tinyalloc allocator

This commits allows users to select tinyalloc as default system
allocator. Previously users had to patch the main tree to achieve this.

This is the tinyalloc counter part of 4b31168 (Mimalloc).

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #238

3 years agolib/syscall_shim: Adjust the sign of `errno` to be positive
Sergiu Moga [Tue, 22 Jun 2021 09:35:05 +0000 (12:35 +0300)]
lib/syscall_shim: Adjust the sign of `errno` to be positive

Ensure that `errno` is assigned the positive value of what the raw
system calls return.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #236

3 years agolib/ukboot: add bindings for Mimalloc allocator
Hugo Lefeuvre [Fri, 25 Jun 2021 08:28:28 +0000 (10:28 +0200)]
lib/ukboot: add bindings for Mimalloc allocator

This commits allows users to select Mimalloc as default system
allocator. Previously users had to patch the main tree to achieve this.
While adding more an more "hardcoded" allocators like this is certainly
not a long term solution, this is the only one we have for now.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #237

3 years agolib/ukalloc: per-library stats: Return ENOMEM
Simon Kuenzer [Mon, 23 Nov 2020 12:10:58 +0000 (13:10 +0100)]
lib/ukalloc: per-library stats: Return ENOMEM

THe per-library wrapper returns ENOMEM instead of failing in an assertions
when the default allocator is not yet initialized.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/nolibc: Enable per-library allocator statistics
Simon Kuenzer [Tue, 17 Nov 2020 16:28:33 +0000 (17:28 +0100)]
lib/nolibc: Enable per-library allocator statistics

Instruments <stdlib.h> so that per-library allocator statistics are
possible. We make sure that libraries using `malloc()`, `free()`, and
company will resolve `uk_alloc_get_default()` within their scope so that
the individual wrapper allocators can be used.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Use Unikraft internal types
Simon Kuenzer [Tue, 17 Nov 2020 16:27:19 +0000 (17:27 +0100)]
lib/ukalloc: Use Unikraft internal types

Use Unikraft-internal types for the API headers in order to have minimal
dependency to libc definitions. This is done so that libcs can integrate
`<uk/alloc.h> directly with their header files without breaking the
declaration set of libc headers.
This is done towards receiving per-library statistics
(see the following commit).

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Iterator for per-library statistics
Simon Kuenzer [Tue, 17 Nov 2020 15:48:24 +0000 (16:48 +0100)]
lib/ukalloc: Iterator for per-library statistics

Provides the `uk_alloc_foreach_libstats()` helper macro that can be used
to iterate over the available library allocator statistics.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Per-library allocation statistics
Simon Kuenzer [Thu, 12 Nov 2020 23:20:12 +0000 (00:20 +0100)]
lib/ukalloc: Per-library allocation statistics

Per-library allocation statistics is achieved by replacing the default
allocator for each library with a wrapper. This wrapper forwards operations
to the actual default allocator while recording changes of the statistics
caused by the operations.
Some statistic counters are updated to support signed values (e.g.,
current memory usage or current number of allocations). This is
needed to cover cases where, for instance, a library A is allocating while
a library B is freeing.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukallocpool: Instrumentation for statistics
Simon Kuenzer [Tue, 22 Dec 2020 12:56:32 +0000 (13:56 +0100)]
lib/ukallocpool: Instrumentation for statistics

Instruments the allocator to record allocation statistics.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukallocregion: Instrumentation for statistics
Simon Kuenzer [Thu, 12 Nov 2020 23:17:37 +0000 (00:17 +0100)]
lib/ukallocregion: Instrumentation for statistics

Instruments the allocator to record allocation statistics.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukallocregion: Internal functions as `static`
Simon Kuenzer [Thu, 12 Nov 2020 15:54:50 +0000 (16:54 +0100)]
lib/ukallocregion: Internal functions as `static`

Declares internal functions as static in order to enable potentially
more aggressive optimizations by the compiler.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukallocbbuddy: Instrumentation for statistics
Simon Kuenzer [Thu, 12 Nov 2020 23:16:37 +0000 (00:16 +0100)]
lib/ukallocbbuddy: Instrumentation for statistics

Instruments the allocator to record allocation statistics.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Global statistics
Simon Kuenzer [Thu, 12 Nov 2020 23:12:15 +0000 (00:12 +0100)]
lib/ukalloc: Global statistics

Provides a configuration option that collects a consolidated global
statistic over all allocators.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Allocator statistics
Simon Kuenzer [Thu, 12 Nov 2020 16:24:30 +0000 (17:24 +0100)]
lib/ukalloc: Allocator statistics

This commit introduces an implementation for the configuration option
`LIBUKALLOC_IFSTATS`. When enabled, allocators keep allocation statistics,
like number of current allocations, maximum memory usage due to
allocations, or how often ENOMEM was returned.
The statistics are kept on the `uk_alloc` struct while the instrumentation
of an allocator is minimal: An allocator has only to be modified with
the following macros:
 - `uk_alloc_stats_count_alloc()`, `uk_alloc_stats_count_palloc()`
 - `uk_alloc_stats_count_free()`, `uk_alloc_stats_count_pfree()`
 - `uk_alloc_stats_count_enomem()`, `uk_alloc_stats_count_penomem()`
Current statistics can be queried with `uk_alloc_stats()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Introduce `uk_alloc_availmem_total(), `uk_alloc_pavail_total()`
Simon Kuenzer [Thu, 12 Nov 2020 16:13:36 +0000 (17:13 +0100)]
lib/ukalloc: Introduce `uk_alloc_availmem_total(), `uk_alloc_pavail_total()`

This commit introduces helper functions to retrieve the total available
memory of all registered allocators. In case an allocator does not support
querying the amount of free memory, it is considered as 0 bytes free for
this particular allocator.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Iterator helper for allocators
Simon Kuenzer [Thu, 12 Nov 2020 16:11:00 +0000 (17:11 +0100)]
lib/ukalloc: Iterator helper for allocators

This commit provides `uk_alloc_foreach()`, a helper macro for
iterating over all registered allocators.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Cross-compatibility wrappers for "free memory" APIs
Simon Kuenzer [Thu, 12 Nov 2020 16:10:03 +0000 (17:10 +0100)]
lib/ukalloc: Cross-compatibility wrappers for "free memory" APIs

This commit provides cross compatibility wrappers between page and non-page
allocators: `uk_alloc_availmem()`, `uk_alloc_maxalloc()`,
`uk_alloc_pavailmem()`, and `uk_alloc_pmaxalloc()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Introduce `uk_alloc_pavailmem()`, `uk_alloc_pmaxalloc()`
Simon Kuenzer [Thu, 12 Nov 2020 16:06:10 +0000 (17:06 +0100)]
lib/ukalloc: Introduce `uk_alloc_pavailmem()`, `uk_alloc_pmaxalloc()`

This commit introduces
- `uk_alloc_pavailmem()` as an equivalent for `uk_alloc_availmem()`
  for page allocators.
- `uk_alloc_pmaxalloc()` as an equivalent for `uk_alloc_maxalloc()`
  for page allocators.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Introduce `uk_alloc_maxalloc()` and make `uk_alloc_availmem()` available
Simon Kuenzer [Thu, 12 Nov 2020 15:52:53 +0000 (16:52 +0100)]
lib/ukalloc: Introduce `uk_alloc_maxalloc()` and make `uk_alloc_availmem()` available

The purpose of this commit is to make `uk_alloc_availmem()` always
available because it is currently the only way to figure out how much heap
memory is still available. We also introduce `uk_alloc_maxalloc()` that
returns the biggest possible allocation that an allocator can currently
satisfy. The configuration option `CONFIG_IFSTAT` is removed because it
raises the expectation of an interface that returns detailed allocator
statistics.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Move `uk_zalloc()` after `uk_calloc()`
Simon Kuenzer [Thu, 12 Nov 2020 15:27:03 +0000 (16:27 +0100)]
lib/ukalloc: Move `uk_zalloc()` after `uk_calloc()`

Moves `uk_zalloc()` to a more appropriate location within the
`<uk/alloc.h> header.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: `extern C {}` at the beginning of <uk/alloc.h>
Simon Kuenzer [Thu, 12 Nov 2020 15:26:04 +0000 (16:26 +0100)]
lib/ukalloc: `extern C {}` at the beginning of <uk/alloc.h>

`<uk/alloc.h>`: Move the type `struct uk_alloc` declaration into the
C code block.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agolib/ukalloc: Move ifpages comment
Simon Kuenzer [Thu, 12 Nov 2020 15:24:41 +0000 (16:24 +0100)]
lib/ukalloc: Move ifpages comment

Moves the comment about the ifpages implementation within `alloc.c`
to the correct place.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #229

3 years agoplat/common/x86: Fix control protection trap
Marc Rittinghaus [Mon, 14 Jun 2021 09:47:16 +0000 (11:47 +0200)]
plat/common/x86: Fix control protection trap

The current trap number for the control protection exception (in
Unikraft called security trap) is wrong and the asm trap is missing. This
patch fixes these issues.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #228

3 years agoplat/xen: x86: Detect initrd entry from start_info
Simon Kuenzer [Thu, 1 Oct 2020 12:43:25 +0000 (14:43 +0200)]
plat/xen: x86: Detect initrd entry from start_info

Registers an init ramdisk as memory region.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Mocanu Gabriel<gabi.mocanu98@gmail.com>
3 years agodocs: Update version to 0.5.0
Simon Kuenzer [Thu, 20 May 2021 22:34:16 +0000 (00:34 +0200)]
docs: Update version to 0.5.0

Bump the version number within the documentation to 0.5.0:
`docs/` and `README.md`

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #214

3 years agolib/vfscore: Register `newfstatat` to syscall_shim
Sergiu Moga [Sat, 24 Apr 2021 17:27:25 +0000 (20:27 +0300)]
lib/vfscore: Register `newfstatat` to syscall_shim

Register `newfstatat` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #190

3 years agolib/vfscore: Register `getdents` to syscall_shim
Sergiu Moga [Thu, 22 Apr 2021 16:49:28 +0000 (19:49 +0300)]
lib/vfscore: Register `getdents` to syscall_shim

Register `getdents` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #189

3 years agolib/vfscore: Register `chroot` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 21:25:57 +0000 (23:25 +0200)]
lib/vfscore: Register `chroot` to syscall_shim

Register `chroot` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #158

3 years agolib/uksched: Enable multiple `UK_THREAD_INIT()` in one source
Simon Kuenzer [Thu, 6 May 2021 13:03:11 +0000 (15:03 +0200)]
lib/uksched: Enable multiple `UK_THREAD_INIT()` in one source

In order to enable multiple UK_THREAD_INIT(_PRIO) definitions within
one source file, we generate file-unique symbol names for each entry
by using the priority level, init function name, and fini function name.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #201

3 years agolib/uksched: Remove unnecessary alignment for thread inittab
Simon Kuenzer [Thu, 6 May 2021 13:02:35 +0000 (15:02 +0200)]
lib/uksched: Remove unnecessary alignment for thread inittab

The align parameter within `extra.ld` for the `uk_thread_inttab` was
causing some alignment issues for the `text` section. Some builds
were not able to be executed. It turns out that this extra alignment
statement is not needed for the table.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #201

3 years agolib/vfscore: Register `unlink` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 17:47:45 +0000 (19:47 +0200)]
lib/vfscore: Register `unlink` to syscall_shim

Register `unlink` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Florin Diaconescu <florin.diaconescu@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #132

3 years agolib/vfscore: Register `symlink` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 17:53:13 +0000 (19:53 +0200)]
lib/vfscore: Register `symlink` to syscall_shim

Register `symlink` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Florin Diaconescu <florin.diaconescu@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #133

3 years agolib/vfscore: Register `pipe2` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 18:14:49 +0000 (20:14 +0200)]
lib/vfscore: Register `pipe2` to syscall_shim

Register `pipe2` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Florin Diaconescu <florin.diaconescu@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #134

3 years agolib/vfscore: Register `umount2` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 10:28:36 +0000 (12:28 +0200)]
lib/vfscore: Register `umount2` to syscall_shim

Register `umount2` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cristian Vijelie <cristianvijelie@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #127

3 years agolib/ukmmap: Register `mremap` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 20:49:39 +0000 (22:49 +0200)]
lib/ukmmap: Register `mremap` to syscall_shim

Register `mremap` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cristian Vijelie <cristianvijelie@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #155

3 years agolib/vfscore: Register `mkdir` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 17:07:37 +0000 (19:07 +0200)]
lib/vfscore: Register `mkdir` to syscall_shim

Register `mkdir` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Catalin Puscoci <catalinpuscoci@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #130

3 years agolib/vfscore: Register `stat` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 09:48:15 +0000 (11:48 +0200)]
lib/vfscore: Register `stat` to syscall_shim

Register `stat` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Catalin Puscoci <catalinpuscoci@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #128

3 years agolib/vfscore: Register `chown` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 21:00:04 +0000 (23:00 +0200)]
lib/vfscore: Register `chown` to syscall_shim

Register `chown` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Catalin Puscoci <catalinpuscoci@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #154

3 years agolib/vfscore: Register `lchown` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 21:20:16 +0000 (23:20 +0200)]
lib/vfscore: Register `lchown` to syscall_shim

Register `lchown` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Catalin Puscoci <catalinpuscoci@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #157

3 years agolib/vfscore: Register `fchown` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 21:13:52 +0000 (23:13 +0200)]
lib/vfscore: Register `fchown` to syscall_shim

Register `fchown` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Catalin Puscoci <catalinpuscoci@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #156

3 years agolib/posix-user: Register `setresgid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 18:03:32 +0000 (20:03 +0200)]
lib/posix-user: Register `setresgid` to syscall_shim

Register `setresgid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #120

3 years agolib/posix-user: Register `getresuid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:56:05 +0000 (19:56 +0200)]
lib/posix-user: Register `getresuid` to syscall_shim

Register `getresuid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #119

3 years agolib/posix-user: Register `setresuid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:51:44 +0000 (19:51 +0200)]
lib/posix-user: Register `setresuid` to syscall_shim

Register `setresuid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #118

3 years agolib/posix-user: Register `capget` to syscall_shim
Sergiu Moga [Sat, 13 Mar 2021 16:00:50 +0000 (18:00 +0200)]
lib/posix-user: Register `capget` to syscall_shim

Register `capget` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #147

3 years agolib/posix-user: Register `setgroups` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:46:53 +0000 (19:46 +0200)]
lib/posix-user: Register `setgroups` to syscall_shim

Register `setgroups` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #117

3 years agolib/posix-user: Register `setregid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:33:45 +0000 (19:33 +0200)]
lib/posix-user: Register `setregid` to syscall_shim

Register `setregid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #115

3 years agolib/posix-user: Register `setreuid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:17:01 +0000 (19:17 +0200)]
lib/posix-user: Register `setreuid` to syscall_shim

Register `setreuid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #114

3 years agolib/posix-user: Register `setgid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 16:45:47 +0000 (18:45 +0200)]
lib/posix-user: Register `setgid` to syscall_shim

Register `setgid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #113

3 years agolib/posix-user: Register `getresgid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 18:06:38 +0000 (20:06 +0200)]
lib/posix-user: Register `getresgid` to syscall_shim

Register `getresgid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #111

3 years agoplat/xen/drivers/net: Add receive operation
Costin Lupu [Tue, 17 Nov 2020 08:38:48 +0000 (10:38 +0200)]
plat/xen/drivers/net: Add receive operation

Incoming packets are written in pages allocated by the netfront. Such pages are
allocated and registered to the shared ring after completion of receiving
operations.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen/drivers/net: Add transmit operation
Costin Lupu [Tue, 17 Nov 2020 08:38:47 +0000 (10:38 +0200)]
plat/xen/drivers/net: Add transmit operation

Whenever a packet is transmitted, the request describing it is written in the
shared ring. The packet itself is written in a page referenced by the request
and shared, as well, with the backend. At the end of each transmit operation, a
cleanup operation is performed free'ing the resources allocated for the
previously transmitted packets.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen/drivers/net: Start netfront device
Costin Lupu [Tue, 17 Nov 2020 08:38:46 +0000 (10:38 +0200)]
plat/xen/drivers/net: Start netfront device

Starting the device implies establishing the connection between netfront and
netback. The connection is set up after a negociation between the two end
points. After configuring the device queues, the netfront publishes via
Xenstore the information associated with the queues which will be used by the
backend to connect.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
3 years agoplat/xen/drivers/net: Enable/disable interrupts for rx queues
Costin Lupu [Tue, 17 Nov 2020 08:38:45 +0000 (10:38 +0200)]
plat/xen/drivers/net: Enable/disable interrupts for rx queues

The user can enable/disable interrupts for devices according with the operation
mode he or she chooses for the device. This patch follows closely the logic
implemented in the virtio net driver.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
3 years agoplat/xen/drivers/net: Configure netfront rx queue
Costin Lupu [Tue, 17 Nov 2020 08:38:44 +0000 (10:38 +0200)]
plat/xen/drivers/net: Configure netfront rx queue

Incoming packets are saved in buffers allocated with user-provided callbacks.
Whenever such packet is available, the driver is notified via event channels.
This patch introduces the configuration logic for rx queues and the handler
used in dealing with the notifications.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen/drivers/net: Configure netfront tx queue
Costin Lupu [Tue, 17 Nov 2020 08:38:43 +0000 (10:38 +0200)]
plat/xen/drivers/net: Configure netfront tx queue

For each queue, either rx or tx, the packets references are kept in a Xen
shared ring. This patch introduces the initialization of tx shared ring. Each
time the driver will send a packet it will add a request on the tx shared ring
which will be serviced by the backend. Therefore we need to keep track of the
requests by keeping track of their IDs. Because our resources are limited, we
will maintain a pool of IDs (see `freelist` array) for this purpose.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen/drivers/net: Create netfront queues
Costin Lupu [Tue, 17 Nov 2020 08:38:42 +0000 (10:38 +0200)]
plat/xen/drivers/net: Create netfront queues

We continue with the device configuration by retrieving the Xenstore
information regarding the number of queues and their associated event channels.
Netfront devices operate pairs of Rx/Tx queues and for notifications we can
either use a single event channel per pair or split event channels.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
3 years agoplat/xen/drivers/net: Configure netfront device
Costin Lupu [Tue, 17 Nov 2020 08:38:41 +0000 (10:38 +0200)]
plat/xen/drivers/net: Configure netfront device

The information needed for configuring netfront devices is in the Xenstore. For
now, we only retrieve the MAC and IP addresses from there in order to
initialize the device.

This patch introduces the `netfront_dev` structure which integrates both netdev
and Xenbus device information and also keeps the configuration parameters.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen/drivers: Add skeleton for netfront driver
Costin Lupu [Tue, 17 Nov 2020 08:38:40 +0000 (10:38 +0200)]
plat/xen/drivers: Add skeleton for netfront driver

This patch introduces the skeleton for the Xen netfront driver.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen: Add vif device type
Costin Lupu [Tue, 17 Nov 2020 08:38:39 +0000 (10:38 +0200)]
plat/xen: Add vif device type

vif device type is used for virtual network interfaces.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Roxana Nicolescu <nicolescu.roxana1996@gmail.com>
3 years agolib/vfscore: Correct the macro name of UK_LIBC_SYSCALLS
Jia He [Thu, 13 May 2021 08:28:33 +0000 (16:28 +0800)]
lib/vfscore: Correct the macro name of UK_LIBC_SYSCALLS

Correct the name from UK_LIBC_SYSCALL to UK_LIBC_SYSCALLS

Otherwise the linking will report:
libs/newlib/musl-imported/src/termios/tcsetattr.c:35:
undefined reference to `ioctl'
/bin/ld:
apps/sqlite/build/sqlite_kvm-x86_64.o: in
function `tcgetattr':
libs/newlib/musl-imported/src/termios/tcgetattr.c:30:
undefined reference to `ioctl'

Reported-by: Alexander Jung <a.jung@lancs.ac.uk>
Signed-off-by: Jia He <justin.he@arm.com>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #204

3 years agolib/vfscore: Update registration of `sync` to syscall_shim
Sergiu Moga [Thu, 13 May 2021 08:49:25 +0000 (11:49 +0300)]
lib/vfscore: Update registration of `sync` to syscall_shim

Change `UK_LIBC_SYSCALL` to `UK_LIBC_SYSCALLS` for the `sync` system call
with respect to the updated documentation.

Reported-by: Alexander Jung <a.jung@lancs.ac.uk>
Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #204

3 years agodoc/developers: Change `UK_LIBC_SYSCALL` to `UK_LIBC_SYSCALLS`
Sergiu Moga [Thu, 13 May 2021 08:42:21 +0000 (11:42 +0300)]
doc/developers: Change `UK_LIBC_SYSCALL` to `UK_LIBC_SYSCALLS`

Change the macro definition from `UK_LIBC_SYSCALL` to `UK_LIBC_SYSCALLS`.

Reported-by: Alexander Jung <a.jung@lancs.ac.uk>
Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #204

4 years agobuild: Introduce `mk_sub_libbuild_dir`
Simon Kuenzer [Mon, 26 Apr 2021 14:28:29 +0000 (16:28 +0200)]
build: Introduce `mk_sub_libbuild_dir`

Inline with `mk_sub_build_dir`, this commit introduces
`mk_sub_libbuild_dir` that enables creating a sub build
directory for a library. This new Makefile command has
two parameters: (1) library name, (2) sub directory
structure.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #194

4 years agolib/uktime: Register time syscall to syscall shim
Razvan Deaconescu [Sun, 14 Feb 2021 19:50:13 +0000 (21:50 +0200)]
lib/uktime: Register time syscall to syscall shim

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #124

4 years agolib/vfscore: Register `fstatfs` to syscall_shim
Sergiu Moga [Mon, 8 Mar 2021 17:25:54 +0000 (19:25 +0200)]
lib/vfscore: Register `fstatfs` to syscall_shim

Register `fstatfs` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #144

4 years agolib/*: Use `UK_WARN_STUBBED()`
Simon Kuenzer [Mon, 25 May 2020 01:53:53 +0000 (03:53 +0200)]
lib/*: Use `UK_WARN_STUBBED()`

Replaces the occurrences of `WARN_STUBBED()` to `UK_WARN_STUBBED()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #172

4 years agolib/ukdebug: Provide `uk_printd_once()`, `uk_printk_once()`
Simon Kuenzer [Mon, 25 May 2020 01:44:01 +0000 (03:44 +0200)]
lib/ukdebug: Provide `uk_printd_once()`, `uk_printk_once()`

This commit introduces debug and kernel print helpers that print a
message just once. Any successive call of the same location of a
message will produce no output: `uk_printd_once()` and
`uk_printk_once()`, as well as `uk_pr_crit_once()`, `uk_pr_err_once()`,
`uk_pr_warn_once()`, and `uk_pr_info_once()`.
This can be used to limit the amount of shown messages.

This commit updates the macro `WARN_STUBBED()`. Since the
functionality of printing once is made generally available, the macro
is based on `uk_pr_warn_once()`. In order to be inline with the
Unikraft naming scheme and reducing the risk of naming conflicts,
the macro is also introduced under the name `UK_WARN_STUBBED()`.
`WARN_STUBBED()` should be considered as deprecated.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #172

4 years agolib/uktime: Register times syscall in syscall shim
Razvan Deaconescu [Sun, 14 Feb 2021 20:09:16 +0000 (22:09 +0200)]
lib/uktime: Register times syscall in syscall shim

The times syscall is marked as not supported, i.e. returns -ENOTSUP.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #125

4 years agolib/posix-user: Register `getgroups` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:39:06 +0000 (19:39 +0200)]
lib/posix-user: Register `getgroups` to syscall_shim

Register `getgroups` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #116

4 years agolib/posix-user: Register `setfsuid` to syscall_shim
Sergiu Moga [Sat, 13 Mar 2021 13:39:49 +0000 (15:39 +0200)]
lib/posix-user: Register `setfsuid` to syscall_shim

Register `setfsuid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #145

4 years agolib/vfscore: Register `statfs` to syscall_shim
Sergiu Moga [Mon, 8 Mar 2021 17:16:11 +0000 (19:16 +0200)]
lib/vfscore: Register `statfs` to syscall_shim

Register `statfs` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #143

4 years agolib/posix-user: Register `setfsgid` to syscall_shim
Sergiu Moga [Sat, 13 Mar 2021 13:57:35 +0000 (15:57 +0200)]
lib/posix-user: Register `setfsgid` to syscall_shim

Register `setfsgid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #146

4 years agolib/vfscore: Register `ioctl` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 19:58:34 +0000 (21:58 +0200)]
lib/vfscore: Register `ioctl` to syscall_shim

Register `ioctl` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cristian Vijelie <cristianvijelie@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #153

4 years agolib/uksignal: Register alarm syscall to syscall shim
Razvan Deaconescu [Sun, 14 Feb 2021 18:45:42 +0000 (20:45 +0200)]
lib/uksignal: Register alarm syscall to syscall shim

The alarm syscall is stubbed, i.e. the implementation returns 0.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #122

4 years agolib/nolibc: Add fputc and putchar
Vlad-Andrei Badoiu [Wed, 31 Mar 2021 19:47:32 +0000 (22:47 +0300)]
lib/nolibc: Add fputc and putchar

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Reviewed-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #177

4 years agodevfs: Introduce stdout device
Alexander Jung [Fri, 15 Jan 2021 22:44:56 +0000 (23:44 +0100)]
devfs: Introduce stdout device

This commit introduces a new device, `/dev/stdout` which pipes
output to the platform console.

Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #104

4 years agolib/*: Change `libc-style` syscalls to their `raw` variant
Sergiu Moga [Mon, 15 Feb 2021 16:16:34 +0000 (18:16 +0200)]
lib/*: Change `libc-style` syscalls to their `raw` variant

This commit changes the recently merged `libc-style` syscall registrations to syscall-shim to their `raw` variant.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cristian Vijelie <cristianvijelie@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #129

4 years agolib/uksignal: Register pause syscall to syscall shim
Razvan Deaconescu [Sun, 14 Feb 2021 18:30:26 +0000 (20:30 +0200)]
lib/uksignal: Register pause syscall to syscall shim

The pause syscall is stubbed, i.e. the implementation returns 0.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #121

4 years agolib/posix-user: Register `capset` to syscall_shim
Sergiu Moga [Sat, 13 Mar 2021 16:22:47 +0000 (18:22 +0200)]
lib/posix-user: Register `capset` to syscall_shim

Register `capset` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #148

4 years agoplat/common: Fix struct name in `sw_ctx_size()`
Simon Kuenzer [Thu, 22 Apr 2021 21:29:15 +0000 (23:29 +0200)]
plat/common: Fix struct name in `sw_ctx_size()`

By mistake, a wrong struct name (`ukplat_ctx`) was used instead
of `sw_ctx` in `sw_ctx_size()`. The issue was introduced with
commit 9ca0659f6 and caused a Unikraft build to fail.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #188

4 years agobuild: Warn about empty libraries and platforms
Simon Kuenzer [Mon, 15 Mar 2021 09:44:35 +0000 (10:44 +0100)]
build: Warn about empty libraries and platforms

Print a warning on the console when libraries and/or platforms are dropped
from the build because they are empty. The message is shown when verbose
mode is active (`V=1`).

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #152

4 years agolib/uksignal: Use thread creation callbacks for initialization
Simon Kuenzer [Mon, 22 Feb 2021 16:13:41 +0000 (17:13 +0100)]
lib/uksignal: Use thread creation callbacks for initialization

Make use of thread creation callbacks to initializing `signals_container`
of a thread. This is making `lib/uksched` more independent from
`lib/uksignal`. In order to achieve complete independence,
`signals_container` should actually be moved to the thread local storage
of each thread and defined within `uksignal`. So far, we do not have a
helper function to access a variable of a foreign TLS during thread
initialization. Because of this we need to finish this restructuring
later.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #138

4 years agolib/ukbus: Increase initialization class to `platform`
Simon Kuenzer [Mon, 14 Dec 2020 20:23:58 +0000 (21:23 +0100)]
lib/ukbus: Increase initialization class to `platform`

Since buses can have dependencies to other basic libraries and require
their early initialization to be called before (e.g, in order create
threads (XenStore), a potentially used threading API library needs to
be initialized before), we make sure that `UK_INIT_CLASS_EARLY` is
reserved for early library initialization. We scan for devices at the
intended stage `UK_INIT_CLASS_PLAT`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #138

4 years agolib/uksched: Thread creation callbacks
Simon Kuenzer [Mon, 14 Dec 2020 20:23:57 +0000 (21:23 +0100)]
lib/uksched: Thread creation callbacks

Introduces the ability for libraries to hook into thread creation and
deletion process at `lib/uksched`. Main intended usage are libc's
(like newlibc, musl) that can initialize TLS for each thread, even
when a thread is created/deleted through the uksched API.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #138

4 years agoinclude/: No dependency to `lib/ukalloc` for thread contexts
Simon Kuenzer [Mon, 14 Dec 2020 20:23:56 +0000 (21:23 +0100)]
include/: No dependency to `lib/ukalloc` for thread contexts

Changes the platform API in a way so that there is no dependency to
`ukalloc` for context creation. An API function is added to query the
allocation size for a thread context. Another API function is added to
call the platform-specific thread context initialization.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #138

4 years agoinclude/: Remove libc dependency in `<uk/plat/thread.h>`
Simon Kuenzer [Mon, 14 Dec 2020 20:23:55 +0000 (21:23 +0100)]
include/: Remove libc dependency in `<uk/plat/thread.h>`

Removes the dependency to a libc with the platform header
`<uk/plat/thread.h>`. This is done in order to avoid unexpected
import orders and conflicts caused by generic Unikraft headers.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #138

4 years agolib/vfscore: Register `mount` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 10:16:22 +0000 (12:16 +0200)]
lib/vfscore: Register `mount` to syscall_shim

Register `mount` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #126

4 years agolib/uktime: Register gettimeofday syscall to syscall shim
Razvan Deaconescu [Sun, 14 Feb 2021 19:08:14 +0000 (21:08 +0200)]
lib/uktime: Register gettimeofday syscall to syscall shim

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #123

4 years agolib/posix-user: Register `setuid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 16:32:11 +0000 (18:32 +0200)]
lib/posix-user: Register `setuid` to syscall_shim

Register `setuid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #112

4 years agobuild: Support generating C/C++ headers with pre-processing
Simon Kuenzer [Fri, 18 Dec 2020 18:09:24 +0000 (19:09 +0100)]
build: Support generating C/C++ headers with pre-processing

Supports generating C/C++ header files by the pre-processing rules
of the build system.

Example:
 LIBMYLIB_SRCS += $(LIBMYLIB_BASE)/header.m4>.h

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
4 years agobuild: `*.in` files as pure pre-processed files
Simon Kuenzer [Fri, 18 Dec 2020 18:09:23 +0000 (19:09 +0100)]
build: `*.in` files as pure pre-processed files

Registers `*.in` files as purely pre-processed files. The idea is
that such generated files can be used/included by other source
files during pre-processing or compiling.

Example:
 LIBMYLIB_SRCS += $(LIBMYLIB_BASE)/source.m4>.in

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>