Commit Graph

4994 Commits

Author SHA1 Message Date
Norman Feske
4da52517c1 Simpify startup of dynamically linked binaries
This patch removes the component_entry_point library, which used to
proved a hook for the libc to intercept the call of the
'Component::construct' function. The mechansim has several shortcomings
(see the discussion in the associated issue) and was complex. So we
eventually discarded the approach in favor of the explicit handling of
the startup.

A regular Genode component provides a 'Component::construct' function,
which is determined by the dynamic linker via a symbol lookup.
For the time being, the dynamic linker falls back to looking up a 'main'
function if no 'Component::construct' function could be found.

The libc provides an implementation of 'Component::construct', which
sets up the libc's task handling and finally call the function
'Libc::Component::construct' from the context of the appllication task.
This function is expected to be provided by the libc-using application.
Consequently, Genode components that use the libc have to implement the
'Libc::Component::construct' function.

The new 'posix' library provides an implementation of
'Libc::Component::construct' that calls a main function. Hence, POSIX
programs that merely use the POSIX API merely have to add 'posix' to the
'LIBS' declaration in their 'target.mk' file. Their execution starts at
'main'.

Issue #2199
2017-01-13 13:06:52 +01:00
Martin Stein
8d521036fb IPv4: fix buggy ascii_to implementations
Ref #2193
2017-01-13 13:05:47 +01:00
Martin Stein
045a30865a NIC router: read Strings also with attribute_value
Ref #2193
2017-01-13 13:05:46 +01:00
Martin Stein
83040d7d86 OpenSSL x86_64: enable NIST 64-bit optimization
On a 64-bit system, enabling the OpenSSL NIST 64-bit optimization should
result in considerable speed improvements when using curves: NIST-P224,
NIST-P256, and NIST-P521. Additionally it avoids that Tor complains
about having an OpenSSL that lacks this feature.

Ref #2193
2017-01-13 13:05:46 +01:00
Martin Stein
cd708b24db IPv4: treat 0.0.0.0/0 as valid IPv4 prefix
0.0.0.0/x is now only seen as invalid if x > 0.

Ref #2193
2017-01-13 13:05:46 +01:00
Alexander Boettcher
604a8860de nova: avoid assertion during cross-cpu IPC
Fixes #2198
2017-01-13 13:05:46 +01:00
Alexander Boettcher
e3ca4de4d8 os: add testcase for bomb/init on several CPUs
Test case to trigger assertion as reported in #2198.
2017-01-13 13:05:45 +01:00
Sebastian Sumpf
6e14aa4364 ldso: mark functions used during self relocation
These functions are marked as always inline through the 'SELF_RELOC' macro. This
became necessary because on riscv functions calls are performed through the
global offset table, which is not initialized at this point.

Fixes #2203
2017-01-13 13:05:45 +01:00
Christian Helmuth
f2568856dd Hide implementation details in timeout framework
Fixes #2205
2017-01-13 13:05:45 +01:00
Norman Feske
a2a51985f2 tool: add -k (kernel) argument to autopilot
This commit adds support for testing multiple kernels within the same
build directory. In addition to the existing -p arguments, the new
version expects one or more -k arguments that denote the kernels to be
used for executing the specified run scripts.

Consequently, the autopilot executes the 3-dimensional matrix of
platforms x kernels x run scripts, e.g.,

  autopilot --force -p x86_32 -k nova -k okl4 -k sel4 -k linux -r log

Issue #2190
2017-01-13 13:05:44 +01:00
Norman Feske
253097314c Add unified build directories to create_builddir
This patch makes the benefit of the recently introduced unified Genode
ABI available to developers by enabling the use of multiple kernels from
within a single build directory. The create_builddir tool has gained a
new set of kernel-agnostic platform arguments such as x86_32, or panda.
Most build targets within directories are in principle compatible with
all kernels that support the selected hardware platform. To execute a
scenario via the run tool, one has to select the kernel to use by
setting the 'KERNEL' argument in the build configuration
(etc/build.conf). Alternatively, the 'KERNEL' can be specified as
command-line argument of the Genode build system, e.g.:

  make run/log KERNEL=nova

This allows us to easily switch from one kernel to another without
rebuilding any Genode component except for the very few kernel-specific
ones.

The new version of the 'create_builddir' tool is still compatible with
the old version. The old kernel-specific build directories can still be
created. However, those variants will eventually be removed.

Note that the commit removes the 'ports-foc' repository from the
generated 'build.conf' files. As this is only meaningful for 'foc',
I did not want to include it in the list of regular repositories (as
visible in a 'x86_32' build directory). Hence, the repository must
now be manually added in order to use L4Linux.

Issue #2190
2017-01-13 13:05:44 +01:00
Norman Feske
9ea4a491d6 ld: generate symbol map from base/lib/symbols/ld
This patch removes the manually maintained symbol map from the dynamic
linker. This way, the symbol map stays in sync with the ABI and - more
importantly - no longer uses wildcards. So the symbols exported by the
dynamic linker are strictly limited by the ABI.

Issue #2190
2016-12-23 16:53:17 +01:00
Christian Prochaska
5c186cdc1d qt5: fix download link
Fixes #2202
2016-12-23 16:52:10 +01:00
Martin Stein
346ce9ae0b nic_router.run: consider usb_drv and gpio_drv
Ref #2193
2016-12-23 16:52:10 +01:00
Martin Stein
591ed80dcf NIC router: hand-over XML nodes by value
Ref #2193
2016-12-23 16:52:10 +01:00
Martin Stein
eef18e1ecd net: introduce and apply Net::Port type
Thereby fix bug in the NIC router that previously used uint8_t values for ports in
some places.

Ref #2193
2016-12-23 16:52:10 +01:00
Martin Stein
27cc0a402a NIC router: descriptive error on missing interface
Previously, if a packet should be routed to a domain that had no interface
connected, the NIC router only printed "Unroutable packet". Technically,
this was wrong as an unavailable interface doesn't mean that the routing
failed. Now it gives an error "no interface connected to domain".

Ref #2193
2016-12-23 16:52:10 +01:00
Martin Stein
524f330218 nic_router.run: do not require FOC
Because the LWIP HTTP client doesn't require FOC anymore.

Ref #2193
2016-12-23 16:52:10 +01:00
Martin Stein
28153ad8ef LWIP HTTP client: do not require FOC
We don't know why this component requires FOC anymore and it seems to be fine with other
platforms at well.

Ref #2193
2016-12-23 16:52:09 +01:00
Sebastian Sumpf
ff0f1ebafc os: adapt pci test to component API
* also add pci.run

Fixes #2201
2016-12-23 16:52:09 +01:00
Alexander Boettcher
be5ae4dffa mention PIT in x86 platform_driver README
Issue #1578
2016-12-23 16:52:09 +01:00
Christian Prochaska
31e0ee2c88 gdb_monitor: increase RAM quota in run scripts
Fixes #2186
2016-12-23 16:52:09 +01:00
Alexander Boettcher
3e0aeab89e intel_fb: avoid heap warning
Fixes #2168
2016-12-23 16:52:09 +01:00
Norman Feske
1e41c2dbe9 Remove redundant boot modules from boot image
Fixes #2185
2016-12-23 16:52:09 +01:00
Christian Prochaska
f89b63ef87 qt5: qt5_drivers.inc fixes
- make start of the 'nic_drv' component depend on driver specs
- make start of the 'input_merger' component depend on the 'Input' feature

Fixes #2174
2016-12-23 16:52:09 +01:00
Christian Prochaska
2c3009b2ed qt5_avplay: show the main window earlier
The main window must be visible before avplay or a framebuffer filter
requests the framebuffer session which goes to Nitpicker, because the
parent view of the new Nitpicker view is part of the
QNitpickerPlatformWindow object, which is created when the main window
becomes visible. If this object does not exist yet, a page fault occurs.

Fixes #2187
2016-12-23 16:52:08 +01:00
Christian Prochaska
0d9e566b18 wm: fix possible deadlock
Fixes #2183
2016-12-23 16:52:08 +01:00
Emery Hemingway
088bf52be1 drivers/framebuffer/sdl: emulate a 60Hz sampling rate
Set timer signaling only if a valid signal context is registered.

Ref #2192
2016-12-23 16:52:08 +01:00
Emery Hemingway
98cb37b9e4 drivers/timer: do not submit signals for invalid contexts
Setting a timer signal handler with an invalid capability cancels
signaling and any periodic timeout.

Fix #2192
2016-12-23 16:52:08 +01:00
Norman Feske
0d295f75a1 base: apply routing policy to environment sessions
This patch changes the child-construction procedure to allow the routing
of environment sessions to arbitrary servers, not only to the parent.
In particular, it restores the ability to route the LOG session of the
child to a LOG service provided by a child of init. In principle, it
becomes possible to also route the immediate child's PD, CPU, and RAM
environment sessions in arbitrary ways, which simplifies scenarios that
intercept those sessions, e.g., the CPU sampler.

Note that the latter ability should be used with great caution because
init needs to interact with these sessions to create/destruct the child.
Normally, the sessions are provided by the parent. So init is safe at
all times. If they are routed to a child however, init will naturally
become dependent on this particular child. For the LOG session, this is
actually not a problem because even though the parent creates the LOG
session as part of the child's environment, it never interacts with the
session directly.

Fixes #2197
2016-12-23 16:52:08 +01:00
Norman Feske
c450ddcb3d Disambiguate kernel-specific file names
This patch removes possible ambiguities with respect to the naming of
kernel-dependent binaries and libraries. It also removes the use of
kernel-specific global side effects from the build system. The reach of
kernel-specific peculiarities has thereby become limited to the actual
users of the respective 'syscall-<kernel>' libraries.

Kernel-specific build artifacts are no longer generated at magic places
within the build directory (like okl4's includes, or the L4 build
directories of L4/Fiasco and Fiasco.OC, or the build directories of
various kernels). Instead, such artifacts have been largely moved to the
libcache. E.g., the former '<build-dir>/l4/' build directory for the L4
build system resides at '<build-dir>/var/libcache/syscall-foc/build/'.
This way, the location is unique to the kernel. Note that various tools
are still generated somewhat arbitrarily under '<build-dir>/tool/' as
there is no proper formalism for building host tools yet.

As the result of this work, it has become possible to use a joint Genode
build directory that is usable with all kernels of a given hardware
platform. E.g., on x86_32, one can now seamlessly switch between linux,
nova, sel4, okl4, fiasco, foc, and pistachio without rebuilding any
components except for core, the kernel, the dynamic linker, and the timer
driver. At the current stage, such a build directory must still be
created manually. A change of the 'create_builddir' tool will follow to
make this feature easily available.

This patch also simplifies various 'run/boot_dir' plugins by removing
the option for an externally hosted kernel. This option remained unused
for many years now.

Issue #2190
2016-12-23 16:51:32 +01:00
Norman Feske
3865ee7ccc foc: move base/thread_state.h to include/foc/
The header is foc-specific. It used to shadow the generic one provided
by the base repository, which contradicts with the kernel-agnostic
Genode API. Hence, it had to be moved to a foc-specific location.
2016-12-23 16:51:12 +01:00
Norman Feske
44df8db771 Disambiguate names of timer drivers
Issue #2190
2016-12-23 16:50:33 +01:00
Norman Feske
f54c85e045 Genode application binary interface (ABI)
This patch decouples the kernel-specific implementation of the dynamic
linker from its kernel-agnostic binary interface. The name of the
kernel-specific dynamic linker binary now corresponds to the kernel,
e.g., 'ld-linux.lib.so' or 'ld-nova.lib.so'. Applications are no longer
linked directly against a concrete instance of the dynamic linker but
against a shallow stub called 'ld.lib.so'. This stub contains nothing
but the symbols provided by the dynamic linker. It thereby represents
the Genode ABI.

At system-integration time, the kernel-specific run/boot_dir back ends
integrate the matching the kernel-specific variant of the dynamic linker
as 'ld.lib.so' into the boot image.

The ABI symbol file for the dynamic linker is located at
'base/lib/symbols/ld'. It contains the joint ABI of all supported
architectures. The new utility 'tool/abi_symbols' eases the creation of
such an ABI symbol file for a given shared library. Its result should be
manually inspected and edited as needed.

The patch removes the 'syscall' library from 'base_libs.mk' to avoid
polluting the kernel-agnostic ABI with kernel-specific interfaces.

Issue #2190
Issue #2195
2016-12-23 16:50:28 +01:00
Alexander Boettcher
9b397b0321 vbox: adjust vbox_pointer policy to be working
vbox_pointer parses for 'label' and has no understanding of 'label_prefix'
2016-12-14 11:22:30 +01:00
Alexander Boettcher
e4a1904456 core: fix deadlock in region_map destruction
Introduced by:

commit 99fbb23ec5
Author: Alexander Boettcher <alexander.boettcher@genode-labs.com>
Date:   Fri Sep 9 17:49:34 2016 +0200

    core: use weak_ptr for Rm_faulter and Region_map

    Issue #2086
2016-12-14 11:22:30 +01:00
Alexander Boettcher
d8f2610e9c bomb: drop sleep_forever and signal_receiver 2016-12-14 11:22:29 +01:00
Alexander Boettcher
f613cd2aa9 nova: remove native_cpu interface
Issue #2173
2016-12-14 11:22:29 +01:00
Alexander Boettcher
e93ef168a1 nova: use async. map for thread/pd bootstrap
Fixes #2173
2016-12-14 11:22:29 +01:00
Christian Prochaska
5a72738def qoost: call 'select_from_ports' in qoost.mk
'select_from_ports' must be called to detect a missing port.

Fixes #2189
2016-12-14 11:22:28 +01:00
Norman Feske
dda054aa27 os: fix null termination in fb connection 2016-12-14 11:22:28 +01:00
Norman Feske
4475ac10d6 noux: reduce stack usage
By not placing the sysio buffer (16 KiB) on the stack, we can call
'noux_syscall' from the initial thread. This is needed to issue fork
from the suspend callback, which is executed by the initial thread.
2016-12-14 11:22:28 +01:00
Alexander Boettcher
10ba9c8f20 nova: fix kernel assertion during revoke
Fixes #2191
2016-12-14 11:22:28 +01:00
Josef Söntgen
400198013b alarm: limit sleep timeout to 60s
Instead of using an unreasonable value for the sleep time, limit it to
60s.

Fixes #2188.
2016-12-14 11:22:27 +01:00
Martin Stein
71d30297ff hw: clean up scheduling-readiness syscalls
This cleans up the syscalls that are mainly used to control the
scheduling readiness of a thread. The different use cases and
requirements were somehow mixed together in the previous interface. The
new syscall set is:

1) pause_thread and resume_thread

They don't affect the state of the thread (IPC, signalling, etc.) but
merely decide wether the thread is allowed for scheduling or not, the
so-called pause state. The pause state is orthogonal to the thread state
and masks it when it comes to scheduling. In contrast to the stopped
state, which is described in "stop_thread and restart_thread", the
thread state and the UTCB content of a thread may change while in the
paused state. However, the register state of a thread doesn't change
while paused. The "pause" and "resume" syscalls are both core-restricted
and may target any thread. They are used as back end for the CPU session
calls "pause" and "resume". The "pause/resume" feature is made for
applications like the GDB monitor that transparently want to stop and
continue the execution of a thread no matter what state the thread is
in.

2) stop_thread and restart_thread

The stop syscall can only be used on a thread in the non-blocking
("active") thread state. The thread then switches to the "stopped"
thread state in wich it explicitely waits for a restart. The restart
syscall can only be used on a thread in the "stopped" or the "active"
thread state. The thread then switches back to the "active" thread state
and the syscall returns whether the thread was stopped. Both syscalls
are not core-restricted. "Stop" always targets the calling thread while
"restart" may target any thread in the same PD as the caller. Thread
state and UTCB content of a thread don't change while in the stopped
state. The "stop/restart" feature is used when an active thread wants to
wait for an event that is not known to the kernel. Actually the syscalls
are used when waiting for locks and on thread exit.

3) cancel_thread_blocking

Does cleanly cancel a cancelable blocking thread state (IPC, signalling,
stopped). The thread whose blocking was cancelled goes back to the
"active" thread state. It may receive a syscall return value that
reflects the cancellation. This syscall doesn't affect the pause state
of the thread which means that it may still not get scheduled. The
syscall is core-restricted and may target any thread.

4) yield_thread

Does its best that a thread is scheduled as few as possible in the
current scheduling super-period without touching the thread or pause
state. In the next superperiod, however, the thread is scheduled
"normal" again. The syscall is not core-restricted and always targets
the caller.

Fixes #2104
2016-12-14 11:22:27 +01:00
Norman Feske
ccffbb0dfc Build dynamically linked executables by default
Fixes #2184
2016-12-14 11:22:27 +01:00
Norman Feske
d882277ce3 base: let ldso use the default stack size 2016-12-14 11:19:38 +01:00
Norman Feske
4e4cdacab3 base: trim main-thread size to 4/8 KiB
The main thread does no longer execute application code. It is solely
responsible for the initialization of the component's entrypoint and for
retrieving asynchronous notifications. Since the stack usage is no
longer dependent on application-specific code, we can significantly
shrink it to reduce the memory footprint of components. In the worst
case - should the stack overrun - we would observe a page fault because
the stack is placed in the stack area, surrounded by guard pages.
2016-12-14 11:19:38 +01:00
Norman Feske
cc98cef770 genode_rel.ld: add .gcc_except_table to RO segment
By moving .gcc_except_table section to the read-only ELF segment, this
patch reduces the size of the dynamically allocated data/bss segment.
2016-12-14 11:19:37 +01:00
Norman Feske
a387d68c2c base: use a default stack size of 64 KiB
This patch replaces the former machine-word-dependent default stack size
by the fixed value of 64 KiB which should suffice for components on both
32 and 64 bit. Previously, the default stack size on 64 bit was 128 KiB,
which is wasteful. If a component needs more stack than 64 KiB, it can
specify a custon stack size by implementing 'Component::stack_size'.
2016-12-14 11:19:37 +01:00