]> xenbits.xensource.com Git - unikraft/unikraft.git/log
unikraft/unikraft.git
4 years agolib/posix-process: Register `getpriority` to syscall_shim
Sergiu Moga [Mon, 18 Jan 2021 09:54:11 +0000 (11:54 +0200)]
lib/posix-process: Register `getpriority` to syscall_shim

Register `getpriority` system call to syscall_shim library.

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: #87

4 years agolib/posix-process: Register `setpriority` to syscall_shim
Sergiu Moga [Sun, 24 Jan 2021 11:59:39 +0000 (13:59 +0200)]
lib/posix-process: Register `setpriority` to syscall_shim

Register `setpriority` system call to syscall_shim library.

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: #90

4 years agolib/posix-process: Register `getsid` to syscall_shim
Sergiu Moga [Sun, 24 Jan 2021 12:13:56 +0000 (14:13 +0200)]
lib/posix-process: Register `getsid` to syscall_shim

Register `getsid` system call to syscall_shim library.

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: #91

4 years agolib/posix-process: Register `setsid` to syscall_shim
Sergiu Moga [Sun, 24 Jan 2021 12:24:11 +0000 (14:24 +0200)]
lib/posix-process: Register `setsid` to syscall_shim

Register `setsid` system call to syscall_shim library.

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: #92

4 years agolib/posix-process: Register `setpgid` to syscall_shim
Sergiu Moga [Sun, 24 Jan 2021 12:36:05 +0000 (14:36 +0200)]
lib/posix-process: Register `setpgid` to syscall_shim

Register `setpgid` system call to syscall_shim library.

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: #93

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

Register `getuid` system call to syscall_shim library.

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: #98

4 years agolib/vfscore: Register `futimesat` to syscall_shim
Sergiu Moga [Fri, 15 Jan 2021 16:33:12 +0000 (18:33 +0200)]
lib/vfscore: Register `futimesat` to syscall_shim

Register `futimesat` system call to syscall_shim library.

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: #84

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

Register `getgid` system call to syscall_shim library.

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: #99

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

Register `geteuid` system call to syscall_shim library.

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: #100

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

Register `getegid` system call to syscall_shim library.

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: #101

4 years agolib/ukallocpool: Batched allocation
Simon Kuenzer [Tue, 22 Dec 2020 12:52:37 +0000 (13:52 +0100)]
lib/ukallocpool: Batched allocation

Introduce low-overhead interfaces for batched allocations and batched
freeing of objects.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
4 years agolib/ukallocpool: `lib/ukalloc` compatible interface
Simon Kuenzer [Tue, 22 Dec 2020 12:52:36 +0000 (13:52 +0100)]
lib/ukallocpool: `lib/ukalloc` compatible interface

Provide a ukalloc compatible interface. This enables the usage of pools
with common allocator interfaces, like `uk_malloc()`, `uk_free()`,
and `uk_memalign()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
4 years agolib/ukallocpool: Allocate pool on parent allocator
Simon Kuenzer [Tue, 22 Dec 2020 12:52:35 +0000 (13:52 +0100)]
lib/ukallocpool: Allocate pool on parent allocator

Provides a function that allocates and initializes a pool on a
given parent allocator.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
4 years agolib/ukallocpool: LIFO pool implementation
Simon Kuenzer [Tue, 22 Dec 2020 12:52:34 +0000 (13:52 +0100)]
lib/ukallocpool: LIFO pool implementation

Initial implementation of a memory pool (same-sized and fixed-sized object
allocator) following LIFO principle by using a single list to keep track of
free objects. LIFO is chosen to potentially better utilize hardware caches.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
4 years agolib/ukallocpool: Library skeleton
Simon Kuenzer [Tue, 22 Dec 2020 12:52:33 +0000 (13:52 +0100)]
lib/ukallocpool: Library skeleton

Registers the library skeleton for ukallocpool.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
4 years agobuild: Fix typo when initializing `UK_PREPARE-y`
Simon Kuenzer [Fri, 18 Dec 2020 17:54:38 +0000 (18:54 +0100)]
build: Fix typo when initializing `UK_PREPARE-y`

Fixes a typo when initializing `UK_PREPARE-y` in `/Makefile`

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
4 years agolib/vfscore: Add missing goto statement in pwritev
Razvan Deaconescu [Sat, 30 Jan 2021 11:11:57 +0000 (13:11 +0200)]
lib/vfscore: Add missing goto statement in pwritev

The label out_errno in pwritev() is not used, though it should be, as it
is the case with preadv(). This updates pwritev() and add a missing goto
statement to the out_errno label. It makes the implementation of
pwritev() consistent with preadv().

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #96

4 years agolib/vfscore: Fix label issue (out_error -> out_errno)
Razvan Deaconescu [Thu, 28 Jan 2021 20:38:57 +0000 (22:38 +0200)]
lib/vfscore: Fix label issue (out_error -> out_errno)

The out_error jump label used by goto in lib/vfscore/main.c is not
properly named. It results in an error when using vfscore. This fix
renames it to out_errno.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #96

4 years agolib/uktime: Register `nanosleep` to syscall_shim
Sergiu Moga [Sun, 24 Jan 2021 13:49:23 +0000 (15:49 +0200)]
lib/uktime: Register `nanosleep` to syscall_shim

Register `nanosleep` system call to syscall_shim library.

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: #94

4 years agobuild: Upgrade missing platform to error
Alexander Jung [Mon, 18 Jan 2021 15:45:32 +0000 (16:45 +0100)]
build: Upgrade missing platform to error

This commit turns the missing platform selection into an error.
This is useful when build step is pipelined to prevent further
steps to be completed as the build will not start without a target
platform.

Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #88

4 years agoSolved the warnings
ARGINT DRAGOS IULIAN [Fri, 29 Jan 2021 11:34:18 +0000 (13:34 +0200)]
Solved the warnings

Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #71

4 years agosolve ukswrand does not generate random numbers
dragosargint [Fri, 27 Nov 2020 13:55:42 +0000 (15:55 +0200)]
solve ukswrand does not generate random numbers

If you configure ukswrand with the platform timestamp
as initial seed, and you'll try to use getrandom function
or try to read from /dev/urandom you won't get random
numbers. This is because the initialization of the random
number generator, which is located in the swrand.c file,
is done earlier than the initialization of TSC clock.

Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #71

4 years agolib/posix-process: Register `getpgid` to syscall_shim
Sergiu Moga [Mon, 18 Jan 2021 09:20:49 +0000 (11:20 +0200)]
lib/posix-process: Register `getpgid` to syscall_shim

Register `getpgid` system call to syscall_shim library.

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: #85

4 years agolib/vfscore: Register `utimensat` to syscall_shim
Sergiu Moga [Fri, 15 Jan 2021 14:40:35 +0000 (16:40 +0200)]
lib/vfscore: Register `utimensat` to syscall_shim

Register `utimensat` system call to syscall_shim library.

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: #83

4 years agolib/posix-sysinfo: Register `sethostname` to syscall_shim
Sergiu Moga [Mon, 11 Jan 2021 11:22:39 +0000 (13:22 +0200)]
lib/posix-sysinfo: Register `sethostname` to syscall_shim

Register `sethostname` system call to syscall_shim library.

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: #82

4 years agolib/vfscore: Implement `getcwd` with a raw system call
Simon Kuenzer [Mon, 21 Dec 2020 15:47:33 +0000 (16:47 +0100)]
lib/vfscore: Implement `getcwd` with a raw system call

Implements `getcwd` with a raw system call (`UK_SYSCALL_R_DEFINE`)
instead. This variant should be preferred because it avoids the
usage of `errno`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Liza Babu <lizza.babu@gmail.com>
4 years agolib/vfscore: Add preadv tracepoints
Alexander Jung [Mon, 14 Dec 2020 17:25:44 +0000 (18:25 +0100)]
lib/vfscore: Add preadv tracepoints

Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #79

4 years agolib/vfscore: Change preadv and pwritev fd error handling.
Alexander Jung [Mon, 14 Dec 2020 17:23:55 +0000 (18:23 +0100)]
lib/vfscore: Change preadv and pwritev fd error handling.

This commit discards the `has_error` method in favour of in-line checks against
the file descriptor.  In BSD's internal implementation, the error is simply
passed upwards from `dofilewrite` and `dofileread`.  Additionally, the
`has_error` method would return a false positive in the circumstance where an
error was non-zero and did not constitute a EWOULDBLOCK or EINTR and the number
of bytes read was greater than zero.  This scenario was discovered when a
buffer greater than the number of bytes available was read from a vnop read op
which returns the number of bytes read (as per POSIX requirements).

Additional checks inline with FreeBSD's[0][1] implementation are for whether
the fd is seekable; the offset of the file is non-zero; and, the file type is
not a character device.

[0]: https://github.com/freebsd/freebsd/blob/6af4a8cb884975f65a51b3b6d766e084faf55d4f/sys/kern/sys_generic.c#L320
[1]: https://github.com/freebsd/freebsd/blob/6af4a8cb884975f65a51b3b6d766e084faf55d4f/sys/kern/sys_generic.c#L522

Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #79

4 years agolib/vfscore: Reduce pread() and pwrite() to their -v() counterparts.
Alexander Jung [Mon, 14 Dec 2020 17:21:11 +0000 (18:21 +0100)]
lib/vfscore: Reduce pread() and pwrite() to their -v() counterparts.

This commit reorganizes the pread() and pwrite() method such that they rely on
preadv() and pwritev(), respectively.  This is due the overlap in
functionality, where pread() and pwrite() simply create a struct iovec method
which is to be passed in their relevant sys_ method.

Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #79

4 years agolib/vfscore: Re-order methods to be in identical order.
Alexander Jung [Mon, 14 Dec 2020 17:15:48 +0000 (18:15 +0100)]
lib/vfscore: Re-order methods to be in identical order.

This commit simply moves the preadv method such that it is
in the same order sequence as the write methods.

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

4 years agolib/syscall_shim: Add extern "C" linkage directive
Razvan Deaconescu [Fri, 18 Dec 2020 13:38:33 +0000 (15:38 +0200)]
lib/syscall_shim: Add extern "C" linkage directive

Add extern "C" linkage directive to use syscall shim functions in C++
source code.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #81

4 years agoCast value to unsigned to avoid undefined behavior
Vlad-Andrei Badoiu [Sat, 2 Jan 2021 21:48:33 +0000 (23:48 +0200)]
Cast value to unsigned to avoid undefined behavior

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
4 years agoplat/virtio: Add error check for tag name
Sharan Santhanam [Fri, 8 Jan 2021 10:00:14 +0000 (15:30 +0530)]
plat/virtio: Add error check for tag name

During virtio-9p configuration get we check for error while getting
the tag length but not the tag. The patch adds this check

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
4 years agoplat/virtio: virtio_config_get returns >= 0
Sharan Santhanam [Fri, 8 Jan 2021 10:00:13 +0000 (15:30 +0530)]
plat/virtio: virtio_config_get returns >= 0

The 9pfs driver fails to get the configuration when the
virtio_config_get returns a value greater than 0. The function
description on virtio_config_get was incorrect. The patches
changes the error check in the virtio-9p and the function
description

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
4 years agolib/ukblkdev: blkdev.h: Description about interrupts
Simon Kuenzer [Tue, 22 Dec 2020 15:37:58 +0000 (16:37 +0100)]
lib/ukblkdev: blkdev.h: Description about interrupts

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
4 years agolib/ukblkdev: Provide `uk_blkdev_size()`
Simon Kuenzer [Tue, 22 Dec 2020 15:37:57 +0000 (16:37 +0100)]
lib/ukblkdev: Provide `uk_blkdev_size()`

This commits provides a shortcut macro for retrieving the block device
size in number of bytes.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
4 years agolib/ukblkdev: API refactoring: `uk_blkdev_queue_configure()`
Simon Kuenzer [Tue, 22 Dec 2020 15:37:56 +0000 (16:37 +0100)]
lib/ukblkdev: API refactoring: `uk_blkdev_queue_configure()`

For API consistency reasons, this patch renames
`uk_blkdev_queue_setup()` to `uk_blkdev_queue_configure()`. This is
done to be inline with lib/uknetdev. Additionally and as counterpart
for queue configuration, we rename `uk_blkdev_release()` to
`uk_blkdev_unconfigure()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
4 years agolib/ukblkdev: blkreq.h: Use UK_BLKREQ_ prefix for states and ops
Simon Kuenzer [Tue, 22 Dec 2020 15:37:55 +0000 (16:37 +0100)]
lib/ukblkdev: blkreq.h: Use UK_BLKREQ_ prefix for states and ops

Instead of using `UK_BLKDEV_REQ_` prefix for `struct uk_blkreq`
states (finished, unfinished) and `UK_BLKDEV_` prefix for operation
requests (read, write, flush) this commits simplifies the API by using
the `UK_BLKREQ_` prefix.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
4 years agolib/ukblkdev: blkreq.h: Use typedef for __sector
Simon Kuenzer [Tue, 22 Dec 2020 15:37:54 +0000 (16:37 +0100)]
lib/ukblkdev: blkreq.h: Use typedef for __sector

Introduces `__sector` with a type definition instead with an alias
macro. This is done for consistency reasons. Additionally, the print
format macro `__PRIsctr` is introduced so that a sector number can be
printed correctly.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
4 years agolib/ukblkdev: blkreq.h: Include <uk/arch/atomic.h>
Simon Kuenzer [Tue, 22 Dec 2020 15:37:53 +0000 (16:37 +0100)]
lib/ukblkdev: blkreq.h: Include <uk/arch/atomic.h>

The header `blkreq.h` uses atomic operations but did not include
`<uk/arch/atomic.h>`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
4 years agolib/ukblkdev: blkdev.h: Include <uk/assert.h>
Simon Kuenzer [Tue, 22 Dec 2020 15:37:52 +0000 (16:37 +0100)]
lib/ukblkdev: blkdev.h: Include <uk/assert.h>

The header `blkdev.h` uses UK_ASSERT but did not include
`<uk/assert.h>`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
4 years agolib/posix-user: add more symbols to exportsyms.uk
Hugo Lefeuvre [Thu, 24 Dec 2020 09:22:42 +0000 (10:22 +0100)]
lib/posix-user: add more symbols to exportsyms.uk

These symbols were not previously exported. Without these exports,
users get linking errors.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
4 years agoplat/xen: enable XSAVE for PKRU register
Hugo Lefeuvre [Fri, 11 Dec 2020 16:35:15 +0000 (16:35 +0000)]
plat/xen: enable XSAVE for PKRU register

This patch is identical to the KVM patch (previous patch).

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Reviewed-by: Mocanu Gabriel <gabi.mocanu98@gmail.com>
4 years agoplat/kvm: enable XSAVE for PKRU register
Hugo Lefeuvre [Fri, 11 Dec 2020 16:35:14 +0000 (16:35 +0000)]
plat/kvm: enable XSAVE for PKRU register

According to Intel 64 and IA-32 Architectures Software Developer’s
Manual Vol. 1, Section 13.5.7 'PKRU State':

software can use the XSAVE feature set to manage PKRU state
only if XCR0[9] = 1

This patch sets XCR0[9] if PKU is available (and enabled via
CONFIG_HAVE_X86PKU).

Note: we do not support PKU without XSAVE. If CONFIG_HAVE_X86PKU is
selected but XSAVE is not available, we simply don't initialize PKU
and let the boot process gracefully abort later.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Reviewed-by: Mocanu Gabriel <gabi.mocanu98@gmail.com>
4 years agoplat/xen: toggle PKE bit if HAVE_X86PKU is enabled
Hugo Lefeuvre [Fri, 11 Dec 2020 16:35:13 +0000 (16:35 +0000)]
plat/xen: toggle PKE bit if HAVE_X86PKU is enabled

This patch is identical to the KVM patch.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Reviewed-by: Mocanu Gabriel <gabi.mocanu98@gmail.com>
4 years agoplat/kvm: toggle PKE bit if HAVE_X86PKU is enabled
Hugo Lefeuvre [Fri, 11 Dec 2020 16:35:12 +0000 (16:35 +0000)]
plat/kvm: toggle PKE bit if HAVE_X86PKU is enabled

Provided that PKU is advertised by cpuid (EAX=7, ECX=0, ECX bit 4),
Memory Protection Keys can be enabled by setting bit 22 (PKE) in CR4
(see Intel 64 and IA-32 Architectures Software Developer's Manual Vol.
3A, Section 2.5 'Control Registers').

Since we do not want to pay the cost of MPK-related code when MPK is
not enabled, we introduce a new HAVE_X86PKU property; MPK code is
compile-guarded so that it does not get compiled in without
HAVE_X86PKU. HAVE_X86PKU will be set by PKU kernel libraries later on.

At boot time, if HAVE_X86PKU is enabled, the kernel now checks whether
PKU is advertised by cpuid. If not, it aborts the boot process. The
underlying idea is that images compiled with HAVE_X86PKU are
*specialized* to be executed on PKU-enabled hardware. Hence, provided
that HAVE_X86PKU is set, there is a guarantee that PKU is supported
*and* enabled, effectively removing the need for checks later at
runtime. This might benefit performance when the domain switching rate
is high.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Reviewed-by: Mocanu Gabriel <gabi.mocanu98@gmail.com>
4 years agolib/vfscore: Register `getcwd` to syscall_shim
Constantin Raducanu [Fri, 17 Jul 2020 12:47:00 +0000 (12:47 +0000)]
lib/vfscore: Register `getcwd` to syscall_shim

Registers `getcwd` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Liza Babu <lizza.babu@gmail.com>
4 years agolib/uktime: Register `clock_gettime` to syscall_shim
Constantin Raducanu [Fri, 17 Apr 2020 19:41:16 +0000 (22:41 +0300)]
lib/uktime: Register `clock_gettime` to syscall_shim

Registers `clock_gettime` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Liza Babu <lizza.babu@gmail.com>
4 years agolib/ukmmap: Register `mmap` and `munmap` to syscall_shim
Constantin Raducanu [Fri, 17 Jul 2020 12:47:15 +0000 (15:47 +0300)]
lib/ukmmap: Register `mmap` and `munmap` to syscall_shim

Registers `mmap` and `munmap` system calls to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Liza Babu <lizza.babu@gmail.com>
4 years agolib/vfscore: Register `getpid` and `getppid` to syscall_shim
Constantin Raducanu [Fri, 17 Jul 2020 12:47:14 +0000 (15:47 +0300)]
lib/vfscore: Register `getpid` and `getppid` to syscall_shim

Registers `getpid` and `getppid` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Liza Babu <lizza.babu@gmail.com>
4 years agobuild: Fix "Argument list too long" problem
Cyril Soldani [Fri, 10 Apr 2020 09:09:06 +0000 (11:09 +0200)]
build: Fix "Argument list too long" problem

For libraries with lots of object files, such as musl, `make clean` was
failing with "make: execvp: /bin/sh: Argument list too long" on some
machines (depending on default maximum command-line length).

The user could not solve this problem by changing his shell limits,
because GNU make resets those to system defaults.

This patch removes the direct call to `rm`, and replace it with a call
to `xargs rm`, using an intermediate file generated by `make`. The
intermediate file is kept after `clean` so that the user can inspect
which files have been removed.

Signed-off-by: Cyril Soldani <cyril.soldani@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
4 years agobuild: Always use -no-pie as part of LIBLDFLAGS
Razvan Deaconescu [Mon, 23 Mar 2020 08:25:33 +0000 (10:25 +0200)]
build: Always use -no-pie as part of LIBLDFLAGS

-no-pie is not configurable for LIBLDFLAGS. It is always part of
LIBLDFLAGS, as -Wl,-r enforces that. If PIC/PIE is configured by
updating COMPFLAGS/LDFLAGS, no update will be required for LIBLDFLAGS.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
4 years agobuild: Remove --omagic flag from LIBLDFLAGS
Razvan Deaconescu [Mon, 23 Mar 2020 08:25:32 +0000 (10:25 +0200)]
build: Remove --omagic flag from LIBLDFLAGS

The --omagic flag is required for the final linking step, as part of
LDFLAGS.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
4 years agobuild: Use -fno-PIC instead of -no-pie as compilation flag
Razvan Deaconescu [Mon, 23 Mar 2020 08:25:31 +0000 (10:25 +0200)]
build: Use -fno-PIC instead of -no-pie as compilation flag

-no-pie is used as a linking option to disable PIE (Position Independent
Executable). -fno-PIC is used for compilation (COMPFLAGS).

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
4 years agolib/vfscore: Fix possible memleak in getcwd
Vlad-Andrei Badoiu [Sat, 21 Nov 2020 15:07:31 +0000 (17:07 +0200)]
lib/vfscore: Fix possible memleak in getcwd

If path is null and the memory is allocated by us then if size < len
we exit the call without freeing the memory. We solve this by moving the
check for sizer earlier.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agolib/uklibparam: Add missing return value check
Vlad-Andrei Badoiu [Sat, 21 Nov 2020 15:07:30 +0000 (17:07 +0200)]
lib/uklibparam: Add missing return value check

We add a check for the return value of kernel_args_set.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agoplat/drivers/virtio: Add error check for return value
Vlad-Andrei Badoiu [Sat, 21 Nov 2020 15:07:29 +0000 (17:07 +0200)]
plat/drivers/virtio: Add error check for return value

If virtio_config_get returns an error then tag_len does
not get initialized and the next calloc is ran with an
uninitialized length.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agolib/vfscore: Add missing error value
Vlad-Andrei Badoiu [Sat, 21 Nov 2020 15:07:28 +0000 (17:07 +0200)]
lib/vfscore: Add missing error value

When mp->m_root is null we don't set an error. We solve
this by setting error equal to ENOMEM.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agolib/vfscore: Fix bug where newdp is freed before initialization
Vlad-Andrei Badoiu [Sat, 21 Nov 2020 15:07:27 +0000 (17:07 +0200)]
lib/vfscore: Fix bug where newdp is freed before initialization

When vp->v_type == VDIR we jump to out where newdp is freed
via the drele call but newdp has yet to be initialized. We
solve this by checking the output of namei first.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agolib/vfscore: Register `flock` to syscall_shim
Constantin Raducanu [Sat, 2 May 2020 18:18:35 +0000 (21:18 +0300)]
lib/vfscore: Register `flock` to syscall_shim

Registers `flock` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `lstat` to syscall_shim
Constantin Raducanu [Sat, 2 May 2020 18:18:34 +0000 (21:18 +0300)]
lib/vfscore: Register `lstat` to syscall_shim

Registers `lstat` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `umask` to syscall_shim
Constantin Raducanu [Sat, 2 May 2020 18:18:33 +0000 (21:18 +0300)]
lib/vfscore: Register `umask` to syscall_shim

Registers `umask` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `preadv` to syscall_shim
Constantin Raducanu [Sat, 2 May 2020 18:18:32 +0000 (21:18 +0300)]
lib/vfscore: Register `preadv` to syscall_shim

Registers `preadv` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `fsync` and `fdatasync` to syscall_shim
Constantin Raducanu [Sat, 2 May 2020 18:18:31 +0000 (21:18 +0300)]
lib/vfscore: Register `fsync` and `fdatasync` to syscall_shim

Registers `fsync` and `fdatasync` system calls to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `rename` to syscall_shim
Constantin Raducanu [Sat, 2 May 2020 18:18:30 +0000 (21:18 +0300)]
lib/vfscore: Register `rename` to syscall_shim

Registers `rename` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `rmdir` to syscall_shim
Constantin Raducanu [Sat, 2 May 2020 18:18:29 +0000 (21:18 +0300)]
lib/vfscore: Register `rmdir` to syscall_shim

Registers `rmdir` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `mknod` to syscall_shim
Constantin Raducanu [Sat, 2 May 2020 18:18:28 +0000 (21:18 +0300)]
lib/vfscore: Register `mknod` to syscall_shim

Registers `mknod` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `utimes` to syscall_shim
Constantin Raducanu [Sat, 2 May 2020 18:18:27 +0000 (21:18 +0300)]
lib/vfscore: Register `utimes` to syscall_shim

Registers `utimes` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `pwritev` to syscall_shim
Constantin Raducanu [Sat, 2 May 2020 18:18:26 +0000 (21:18 +0300)]
lib/vfscore: Register `pwritev` to syscall_shim

Registers `pwritev` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `dup2` to syscall_shim
Constantin Raducanu [Tue, 28 Apr 2020 12:07:47 +0000 (15:07 +0300)]
lib/vfscore: Register `dup2` to syscall_shim

Registers `dup2` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `dup3` to syscall_shim
Constantin Raducanu [Tue, 28 Apr 2020 12:07:46 +0000 (15:07 +0300)]
lib/vfscore: Register `dup3` to syscall_shim

Registers `dup3` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `fchdir` to syscall_shim
Constantin Raducanu [Tue, 28 Apr 2020 12:07:44 +0000 (15:07 +0300)]
lib/vfscore: Register `fchdir` to syscall_shim

Registers `fchdir` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `link` to syscall_shim
Constantin Raducanu [Fri, 17 Apr 2020 19:41:14 +0000 (22:41 +0300)]
lib/vfscore: Register `link` to syscall_shim

Registers `link` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `fchmod` to syscall_shim
Constantin Raducanu [Tue, 28 Apr 2020 12:07:42 +0000 (15:07 +0300)]
lib/vfscore: Register `fchmod` to syscall_shim

Registers `fchmod` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `chmod` to syscall_shim
Constantin Raducanu [Tue, 28 Apr 2020 12:07:41 +0000 (15:07 +0300)]
lib/vfscore: Register `chmod` to syscall_shim

Registers `chmod` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `chdir` to syscall_shim
Constantin Raducanu [Tue, 28 Apr 2020 12:07:43 +0000 (15:07 +0300)]
lib/vfscore: Register `chdir` to syscall_shim

Registers `chdir` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `fallocate` to syscall_shim
Constantin Raducanu [Tue, 28 Apr 2020 12:07:40 +0000 (15:07 +0300)]
lib/vfscore: Register `fallocate` to syscall_shim

Registers `fallocate` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `faccessat` to syscall_shim
Constantin Raducanu [Tue, 28 Apr 2020 12:07:39 +0000 (15:07 +0300)]
lib/vfscore: Register `faccessat` to syscall_shim

Registers `faccessat` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `access` to syscall_shim
Constantin Raducanu [Tue, 28 Apr 2020 12:07:38 +0000 (15:07 +0300)]
lib/vfscore: Register `access` to syscall_shim

Registers `access` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `truncate` to syscall_shim
Constantin Raducanu [Fri, 17 Apr 2020 19:41:16 +0000 (22:41 +0300)]
lib/vfscore: Register `truncate` to syscall_shim

Registers `truncate` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `ftruncate` to syscall_shim
Constantin Raducanu [Fri, 17 Apr 2020 19:41:15 +0000 (22:41 +0300)]
lib/vfscore: Register `ftruncate` to syscall_shim

Registers `ftruncate` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `lseek` to syscall_shim
Constantin Raducanu [Fri, 17 Apr 2020 19:41:13 +0000 (22:41 +0300)]
lib/vfscore: Register `lseek` to syscall_shim

Registers `lseek` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/syscall_shim: Avoid warning about unused system call arguments
Simon Kuenzer [Thu, 3 Dec 2020 00:03:42 +0000 (01:03 +0100)]
lib/syscall_shim: Avoid warning about unused system call arguments

Some system call implementations may not use all arguments which causes
a compiler warning. This commit adds the `__maybe_unused` attribute to
the arguments when one of the following macros is used for a system call
implementation: `UK_SYSCALL_DEFINE()`, `UK_LLSYSCALL_DEFINE()`,
`UK_SYSCALL_R_DEFINE()`, and `UK_LLSYSCALL_R_DEFINE()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agolib/vfscore: Register `close` to syscall_shim
Constantin Raducanu [Fri, 17 Apr 2020 19:41:12 +0000 (22:41 +0300)]
lib/vfscore: Register `close` to syscall_shim

Registers `close` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
4 years agoplat/xen: Automatically enable blkfront, 9pfront
Simon Kuenzer [Thu, 22 Oct 2020 14:44:26 +0000 (16:44 +0200)]
plat/xen: Automatically enable blkfront, 9pfront

Automatically enables drivers in the configuration when according backend
libraries are enabled. This commit affects blkfront and 9pfront.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
4 years agolib/ukboot: Provide option to initialize TLSF
Simon Kuenzer [Mon, 19 Oct 2020 10:17:27 +0000 (12:17 +0200)]
lib/ukboot: Provide option to initialize TLSF

Provides the option to initialize TLSF as allocator. The option is only made
available when `LIBTLSF_INCLUDED` is set. This should be done by the TLSF
library as soon included to Unikraft. It is expected that this solution
intermediate until we are able to dynamically register configuration options to
core libraries.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
4 years agoplat/xen: x86: Maximum command line length from Xen headers
Simon Kuenzer [Thu, 1 Oct 2020 12:43:14 +0000 (14:43 +0200)]
plat/xen: x86: Maximum command line length from Xen headers

Instead of defining an own maximum size for the command line, in this
commit we use `MAX_GUEST_CMDLINE` from the Xen headers to defining the
maximum command line length.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
4 years agolib/ukdebug: uk_asmdumpk(), uk_asmdumpn(): Stop decoding on errors
Simon Kuenzer [Mon, 4 May 2020 09:56:20 +0000 (11:56 +0200)]
lib/ukdebug: uk_asmdumpk(), uk_asmdumpn(): Stop decoding on errors

Checks for errors that may occur during instruction decoding with
libzydis.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agolib/ukboot: ANSI-colored Unikraft banners
Simon Kuenzer [Mon, 14 Sep 2020 12:48:35 +0000 (14:48 +0200)]
lib/ukboot: ANSI-colored Unikraft banners

Provide two ANSI-colored versions (blue, gray) for each of the
"Powered by" banners.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agolib/ukboot: Additional Unikraft banners
Simon Kuenzer [Mon, 14 Sep 2020 12:47:56 +0000 (14:47 +0200)]
lib/ukboot: Additional Unikraft banners

Adds additional Unikraft banners to choose from. The "Powered by" banners are
intended to be the text-version of the official Unikraft project logo. The most
compatible variant (non-UTF8, non-extended ASCII) is set as the new default.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agolib/ukdebug: Option for colored output format
Simon Kuenzer [Mon, 14 Sep 2020 12:47:55 +0000 (14:47 +0200)]
lib/ukdebug: Option for colored output format

Colors! This commit makes use of ANSI control sequences to color console
output when activated by the user configuration.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agolib/ukdebug: Option to hide source code locations from messages
Simon Kuenzer [Mon, 14 Sep 2020 12:46:35 +0000 (14:46 +0200)]
lib/ukdebug: Option to hide source code locations from messages

Provides an option to hide the source code location of each ukdebug
message.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agoinclude: Provide ANSI control sequence helper
Simon Kuenzer [Mon, 14 Sep 2020 12:21:59 +0000 (14:21 +0200)]
include: Provide ANSI control sequence helper

Provide ANSI control sequence helper macros with <uk/plat/console.h>. Those
helpers and definitions can be used by console programs and ANSI console
drivers (e.g., VGA).

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agolib/posix-sysinfo: Fix limits.h header confusion
gaulthier gain [Thu, 5 Mar 2020 10:26:01 +0000 (10:26 +0000)]
lib/posix-sysinfo: Fix limits.h header confusion

Use specific 'limits.h' file rather than '<limits.h>' which
may come from another library before in header include list.

This patch is required to compile latest version of musl (see patch
series: Continue MUSL support).

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
4 years agoplat/linuxu: Use PIC in entry64.S
Razvan Deaconescu [Mon, 23 Mar 2020 15:08:09 +0000 (17:08 +0200)]
plat/linuxu: Use PIC in entry64.S

Use RIP-relative addressing for position independent code (PIC).

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
4 years agoplat/*: Use PIC in thread_start.S
Razvan Deaconescu [Mon, 23 Mar 2020 15:08:08 +0000 (17:08 +0200)]
plat/*: Use PIC in thread_start.S

Use RIP-relative addressing for position independent code (PIC).

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
4 years agolib/uknetdev: Introduce ioalign
Simon Kuenzer [Fri, 30 Oct 2020 13:41:33 +0000 (14:41 +0100)]
lib/uknetdev: Introduce ioalign

Similar to lib/ukblkdev, we introduce a device info parameter (`struct
uk_netdev_info`) to query alignment requirements of packet buffer areas
for a uknetdev device: `ioalign`.
At the same time the commit clarifies a confusion with the queue
information parameter `nb_align`. This parameter is intended to describe
requirements for sizing a rx/tx queue. The comment is updated and the
`virtio-net` driver is corrected. This fixes commit a52168588.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
4 years agolib/uknetdev: `uk_netbuf_alloc_buf()`: Introduce alignment
Simon Kuenzer [Fri, 30 Oct 2020 13:41:32 +0000 (14:41 +0100)]
lib/uknetdev: `uk_netbuf_alloc_buf()`: Introduce alignment

The API function `uk_netbuf_alloc_buf()` gets an alignment parameter which
can be used to request an aligned allocation for the packet buffer area
(`m->buf`).

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
4 years agolib/uknetdev: netbuf: Metadata at the end of an allocation
Simon Kuenzer [Fri, 30 Oct 2020 13:41:31 +0000 (14:41 +0100)]
lib/uknetdev: netbuf: Metadata at the end of an allocation

Place the netbuf metadata (`struct netbuf`) at the end of an allocation.
This enables forwarding possible alignments of an underlying allocation
to the buffer area of a netbuf. The metadata will no longer cause an offset
of the buffer start address (`m->buf`).

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
4 years agolib/uknetdev: netbuf: Store allocation base
Simon Kuenzer [Fri, 30 Oct 2020 13:41:30 +0000 (14:41 +0100)]
lib/uknetdev: netbuf: Store allocation base

In order to support flexible location of meta data (`struct uk_netbuf`) as
part of a corresponding allocation, we store the base address of it as
netbuf internal data. This address will be hand-over to the free operation
when such a netbuf is released.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>