Compare commits

...

237 Commits

Author SHA1 Message Date
Christian Helmuth
c0150f97e5 version: 21.05 2021-05-31 13:24:05 +02:00
Norman Feske
5dc7d55cc0 News item for version 21.05 2021-05-31 13:24:04 +02:00
Norman Feske
fd2f137a9b Release notes for version 21.05 2021-05-31 12:41:38 +02:00
Christian Helmuth
1d52bd017d depot: update recipe hashes 2021-05-28 14:16:46 +02:00
Josef Söntgen
e06f3bba27 drivers_managed-imx8q_evk: fix hdmi device node
By now the 'compatible' name is set via the 'type' attribute.

Fixes #4181.
2021-05-28 14:16:46 +02:00
Stefan Kalkowski
1d12755401 depot: add i2c api package
Fixes #4180
2021-05-28 14:16:46 +02:00
Stefan Kalkowski
f2ac341003 depot: add architectural content to os api package
Fixes #4179
2021-05-28 14:16:45 +02:00
Christian Prochaska
f2ff1a6d52 dde_linux: save and restore ARM FPU state in setjmp.S
Fixes #4161
2021-05-28 14:16:45 +02:00
Johannes Schlatow
4383579db6 window_layouter: improve focus history
If no window has ever been focused, next() always returns an invalid
window id. As a consequence, there is no way to cycle through the focus
history without an explicit focus event (e.g. mouse hover).

Instead, next() should return the first window from the focus history if the
currently focused window is not present.

Fixes genodelabs/genode#4164
2021-05-28 14:16:45 +02:00
Christian Helmuth
f0b9549376 wifi_drv: optionally report MAC address
Issue #4133
2021-05-28 14:16:45 +02:00
Christian Helmuth
aab6f52325 wifi_drv: remove nic_server mode
Issue #4133
2021-05-28 14:16:45 +02:00
Christian Helmuth
6e85a73a28 ipxe_nic_drv: optionally report MAC address
Issue #4133
2021-05-28 14:16:45 +02:00
Christian Helmuth
4abc530974 ipxe_nic_drv: remove nic_server mode
Issue #4133
2021-05-28 14:16:45 +02:00
Christian Helmuth
583ba0e9db ipxe_nic_drv: eliminate static constructors
Issue #4133
2021-05-28 14:16:45 +02:00
Christian Helmuth
62f83b7198 linux_nic_drv: optionally report MAC address
Issue #4133
2021-05-28 14:16:45 +02:00
Christian Helmuth
464f0eaf8b linux_nic_drv: remove nic_server mode
Issue #4133
2021-05-28 14:16:45 +02:00
Josef Söntgen
0f72a342f3 wifi_drv: fix setting 'bssid' in config
The wpa_supplicant refuses to set the BSSID in case it is quoted.
Removing the quotes allows for specifying the BSSID in the
configuration.

Fixes #4175.
2021-05-28 14:16:45 +02:00
Alexander Boettcher
3dff399fba netperf_*_usb: fix cap quota for sel4+hw x86
Fixes #4016
2021-05-28 14:16:45 +02:00
Alexander Boettcher
0aa99648d7 run: use usb/hid driver in VM tests
Issue #4173
2021-05-28 14:16:45 +02:00
Alexander Boettcher
6b9fcc9449 drivers_interactive-rpi: use usb host/hid driver
Issue #4173
2021-05-28 14:16:45 +02:00
Alexander Boettcher
f9c7947c45 drivers_interactive-pc: use usb host/hid driver
Issue #4173
2021-05-28 14:16:45 +02:00
Stefan Kalkowski
28189ba77a tool: simplify initcall order extraction
The new tool `extract_initcall_order` generates a header file out of a
Linux kernel build, which provides a sorted array with the initcall function
names of the kernel build. The order states the order in which the initcall
have to be called. It gets extrated out of the Linux kernel System.map.

Fixes #4172
2021-05-28 14:16:45 +02:00
Alexander Boettcher
fc5903c917 themed_decorator: upgrade cap and memory on demand
Issue #4150
2021-05-28 14:16:45 +02:00
Stefan Kalkowski
7f6f710bd2 imx8mq_platform_drv: introduce reset domains
A reset domain can consist of one or several reset-pins
denoted by name that are assigned to a device.
When the device gets acquired via the Platform RPC API,
the pins are de-asserted, and asserted again when the
device gets released.

A configuration looks like the following:

  <device name="mipi_dsi>
    <reset-domain name="mipi_dsi_pclk"/>
    ...
  </device>

Fixes #4171
2021-05-28 14:16:45 +02:00
Stefan Kalkowski
ed7d6c74f4 i2c: extend API to support transactions
Introduces the notion of a transaction that consists of one or more
messages. Whereby a message has a read or write direction and consists
of one or more bytes.

Issue #4170
Fixes #4169
2021-05-28 14:16:45 +02:00
Stefan Kalkowski
9f099bd61c base-hw: use generalized util/array.h
Issue #4170
2021-05-28 14:16:45 +02:00
Stefan Kalkowski
6780cf0790 base: introduce array utility
Fixes #4170
2021-05-28 14:16:45 +02:00
Christian Prochaska
7b197d54ed tool chain: update gdb to version 10.2
Issue #4094
2021-05-28 14:16:44 +02:00
Alexander Boettcher
933de21339 base: add platform_info to microkernel platforms
Add to older platforms also the info ROM to avoid confusion/red messages.

Issue #4016
2021-05-28 14:16:44 +02:00
Alexander Boettcher
509e5aa776 platform(x86): report features via platform_info
Report via platform_info the capabilities of the kernel, e.g. ACPI and MSI.

With the commit the try-catch pattern on IRQ session creation by the platform
driver is avoided.

Issue #4016
2021-05-28 14:16:44 +02:00
Christian Prochaska
e1abd2db4e base-linux: update arm32 seccomp policy
Issue #4136
Issue #3466
2021-05-28 14:16:44 +02:00
Christian Helmuth
faf491ce92 smartcard: replace usb_drv by usb_host_drv 2021-05-28 14:16:44 +02:00
Alexander Boettcher
98f524bb41 qemu-usb/webcam: signal capturing off earlier
based on comment in Linux sources. Reduce fallback off-capturing detection
to 1s.

Issue #4078
2021-05-28 14:16:44 +02:00
Sebastian Sumpf
7fcf9053b9 usb_hid: perform device destruction on unplug signal only
- Do not perform desctruction on report updatea in EP because
  'unregister_device' may block on Led state 'update' (synchronous
  control message) leading to the driver being stuck because no more
  signals are received
- Check if device is present in 'submit_urb' calls

fixes #4166
2021-05-28 14:16:44 +02:00
Sebastian Sumpf
6910b880e7 usb_host: make device creation/destruction robust
- Signal device ready depending on state (ready or not) immediately or
  when "actconfig" is set
- Report new devices when ready
- Drain packet stream in case there is no device present (needed for
  synchronous operations at client side)
- Do not use 'session_device' on device destruction, check pointer
  directly instead

issue #4149
2021-05-28 14:16:44 +02:00
Alexander Boettcher
708b7f4619 cpu_balancer.run: adjust quota for seL4 2021-05-28 14:15:28 +02:00
Alexander Boettcher
921a99bb9b tool/run: option to copy tftp served files (x86)
Fixes #4153
2021-05-28 14:15:28 +02:00
Norman Feske
a13dee8d19 tool/dts: for extracting content from dts files
The new tool eases the inspection and pruning of device-tree source
files.

Fixes #4165
2021-05-28 14:15:28 +02:00
Martin Stein
0069660958 rump: fix compiler warning
Fixes two warnings of this type:

! src/lib/vfs/rump/vfs_rump.cc:214:52: warning: narrowing conversion of
! ‘(s.stat::st_mode & 64)’ from ‘__mode_t’ {aka ‘unsigned int’} to ‘bool’
! [-Wnarrowing]
!
!  214 |                           .executable = (s.st_mode & S_IXUSR) };
!      |                                         ~~~~~~~~~~~^~~~~~~~~~

Fixes #4160
2021-05-28 14:15:28 +02:00
Johannes Schlatow
7b09675236 depot: add less recipe
genodelabs/genode#4162
2021-05-28 14:15:28 +02:00
Johannes Schlatow
4bed825956 depot: add diffutils recipe
genodelabs/genode#4162
2021-05-28 14:15:28 +02:00
Sebastian Sumpf
5135ff2dc2 usb_webcam: An app using libuvc for USB webcams
issue #4158
2021-05-28 14:15:28 +02:00
Sebastian Sumpf
4a56171a77 libports: port of libuvc
by Josef Soentgen

issue #4158
2021-05-28 14:15:28 +02:00
Sebastian Sumpf
ae5b4c9624 libusb: Make USB library more robust
- Add reference count for open/close
- Add cancel transfer support
- Handle packet stream correctly

issue #4158
2021-05-28 14:15:28 +02:00
Josef Söntgen
46c846ef91 libports: add iso handling to libusb
issue #4158
2021-05-28 14:15:28 +02:00
Sebastian Sumpf
c8c589d91a libyuv: enable MJPEG support
issue #4158
2021-05-28 14:15:28 +02:00
Josef Söntgen
5254930930 libports: update jpeg library to v9d
issue #4158
2021-05-28 14:15:28 +02:00
Martin Stein
70797fe879 fs_tool: add <new-file> operation
Adds the <new-file> operation to the fs_tool. When configured, the
<new-file path="...">...</new-file> tag will cause creation or overwriting of
the file given through the 'path' attribute. The file will contain the text
content of the tag.

Ref #4032
2021-05-28 14:15:28 +02:00
Norman Feske
100583e262 os/vfs.h: New_file utility
This patch moves the utility from the app/text_area to os/vfs.h to make
it easier to use by other components. By hosting the 'New_file' as a
friend alongside the 'Directory', we can now pass a 'Directory' as
constructor argument, which is consistent with other utilities such as
'File_content'.

As a further improvement, the new version supports the implicit creation
of the directory hierarchy leading to the new file.

Issue #4032
2021-05-28 14:15:27 +02:00
Norman Feske
57fbd2b658 os/vfs.h: Directory::create_sub_directory
This method can be used to create a directory hierarchy within a
'Directory'.

Issue #4032
2021-05-28 14:15:27 +02:00
Alexander Boettcher
9549eeeca4 ssh_terminal: avoid deadlock during bind callback
Issue #4095
2021-05-28 14:15:27 +02:00
Christian Helmuth
9166a75f2c foc: map uncached normal memory bufferable
Mapping normal memory bufferable restores support for unaligned reads on
DMA memory and prevents the following errors on imx6q_sabrelite.

  KERNEL0: alignment error at 18003061 (PC: 0102e3f8, SP: 401ffb18, FSR: 90000001, PSR: 20000110)

Issue #4094
Issue #4157
2021-05-28 14:15:27 +02:00
Martin Stein
dd587c6712 fs_query: support querying file sizes
By adding an attribute 'size="yes"' to a query, one instructs fs_query to
report also the size of each queried file as attribute 'size' of the
corresponding 'file' node.

Ref #4032
2021-05-28 14:15:27 +02:00
Martin Stein
3ed26e7bb2 fs_query: watch only readable files
The fs_query component used to try watching all files it found resulting in
errors on files that are not watchable. For some files, however, the watch-
feature doesn't make sense as they are not readable (no content, no size).
Now, fs_query will check first whether a file is readable and skip watching
if it isn't.

Ref #4032
2021-05-28 14:15:27 +02:00
Martin Stein
6e900f147c fs_query: read content only from readable files
When configuring fs_query to print the content of files it used to try so for
all files it found resulting in errors on files that are not readable. Now,
fs_query will check first whether a file is readable and skip printing the
content of those that are not.

Ref #4032
2021-05-28 14:15:27 +02:00
Tomasz Gajewski
0507d3f44b ssh_terminal: fixed managing ssh file descriptors
Managing ssh event file descriptors was performed from two different
threads which could cause reallocation of structure used in other thread
in a call to 'poll' function.

Splitted initialization to parts and moved ssh event part into ssh loop.

Issue #4095
2021-05-28 14:15:27 +02:00
Tomasz Gajewski
0b641ba581 ssh_terminal: fixed race condition during startup
Moved creating ssh loop thread after initialization of wake up server
file descriptors to make sure that they will be properly handled even in
first loop run.

Issue #4095
2021-05-28 14:15:27 +02:00
Martin Stein
b3a229eebb vfs_block: write less to the log
Remove calls to the Genode log functions that were done unconditionally or
according to a static verbosity flag.

Ref #4032
2021-05-28 14:15:27 +02:00
Martin Stein
fd0a4e78c8 rump: write less to the log
Remove calls to the Genode log functions that were done unconditionally or
according to a static verbosity flag.

Ref #4032
2021-05-28 14:15:27 +02:00
Stefan Kalkowski
74d826d1ad tool: simplify Linux dummy function generation
The new tool `create_dummies` easily lists missing references,
while porting subsystems of the Linux kernel to Genode, e.g., device drivers.
Moreover it can automatically generate dummy implementations for functions
and global variables.

Fixes #4156
2021-05-28 14:15:27 +02:00
Alexander Boettcher
b6b9801c20 seoul: fix ahci model busy bit handling
A warning, discovered during GCC 10.3 update, got fixed wrongly.

Issue #4097
2021-05-28 14:15:27 +02:00
Stefan Kalkowski
b22d9385f1 imx8mq_platform_drv: enable root clock div setting
Fixes #4155
2021-05-28 14:15:27 +02:00
Stefan Kalkowski
516601b7ba os: add Platform::Device::sigh_omit_initial_signal
Add possibility to register an interrupt handler without triggering
an initial spurious interrupt for ported device driver code.

Fixes #4154
2021-05-28 14:15:27 +02:00
Alexander Boettcher
67a8f29697 rump_ext2.run: increase cap quota for sel4 2021-05-28 14:15:27 +02:00
Josef Söntgen
3e284558a1 drm: account for guard page
This makes the rendering issue with mesa gears disappear.

Issue #4148
2021-05-28 14:15:27 +02:00
Alexander Boettcher
04d8e03ecb mesa: use 32bit RGB in egl platform lib
Fixes distortion in mesa gears i965

Issue #4148
2021-05-28 14:15:27 +02:00
Alexander Boettcher
cfe29b0e52 libc_integration.run: specify random source
After update of stdcxx, either hardware (CPU) random sources are taken
or, if not available/insufficient, /dev/urandom is used.

Issue #3967
Issue #4094
2021-05-28 14:15:27 +02:00
Alexander Boettcher
d4b9be8d44 stdcxx: support /dev/urandom
when cpu does not provide sufficient hardware support. (happens on our
nightly test machine as also build machine).

Issue #4094
2021-05-28 14:15:27 +02:00
Johannes Schlatow
db97af8dec vfs: fix read of large files in fs_file_systems
For fs_file_systems, reads are limited to the size of the packets from the
File_system session. Hence, we cannot read the large files in one go.

This fix is particularly helpful for fonts_fs, as it enables including font
files from a File_system.

genodelabs/genode#4135
2021-05-28 14:15:27 +02:00
Johannes Schlatow
4daf19ec7e vfs_ttf: update glyphs when font file changes
genodelabs/genode#4135
2021-05-28 14:15:27 +02:00
Christian Prochaska
18a43c1afd base-foc: fix assignment in 'Ipc_pager::acknowledge_exception()'
Issue #4094
2021-05-28 14:15:26 +02:00
Christian Helmuth
813f4d976b lxip: allocate skb with properly aligned IP header
Comment in Linux sources:

  Since an ethernet header is 14 bytes network drivers often end up with
  the IP header at an unaligned offset. The IP header can be aligned by
  shifting the start of the packet by 2 bytes. Drivers should do this
  with:

  skb_reserve(skb, NET_IP_ALIGN);

This is ensured when using netdev_alloc_skb_ip_align().

Issue #4094
2021-05-28 14:15:26 +02:00
Sebastian Sumpf
a24224ffc3 usb_host: improve isochronous performance on Intel
This patch takes advantage of block transfer interrupts on Intel XHCI
controllers which is used during isochronous transfers. Because of a bug
in hardware (see usb_host_isoc_bei.patch header), this feature has been
disabled for Intel leading to up to 8000 interrupts/s for isochronous
transfer causing severe CPU consumption on Genode. With this commit we
lower host driver consumption to normal levels.

issue #4149
2021-05-28 14:15:26 +02:00
Sebastian Sumpf
9543161827 usb_host: Move task to device in USB session
A Lx::Task is now associated to a USB device not the session any more.
This implies that a task lives as long as the device making it possible
to gracefully handle outstanding requests (i.e., synchronous) in case
the session has been closed.

issue #4149
2021-05-28 14:15:26 +02:00
Martin Stein
a0517686ca ports/libsparkcrypto: update for GCC 10
The old port version contained '*.ali' files that were build with an older GCC
which led to problems when compiling packages that use the port with the new
GCC 10. The '*.ali' files of the new port version were generated with GCC 10.

Fixes #4145
2021-05-28 14:15:26 +02:00
Sebastian Sumpf
9209dfc9d5 ldso: output loaded objects of 'Shared_object' interface
When loading shared libraries via the 'Shared_object' interface display
all additionaly loaded libraries in case 'ld_verbose' is configured. Up
until now, only the loaded library was displayed. In order to determine
if a dependend library had arlready been loaded prior to loading the
'Shared_object' the reference counter is used.

fixes #4147
2021-05-28 14:15:26 +02:00
Alexander Boettcher
f8d0552d52 libc_integration: fix out-of-bound access
which leads to sporadic pagefaults/segmentation faults.

Fixes #3967
2021-05-28 14:15:26 +02:00
Martin Stein
139a2cfae9 tool: use local LC_ALL=C instead of LC_COLLATE=C
We used to export 'LC_COLLATE=C' for the environment of Genode tools. This was
meant to ensure that sorting is always done C-style and not dependent on the
users locale settings. This is required, for instance, to ensure that the same
archive always yields the same hash.

However, 'export LC_COLLATE=C' is not sufficient. It can be outruled by an
'LC_ALL' setting in the users environment. The manual of 'sort' recommends to
set 'LC_ALL=C' locally if you want reliable results and this is what this
commit does. Furthermore it removes the former 'export LC_COLLATE=C'
directives.

Note that I couldn't find a way to set 'LC_ALL' local to 'exec ... sort' in
TCL. This is why I set it global instead using TCLs 'env' array.

Note that the Make directive '$(sort ...)' and the TCL directive 'lsort',
unlike the Shell directive 'sort', are not affected by the users locale
settings.

Fixes #4144
2021-05-28 14:15:26 +02:00
Alexander Boettcher
1c20ed12c1 qemu: sanity check misconfigured memory for okl4
Issue #4095
2021-05-28 14:15:26 +02:00
Alexander Boettcher
d516544a1f ssh_exec_channel.run: use default Qemu memory size
The default size is on most kernels 512M. On OKL4 we have to use 800M,
because of the statically configured memory ranges in the OKL4 kernel.

By avoiding a specific amount of memory, the default Qemu memory sizes are
used.

Issue #4095
2021-05-28 14:15:26 +02:00
Martin Stein
f8b2fd522b ports/ada-runtime: update to support gcc 10
Fixes #4128
2021-05-28 14:15:26 +02:00
Christian Prochaska
471d34a367 Remove mpc and mpfr ports
These ports are not needed anymore with the 21.05 tool chain update.

Issue #4094
2021-05-28 14:15:26 +02:00
Christian Prochaska
d5e4ffd191 sanitizer: update to version 10.3.0
Issue #4094
2021-05-28 14:15:26 +02:00
Christian Prochaska
4a4b754bf2 gcov: update to version 10.3.0
Issue #4094
2021-05-28 14:15:26 +02:00
Christian Prochaska
a0f5d34e25 stdcxx: update to version 10.3.0
Issue #4094
2021-05-28 14:15:26 +02:00
Christian Prochaska
9a3d5dcf21 tool_chain: update ali2dep for gcc 10.3.0
Issue #4094
2021-05-28 14:15:26 +02:00
Christian Prochaska
9c05cda6e7 tool_chain: update gcc to version 10.3.0
Issue #4094
2021-05-28 14:15:26 +02:00
Sebastian Sumpf
6639261126 binutils: augment equally-named sections again
Revert GNU ld to the old behavior where sections with the same name in multiple
ld scripts are merged. Binutils 2.36.1 creates two sections with the same name.

Fixes #4126
2021-05-10 11:52:27 +02:00
Christian Prochaska
fc902d9e66 tool_chain: update binutils to version 2.36.1
Issue #4094
2021-05-10 11:19:13 +02:00
Christian Prochaska
6a11b78cdf tool_chain: use gcc-provided dependency libraries
Download gmp, mpc and mpfr with the download script provided by the
gcc source tree and let the gcc build system handle the build of these
libraries with the correct compile options. This fixes build issues on
armhf Linux and removes the need to maintain mpc and mpfr ports in
the Genode tree.

Issue #4094
2021-05-10 11:19:11 +02:00
Christian Prochaska
7fd598f0c1 tool_chain: build 'gprbuild' from source
The 'gprbuild' version which is provided by Ubuntu 18.04 has a bug
which prevents it from building 'ali2dep' with gcc/gnat 10. With
this commit, a newer 'gprbuild' version is built from source.

Issue #4094
2021-05-10 11:19:09 +02:00
Christian Helmuth
777923f9bd depot: update recipe hashes 2021-05-10 11:18:12 +02:00
Martin Stein
d2bf565503 nic/zynq: fix packed conversion error with gcc 10
Fixes #4142
2021-05-10 11:17:21 +02:00
Alexander Boettcher
384a8da50b ssh_terminal: use pthread_mutex
to avoid sporadic deadlocks between EP thread and the server loop pthread.

Issue #4095
2021-05-10 11:17:20 +02:00
Alexander Boettcher
b6bdd91cfa nova: avoid unaligned warnings by gcc10
Issue #4126
2021-05-10 11:17:20 +02:00
Christian Helmuth
a5385cebf4 block_cache: explicitly instantiate template function
The explicit instantiation is required because the function is defined
in the compilation unit only but referenced externally.

Fixes #4108
2021-05-10 11:17:20 +02:00
Josef Söntgen
c5c3d7ca98 gpt_write: address unaligned access for name
Turn member into byte array to prevent unaligned memory access.

Fixes #4141.
2021-05-10 11:17:20 +02:00
Norman Feske
d19b751632 nano3d: remove surface-clear optimization
This patch fixes a GCC-10 compile error. Even though the optimization
was quite effective - I measured a speedup of factor 2 - it is not all
that important for the overall application performance. In the nano3d
case, we are talking about 1 vs. 2 percent of CPU time.

Fixes #4140
2021-05-10 11:17:20 +02:00
Christian Prochaska
ff160decec gdb: fix build errors with gcc 10
Fixes #4139
2021-05-10 11:17:20 +02:00
Norman Feske
a4115cfea9 base-linux: discharge timestamp on AARCH64
The kernel-agnostic 'Trace::timestamp' function for arm_64 executes the
'mrs %0, pmccntr_el0' instruction, which is not permitted for user-level
programs on Linux. This patch shadows the generic timestamp.h header
with dummy that returns zero. This return value prompts the timeout
framework to disable the interpolation of time based on timestamps. This
avoid the illegal-instruction abort but comes with two llimitations:

First, time measurements are effectlively limited to a granulariry of 1
millisecond (deliberately constrained by the timer driver).

The quirk is applied when using the base-linux API. Should a generic
application (that uses the base API only) call 'Trace::timestamp'
directly, the illegal instruction is executed.

Issue #4136
2021-05-10 11:17:20 +02:00
Norman Feske
2f9d430c00 base-linux: 64-bit ARM support
This patch adds support for running Genode/Linux on the AARCH64
architecture.

- The kernel-agnostic startup code (crt0) had to be extended to
  capture the initial stack pointer, which the Linux kernel uses
  to pass the process environment. This is in line with the
  existing startup code for x86_32 and x86_64.

- The link order of the host libraries linked to lx_hybrid
  programs had to be adjusted such that libgcc appears at last
  because the other libraries depend on symbols provided by
  libgcc.

- When using AARCH64 Linux as host, one can execute run scripts
  via 'make run/<script> KERNEL=linux BOARD=linux' now.

Issue #4136
2021-05-10 11:17:20 +02:00
Christian Helmuth
718f44ae5b Check max_len before dereferencing pointer in Cstring constructor
Fixes #4112
2021-05-10 11:17:20 +02:00
Martin Stein
66feb939e6 cbe_tester: compile errors/warnings with gcc 10
Fixes #4113
2021-05-10 11:17:20 +02:00
Christian Helmuth
1baf844e20 vfs_stress: fix handling of 'char' in error message
Issue #4112
2021-05-10 11:17:20 +02:00
Martin Stein
5fa2efa745 net/dhcp: print readable message types
When a DHCP packet is printed out, it first tries to determine the most
specific message type from the DHCP options and print its human-readable name
right after the protocol name. If finding the message type fails, the less
specific opcode is printed instead, but also in a human-readable way.

Fixes #4131
2021-05-10 11:17:20 +02:00
Norman Feske
ad847d0543 sculpt: fix glitch in fs-browser back arrow
Fixes #4124
2021-05-10 11:17:20 +02:00
Norman Feske
0b36d81c0c base-linux: separate x86-specific code
By moving core's build-description to a library - a pattern already
employed for the other base platforms - we become able to cleanly split
x86-specific code (I/O-port access) from generic code. This is a
prerequisite for enabling non-x86 architectures such as AARCH64.

Issue #4136
2021-05-10 11:17:20 +02:00
Jean-Adrien DOMAGE
a4727c90a8 lx_fs: add os/run/lx_fs_import.run run script
This new runscript demonstrates how a file can be overwritten by vfs
import with the flag overwrite set to false. This is due to a bug
in lx_fs that is not propagating an ernno EEXIST syscall error.

Issue genodelabs#4104
2021-05-10 11:16:24 +02:00
Jean-Adrien DOMAGE
e65b7f3b82 lx_fs: fix errno EEXIST not propagated
This commit introduces a fix for lx_fs to propagate errno EEXIST error.
This prevents vfs <import overwrite="false"> to overwrite an imported
file, if it already exists, without the overwrite flag set to true.

Issue genodelabs#4104
2021-05-10 11:16:24 +02:00
Josef Söntgen
0f0edc0134 usb_host: implement sg_pcopy_* as TRACE dummies
The former implementation called 'TRACE_AND_STOP' which led to the
'usb_host_drv' to stop whenever such a function was called. Rather
than stopping return '0' and let the contrib code deal with this
situation.

Issue #4116.
2021-05-10 11:16:24 +02:00
Josef Söntgen
d0f084d449 usb_host: backport xhci bounce-buffer fix
This commit backports the Linux upstream commit (d4a6106) [*]
that introduces a check to prevent the sglist from being used
unconditionally.

[*] 'xhci: fix bounce buffer usage for non-sg list case'

Fixes #4116.
2021-05-10 11:16:24 +02:00
Christian Prochaska
c7b2314d23 foc: fix errors with gcc 10 and binutils 2.36
Fixes #4118
2021-05-10 11:16:24 +02:00
Christian Helmuth
eb94f03416 microcode.run: do not twiddle with MAKEFLAGS
Unconditionally setting MAKEFLAGS to just 's' is not nice because other
flags cannot be passed through the run script. What the script desires
is to disable the automatically enabled '--print-directory' for sub-make
instances when calling tool/port/current by declaring
'--no-print-directory'.
2021-05-05 11:55:27 +02:00
Norman Feske
516a9a6925 depot: update recipe hashes 2021-05-05 11:35:31 +02:00
Norman Feske
fdb1a4dd88 base-linux: avoid legacy syscalls
Until now, Genode's Linux system call bindings were based on original
Unix system calls that were later superseded by more flexibile variants.
E.g., 'openat' is a modern version of 'open'. Even though Linux upholds
the compatiblity with the original versions for existing architectures
like x86, the legacy syscalls are absent for the recently added AARCH64
architecture. A good overview of the system calls accross the prominent
architectures can be found at

https://chromium.googlesource.com/chromiumos/docs/+/master/constants/syscalls.md

This patch updates Genode's syscall bindings to avoid legacy versions,
thereby easing the support for AARCH64. The used "modern" versions
were introduced back in Linux version 2 days. So we are fine to rely
on them.

The patch slightly changes the signature for lx_stat because this system
call is merely used to check for the existance of a file and its size.
The new name 'lx_stat_size' draws a closer connection to its use case.
That said, the stat syscall has not been updated to the modern statx
since statx is still a fairly recent addition.

Issue #4136
2021-05-05 11:35:31 +02:00
Norman Feske
d477062c56 base-linux: simplify clone syscall binding
This patch simplifies the use of the clone system call for creating
processes and threads. Until now, the binding used an opaque pointer
argument to pass context information to the newly created process or
thread. However, upon close inspection, this is not a strict
requirement.

A newly created thread accesses its contextual information by
using its stack pointer as key. The pointer argument is not used.

The creation of processes is strictly serialized because the
intermediate stack used in-between clone and execve is a global
variable. Since we rely on the serialization anyway, we can pass the
context information of a new process via a global variable as well.

This change simplifies the syscall binding for the upcoming AARCH64
support, which would otherwise require us to deal with the notion
of TLS on Linux.

Issue #4136
2021-05-05 11:35:31 +02:00
Norman Feske
811009d18b News item about Sculpt 21.03b update 2021-05-05 11:35:31 +02:00
Christian Prochaska
00d13cf304 qt5: fix build errors with gcc 10
Fixes #4132
2021-05-05 11:35:31 +02:00
Martin Stein
49184fb938 net: circumvent stringop-overflow error
With the update to GCC 10, the compiler stopped with an error when compiling
places where a MAC address is copied from outside into a packed object using
the Net::Netaddress::copy method (e.g. in
Net::Arp_packet::dst_mac(Mac_address)):

! error: writing 6 bytes into a region of size 4 [-Werror=stringop-overflow=]

While trying to find a clean solution for this error, I found posts on
gcc.gnu.org and github that stated that the size calculations that cause these
errors are incorrect. Indeed, I could verify that the actual size of the two
regions was static and exactly the same in places were the error occured.

Furthermore, I couldn't find a way of making it more clear to the compiler
that the sizes are the same. By accident, we found that using the address of
the first element of the array that forms the second region instead of the
array address itself, somehow circumvents the error.

Fixes #4109
2021-05-05 11:35:31 +02:00
Martin Stein
52e8c95321 net: fix packed-conversion compiler warning
With the update to GCC 10 the compiler used to warn when using the internet
checksum functions on packet classes (like in
Net::Ipv4_packet::update_checksum):

warning: converting a packed ‘Net::[PACKET_CLASS]’ pointer
         (alignment 1) to a ‘const uint16_t’ {aka ‘const short
         unsigned int’} pointer (alignment 2) may result in an
         unaligned pointer value

Apparently, the 'packed' attribute normally used on packet classes sets the
alignment of the packet class to 1. However, for the purpose of the
internet-checksum functions, we can assume that the packet data has no
alignment. This is expressed by casting the packet-object pointer to a pointer
of the new packed helper struct 'Packed_uint16' that contains only a single
uint16_t member before handing it over to the checksum function (instead of
casting it to a uint16_t pointer).

Ref #4109
2021-05-05 11:35:31 +02:00
Christian Prochaska
9b854e1496 Prevent recursive 'memset()' calls with gcc 10
Fixes #4125
2021-05-05 11:35:31 +02:00
Christian Prochaska
d5e7870532 virtualbox5: fix build errors with gcc 10
Fixes #4106
2021-05-05 11:35:31 +02:00
Christian Prochaska
bc8dbc6b1a bash: fix build error with gcc 10
Fixes #4107
2021-05-05 11:35:31 +02:00
Christian Prochaska
8f23e377d9 lxip: fix build error with gcc 10
Fixes #4102
2021-05-05 11:35:31 +02:00
Christian Prochaska
aebece5110 readline: fix build error with gcc 10
Fixes #4103
2021-05-05 11:35:31 +02:00
Christian Prochaska
82604f2c2b lx_fs: fix build errors with gcc 10
Fixes #4123
2021-05-05 11:35:31 +02:00
Norman Feske
4563baae77 app/text_area: fix build error with gcc 10
Fixes #4098
2021-05-05 11:35:30 +02:00
Christian Prochaska
c4e3d3dbc4 hw: fix build error with gcc 10
Fixes #4115
2021-05-05 11:35:30 +02:00
Alexander Boettcher
eb53f8c113 seoul: adjust to GCC 10.03
Fixes #4097
2021-05-05 11:35:30 +02:00
Christian Prochaska
07649b667b sel4: fix build errors with gcc 10
Fixes #4121
2021-05-05 11:35:30 +02:00
Christian Prochaska
0f679bb35e pistachio: fix build error with gcc 10
Fixes #4119
2021-05-05 11:35:30 +02:00
Christian Prochaska
d6e9d74038 nitpicker: fix build error with gcc 10
Fixes #4110
2021-05-05 11:35:30 +02:00
Christian Prochaska
405e6744fb nova: update kernel for gcc 10
Fixes #4114
2021-05-05 11:35:30 +02:00
Christian Prochaska
fad85c3fd5 virtualbox6: fix build errors with gcc 10
Fixes #4105
2021-05-05 11:35:30 +02:00
Christian Prochaska
49392dfa44 dde_ipxe: fix build error with gcc 10
Fixes #4101
2021-05-05 11:35:30 +02:00
Christian Prochaska
e627f8320f verify: fix build error with gcc 10
Fixes #4099
2021-05-05 11:35:30 +02:00
Christian Prochaska
8196e229b0 netperf: fix build error with gcc 10
Fixes #4096
2021-05-05 11:35:30 +02:00
Christian Prochaska
0a8394c891 depot_autopilot: store signal context capability as copy
Fixes #4129
2021-05-05 11:35:30 +02:00
Christian Prochaska
66e8f8d764 base: increase bss alignment to 8 bytes
Fixes #4127
2021-05-05 11:35:30 +02:00
Christian Prochaska
84e4cbb54c cxx: add 'strchr()'
Fixes #4122
2021-05-05 11:35:30 +02:00
Tomasz Gajewski
23b21812dd Fixes in gdb_monitor_interactive/target_config.run
Fixes #4134
2021-05-05 11:35:30 +02:00
Norman Feske
d66e55ec37 aes_cbc_4k.run: increase timeout
needed for foc/qemu/x86_32
2021-05-05 11:35:29 +02:00
Martin Stein
5dbc9ef244 nic_router: more descriptive port allocator code
This renames some members and local variables in the port allocator in order to
make the code more descriptive.

Fixes #4086
2021-05-05 11:35:29 +02:00
Sid Hussmann
4e822436fc nic_router: use increasing src port for new nat
The NAT feature of the NIC router used to prefer re-using source ports that
have been freed recently. From an external server's perspective, if a client
dies and restarts, chances are high that the new connect arrives with the same
source-IP/source-port as the old connection. The server has to forcefully reset
the connection. If that happens a lot, the server may even start to ignore
further connections from this IP/port combination for a while as a mitigation.

This patch adds a continuous counter feature that makes sure that every new
port allocation will increment and result in a port that hasn't been used for a
long time.

The NAT feature of the nic_router is now more in line with RFC 6056 chapter 4.

Ref #4086
2021-05-05 11:35:29 +02:00
Alexander Boettcher
ce75b25fd4 ssh_exec_channel: adjust cap quota for seL4
Issue #4095
2021-05-05 11:35:29 +02:00
Josef Söntgen
118e8ee6e1 ssh_terminal: flush buffer on Terminal cleanup
Issue #4095.
2021-05-05 11:35:29 +02:00
Alexander Boettcher
f236e99b5c ssh_terminal: avoid deadlock of EP and pthread.0
pthread.0 acquires a write buffer mutex and calls potentially
blocking fs operations. The EP thread handles session requests and tries to
acquire the same write buffer lock. IO progress events for pthread.0 are
handled by the EP thread, which however is blocking on the write buffer mutex.

The commit uses two write buffers, one which is filled by the EP and a second
which is used by pthread.0. The two buffers are swapped protected by a mutex
without invoking blocking fs operations.

Issue #4095
2021-05-05 11:35:29 +02:00
Alexander Boettcher
86e09b60c4 exec_terminal: sandbox errors about unknown node
The exec_terminal generates a config report which is used as input ROM for
sandbox/init, which does not support an "<empty>" node.

An empty config node is empty, without an node.

Issue #4095
2021-05-05 11:35:29 +02:00
Johannes Schlatow
373b45a0f0 depot: fix content.mk of drivers_managed-pc
Was still using the event_filter.config from drivers_interactive-pc
although a dedicated file is present in the raw archive.

The fix is just for consistency reasons, as sculpt manager is generating the
event_filter.config anyway.
2021-05-05 11:35:29 +02:00
Johannes Schlatow
a2491c30b3 event_filter: add new test cases
genodelabs/genode#4069
2021-05-05 11:35:29 +02:00
Johannes Schlatow
d80b2a150a event_filter: add <log> node
genodelabs/genode#4069
2021-05-05 11:35:28 +02:00
Johannes Schlatow
c802de2cf9 event_filter: add <ignore-key> node
Fixes genodelabs#4069
2021-05-05 11:35:28 +02:00
Johannes Schlatow
e86387d557 event_filter: allow remapping of KEY_UNKNOWN
KEY_UNKNOWN is a collective symbols for all unknown keycodes.
Remapping thus requires iterating through all corresponding codes
instead of only applying the policy to the first match.

Issue genodelabs#4069
2021-05-05 11:35:28 +02:00
Norman Feske
f6aabfe233 Sculpt: prevent nitpicker's resize warnings
This patch increases the RAM quota of the top-level nitpicker instance
to 12 MiB so that resize operations can be buffered for resolutions up
to 2560x1080. It mutes diagnostic messages of the form "Warning: Gui
(...) not enough RAM to preserve buffer content during resize" and
improves the window-resize experience.
2021-05-05 11:35:28 +02:00
Norman Feske
8617e5cee0 Sculpt: un-inspect failed USB storage
With this patch, the user is able to re-gain access to the inspect view
by toggling the inspect button of a file system unrelated to the failed
USB storage device.

Fixes #4090
2021-05-05 11:35:28 +02:00
Johannes Schlatow
2db94b8438 platform_drv/x86: support to disable MSI-X
+ disable for wifi driver MSI-X

Issue #4079
2021-05-05 11:35:28 +02:00
Alexander Boettcher
7b9e7361ba vbox5: add capture pkg version
Issue #4078
2021-05-05 11:35:28 +02:00
Alexander Boettcher
910ea16405 qemu-usb: restrict build to x86
Issue #4078
2021-05-05 11:35:28 +02:00
Alexander Boettcher
58db8c647a qemu-usb: add usb webcam model
Fixes #4078
2021-05-05 11:35:28 +02:00
Alexander Boettcher
4826bd82fe qemu-usb: fix spelling
Issue #4078
2021-05-05 11:35:28 +02:00
Alexander Boettcher
7b90f8f857 libports: add libyuv support
Issue #4078
2021-05-05 11:35:28 +02:00
Johannes Schlatow
bf3ad3baff vbox5/6: pass extra mouse buttons to VM
Fixes #4120
2021-05-05 11:35:28 +02:00
Johannes Schlatow
8a4b52d9e3 vbox: only clear screen if virtual_fb_mode changed
Fixes genodelabs/genode#4085
2021-05-05 11:35:28 +02:00
Johannes Schlatow
a47fd36b9f vbox: fix high VM load after resize
break circle of repeated guest notifications if the guest never
acknowledges a VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST

genodelabs/genode#4084
2021-05-05 11:35:28 +02:00
Christian Prochaska
a2e62db6ec qt5: fix libpng vulnerabilities
Fixes #4089
2021-05-05 11:35:28 +02:00
Alexander Boettcher
7503472ae6 stdcxx: add missing symbols for istream and thread
Issue #3967

triggers using -O0 with test-libc_integration:

libc_integration/main.cc:146: undefined reference to `std::istream::operator>>(unsigned long&)'

contrib/stdcxx-80f380143250d4f951433876698b54fdac32b95f/include/stdcxx/std/thread:67: undefined reference to `vtable for std:🧵:_State'
2021-05-05 11:35:27 +02:00
Johannes Schlatow
1c49da8ce4 terminal: don't overwrite last column until eol
Introduce a new _overflowed state variable to indicate whether the
horizontal boundary was reached already and to omit subsequent character
output.

This state is necessary to maintain a valid cursor position at all
times. The _overflowed attribute is reset once the cursor is moved into
a valid position again.

To harmonise the bounds checking for _cursor_pos modifications, the
`constrain()` method was added.

Fixes genodelabs/genode#4093

Also fixes a bug in `vpa()` and `vpb()` which moved the cursor
horizontally instead of vertically.
2021-05-05 11:35:27 +02:00
Norman Feske
9cb8c37e3a terminal: fix sporadic freeze on font-size changes
The direct execution of application-level code by a watch handler is
troublesome because those handlers are executed at the I/O signal level.
In the concrete case, the watch handler got recursively called because
the handler called _handle_config (application-code), which called the
VFS, which in turn performed a wait_and_dispatch_one_io_signal, which
again invoked the watch handler.

The patch works around the problem by letting the watch notification
trigger the application-level signal for the _config_handler.

Fixes #4091
2021-05-05 11:35:27 +02:00
Pirmin Duss
bb6617ad03 New libc_integration test
I created a test program which stresses the interplay between libc,
pthreads and vfs_pipe and may detect regressions.

The program starts a thread that spawns a bunch of workers, sends and
receives data to them through a pipe. When all data of a worker is
collected, the worker is finished (join()) and a new worker is started.
Both the number of bytes sent to the worker and the size of its
answer are random.

Issue #3967
2021-05-05 11:35:27 +02:00
Tomasz Gajewski
f49ec5b171 tool/run: extract function to copy files
Issue #4073
2021-05-05 11:32:09 +02:00
Tomasz Gajewski
507a7789fb tool/run: avoid error if init.xsd is missing
Issue #4073
2021-05-05 11:32:09 +02:00
Stefan Kalkowski
421d2bed40 platform driver: make device info XML optional
* The device XML information dataspace is only provided,
  when the client's policy states `info="yes"`
* The device XM information gets changed to include the
  physical resource names (I/O memory and IRQ addresses)
  instead of virtual ids and page offset

Fix #4077
2021-05-05 11:31:16 +02:00
Norman Feske
6caa74a18e Remove os/slave.h API
Fixes #3754
2021-05-05 11:21:43 +02:00
Norman Feske
5ac3c335dc Remove pkg/test-dynamic_config_slave
Issue #3754
2021-05-05 11:21:43 +02:00
Norman Feske
e8b97ad684 test/resource_yield: don't use os/slave.h
Issue #3754
2021-05-05 11:21:43 +02:00
Christian Helmuth
3f450a77e1 Fix touchscreen config in usb_hid README 2021-05-05 11:21:43 +02:00
Johannes Schlatow
462bff5aef dde_linux: test subdevice id for device matching
As linux drivers may distinguish device configuration by pci subdevice id in
addition to the pci device id, the former must also be used for finding the
matching entry. Otherwise, e.g., the iwlwifi driver might load the wrong
firmware.

Side note: Add break statement to save superfluous iterations after
match was identified.

Fixes genodelabs#4076
2021-05-05 11:21:43 +02:00
Norman Feske
ace7c9172b Disambiguate Mmio::local_addr
This is a follow-up fix for "Streamline platform-device API on ARM".
There is an ambiguity of the 'local_addr' method between the inherited
'Attached_dataspace' and the local declaration, which results in the
double application of the sub-page Range::start.

Issue #4075
2021-05-05 11:21:43 +02:00
Emery Hemingway
173264ed1e depot: remove ehmry
Fixes #4082
2021-05-05 11:21:43 +02:00
Christian Prochaska
190eafeaa6 base: handle 'unpack_string()' error in 'Arg::string()'
Fixes #4100
2021-05-05 11:21:43 +02:00
Josef Söntgen
ddf6a0c276 os: add invalid path exception to Path_base
In case the path is invalid during import raise the 'Path_invalid'
exception.

Issue #4088
2021-05-05 11:21:42 +02:00
Josef Söntgen
8f30fc993d libc: check path pointer in file I/O functions
Fixes #4088
2021-05-05 11:21:42 +02:00
Alexander Boettcher
33a64f79dc libc: place pthreads round-robin
if the number of threads started exceed configured placement configuration

Issue #3967
2021-05-05 11:21:42 +02:00
Pirmin Duss
7de62734e5 libc: add pipe2 symbol to symbols
Issue #3967
2021-05-05 11:21:42 +02:00
Norman Feske
d73eaaa14c libc: exclude arm_initfini.c
This compilation unit contains a global constructor, which violates our
assumption that the libc is free of global constructors on ARMv7.
Specifically, the graphical terminal fails with the following message:

[init -> terminal] Error: Component::construct() returned without executing
                          pending static constructors (fix by calling
                          Genode::Env::exec_static_constructors())
[init -> terminal] Error: Uncaught exception of type 'Linker::Fatal'

In this case, the libc-less terminal uses the VFS. The VFS mounts the
ttf VFS plugin. The ttf VFS plugin depends on the libc.

The compilation unit 'arm_initfini.c' can safely be excluded because it
merely initializes the global '_libc_arm_fpu_present' variable, which
is not used by the current version of our libc/libm.

Fixes #4080
2021-04-20 12:12:48 +02:00
Norman Feske
efbed6f7bf depot: update recipe hashes 2021-04-20 12:10:58 +02:00
Norman Feske
5ca024ff8b vfs_block.run: adjust cap quota for seL4 2021-04-20 12:10:58 +02:00
Norman Feske
dc8c899c1d Streamline platform-device API on ARM
This API rework eases the access to memory-mapped I/O registers and
interrupts when using the platform driver. It introduces the notions of

- Platform::Device       - one device obtained from a platform session
- Platform::Device::Mmio - locally-mapped MMIO registers of a device
- Platform::Device::Irq  - interface for receiving device interrupts

The patch touches several drivers. Some drivers would require a
significant structural change to adopt the new API (e.g., net/virtio,
dde_linux drivers, imx gpio). In these cases, the patch adds
compatibility shims meant to be temporary. In other cases (e.g., imx
i2c), the adaptation was simple enough to carry through.

Fixes #4075
2021-04-20 12:10:58 +02:00
Stefan Kalkowski
d1cf9c86b8 os: introduce device type in platform driver
* Move "compatible" property value to "type" attribute
* Turn device_by_property helper in Platform::Connection into device_by_type

Fix #4074
2021-04-20 12:10:58 +02:00
Norman Feske
46ca576eac Adjust gcov cap quota for seL4 2021-04-20 12:10:58 +02:00
Norman Feske
70281715c6 ssh_exec_channel.run: fix server IP pattern
This patch adjusts the matching of the IP address such that the external
IP address is used as opposed the the NAT-local address. It is follow-up
fix of the conversion to the uplink session interface.

Issue #3961
2021-04-20 12:10:58 +02:00
Norman Feske
4546148ab7 Adjust test-libc_fifo_pipe cap quota for seL4 2021-04-20 12:10:58 +02:00
Sebastian Sumpf
80cf47d906 ldso: protect object list with mutex
When we allowed symbol resolution during exceptions, we used the shared
object lock to protect ELF object list manipulation (e.g., dlopen,
dclose) when executing exception unwinding code in the linker.
Unfortunately, sometimes libraries that are loaded by 'dlopen' may raise
exceptions in the process, leading to a deadlock within the unwind code.
In order to resolve this, we now protect the object list operations
(i.e., enqueue, removal, iteration) by a separate mutex. This allows
the shared object interface to throw exceptions.

issue #4071
2021-04-20 12:10:58 +02:00
Norman Feske
7c01053842 Adjust test-fault_detection cap quota for seL4 2021-04-20 12:10:58 +02:00
Norman Feske
e28709d54d acpi_drv: use expanding reporter
This makes the driver work on newer machines that produce reports larger
than 16 KiB. E.g., Sculpt OS boots successfully on a Lenovo P53s laptop
now.
2021-04-20 12:10:58 +02:00
Norman Feske
dc89ebf978 core: kernel-agnostic 'Mapping' type
This patch unifies the core-internal 'Mapping' type across all base
platforms.

As one minor downside on seL4, the diagnostic error messages when
observing faults other than page faults no longer print the faulting
thread and PD names.

Issue #2243
2021-04-20 12:10:57 +02:00
Norman Feske
7ae1210531 fs_rom: remove "ROM file is missing" messages
These messages pollute the boot log of Sculpt OS when ROM modules are
requested for files of the config fs before the sculpt manager has
created their first version.
2021-04-20 12:10:57 +02:00
Norman Feske
c9d904df71 vfs/tar: remove "tar archive ..." message
This diagnostic output is a mere debugging artifact. By removing them,
we make the boot of Sculpt less noisy.
2021-04-20 12:10:57 +02:00
Norman Feske
21e9e1840a chroot: forward cap-quota upgrades to the server
Fixes #4072
2021-04-20 12:10:57 +02:00
Norman Feske
4e714d3f3a base: handle cap depletion during session upgrade
When the own cap quota of a client does not suffice for a cap upgrade of
an existing session to a server, the client must issue a cap-resource
request to the parent. This logic was already in place for RAM quota but
was missing for cap quota.

Issue #4072
2021-04-20 12:10:57 +02:00
Martin Stein
2084404aba nic_router: explain state report in README 2021-04-20 12:10:57 +02:00
Sebastian Sumpf
9c9302e51d ldso: allow symbol resolution during dl_itera_phdr
When callback functions of `dl_iterate_phdr` required further jump slot
relocations this lead to a deadlock. Therefore, we allow the resolution
of further symbols from callback functions, but protect the ELF object
list during the iteration, which blocks any dynamic loading (e.g.,
dlopen/dlcose) of shared object by other threads while in program header
iteration.

fixes #4071
2021-04-20 12:10:57 +02:00
Norman Feske
af490bdd5b Revert "sculpt: tweak window motions in leitzentrale"
Apparently the skewed motion timings came from the issue fixed by
"timer: restore semantics of periodic timeout 0". With the current
version of the timer, the original motion parameters work just fine.
2021-04-20 12:10:57 +02:00
Norman Feske
0339318572 platform_session: cache arg for alloc_dma_buffer
This patch extends the 'Platform_session::alloc_dma_buffer' interface
with a 'Cache' argument that corresponds to the argument accepted by
'Ram_allocator::alloc', which is used by the platform driver under the
hood.

Since the x86 platform driver used to be hardwired to allocate DMA
buffers as UNCACHED, I adjusted all drivers by specifying the UNCACHED
argument. Right now, this is needed as a hint for core to steer the
allocation of I/O page tables. Once we eliminate the need for such hints
(by introducing an explicit 'Region_map::attach_dma' operation), we can
revisit the drivers individually because cached DMA buffers should
generally be fine on the x86 architecture.

Issue #2243
2021-04-20 12:10:57 +02:00
Norman Feske
53e44f8bfd x86/platform_session: import Genode namespace
This change avoids many repetetive Genode:: prefixes, making the code
easier to read. The patch also includes a few consistency fixes
regarding include guards and file headers. It also renames
Platform_device::String to Platform_device::Device:name.

Issue #2243
2021-04-20 12:10:57 +02:00
Norman Feske
a839b4f0bb gdb_monitor: adapt to sandbox library changes
Issue #4068
2021-04-20 12:10:57 +02:00
Norman Feske
468e7a825c base/cache.h: rename Cache_attribute to Cache
The short name is better because the type will become prominently
visible at the API.

Issue #2243
2021-04-20 12:10:31 +02:00
Norman Feske
3ed8df9089 x86/platform_drv: add Platform::Session::dma_addr
This patch adds the designated alternative to Dataspace::phys_addr to
the platform-session interface. Under the hood, the platform driver
still calls Dataspace::phys_addr but it should eventuelly become the
only caller before we can abolish this function.

Issue #2243
2021-04-20 12:03:05 +02:00
Norman Feske
97a9ad114c platform_session: bus_addr_dma_buffer to dma_addr
Issue #2243
2021-04-20 12:03:04 +02:00
Norman Feske
f5f5b8c1f1 sandbox/init: route model
This commit optimizes the 'Child::resolve_session_request'
implementation by introducing an internal 'Route_model' for quickly
traversing routing rules instead of parsing XML on each session request.

Fixes #4068
2021-04-20 12:03:04 +02:00
Norman Feske
b661459aca sandbox/init: parse config using 'List_model'
This commit replaces the hand-crafted config processing by the use of
the 'List_model' utility. This has the following advantages:

- The parsing follows a common formalism that makes the code
  easier to maintain and to understand. Several parts of the code
  had to be changed (for the better) to make it fit the list model
  approach. E.g., the child states have become more expressive
  and logical.

- In the common case, the XML data is traversed only once, which
  increases the parsing speed in dynamic scenarios.

- The code becomes easier to optimize. In particular, the patch skips
  the re-evaluation of the session routing if no service is affected
  by the config change.

The patch also revisits the init test by removing overly long sleep
phases and extending a few sleep phases that were too short when
executing the test on Qemu.

Issue #4068
2021-04-20 12:03:04 +02:00
Norman Feske
f925fef17b base: Refine Range_allocator::alloc_aligned
This patch changes the 'alloc_aligned' interface as follows:

- The former 'from' and 'to' arguments are replaced by a single
  'range' argument.

- The distinction of the use cases of regular allocations vs.
  address-constrained allocations is now overed by a dedicated
  overload instead of relying on a default argument.

- The 'align' argument has been changed from 'int' to 'unsigned'
  to be better compatible with 'addr_t' and 'size_t'.

Fixes #4067
2021-04-20 12:03:04 +02:00
Tomasz Gajewski
97d44c5a79 app/menu_view: use CUSTOM_TARGET_DEPS 2021-04-20 12:03:04 +02:00
Tomasz Gajewski
1867cf4967 iwl_firmware: use CUSTOM_TARGET_DEPS 2021-04-20 12:03:04 +02:00
Tomasz Gajewski
f3f8d9a6de build system: support for CUSTOM_TARGET_DEPS 2021-04-20 12:03:03 +02:00
Norman Feske
99f4b3cd07 Debug macros for easy performance profiling
The debug macros 'GENODE_LOG_TSC' and 'GENODE_LOG_TSC_NAMED' allow for
the easy gathering of the TSC ticks consumed by the calling scope.

Fixes #4066
2021-04-20 12:03:03 +02:00
Norman Feske
ac07f9d08e sculpt: skip GUI handling until framebuffer is up
This avoids unneeded activity of the Leitzentrale GUI (e.g., the
decorator) at the early boot phase of Sculpt.
2021-04-20 12:03:03 +02:00
Norman Feske
ed9487b452 rtc_drv: defer init until first use
This patch avoids the RTC driver's aggressive polling during the
(CPU-bounded) boot of Sculpt OS. As the RTC is not needed during bootup,
this patch reduces the boot time (on Qemu) by 2-4 seconds.

Fixes #4065
2021-04-20 12:03:03 +02:00
Norman Feske
729b22f04f rtc_drv/x86: code structure
Give the driver code a proper context in the form of a 'Driver' class.

Adjusted while investigating issue #4065.
2021-04-20 12:03:03 +02:00
Norman Feske
698f6eb86c gdb_monitor: weaken reliance on sandbox internals
GDB monitor re-uses internal parts of the sandbox library. It thereby
relies on the internal detail of how local headers are included (using
"" instead of the now usual practice <>). A seemingly unrelated change
"init/sandbox: avoid repetitive state reports" eventually broke the
build of the GDB monitor.

This patch makes the GDB monitor less reliant on the way of how the
sandbox includes headers internally.

It also fixes a few warnings caused by the double definition of
__GENODE__ (adding an missing include guard and making the #define
conditional).

Related to issue #4064
2021-04-20 12:03:03 +02:00
Norman Feske
73e8d64c34 init/sandbox: avoid repetitive state reports
Fixes #4064
2021-04-20 12:03:03 +02:00
Christian Helmuth
cb9a26f1ed vbox6: sculpt runtime package
Issue #4031
2021-04-20 12:03:03 +02:00
Norman Feske
49481dd3fb timer: restore semantics of periodic timeout 0
The 'Timer::Session::trigger_periodic' RPC function used to accept 0 as
a way to de-schedule the periodic processing. Several components such as
nitpicker relied on this special case. In "timeout: rework timeout
framework", the value of zero was silently clamped to 1, which has the
opposite effect: triggering signals at the maximum rate. This results in
a visible effect in Sculpt where the leitzentrale-nitpicker instance
produces a constant load of 2% CPU time.

This patch restores the original timer semantics by

- Documenting it in timer_session.h,

- Handling the case explicitly in the timer implementation, and

- Replacing the silent clamping of the unexpected value 0 passed
  to the timeout framework by a diagnostic error message.

Issue #3884
2021-04-20 12:03:03 +02:00
Norman Feske
dc8dd3396d base: move Xml_generator::Node::Node behind ABI
Fixes #4063
2021-04-20 12:03:03 +02:00
Christian Helmuth
9ac23a18d4 vbox6: synchronize guest-memory handling 2021-04-20 12:03:03 +02:00
Norman Feske
ae8050bb82 wm.run: let nitpicker request fb and input
This patch restores the ability to launch nitpicker within a gui_fb
window. It is a follow-up fix for "nitpicker: make framebuffer and input
optional".

Issue #3812
2021-04-20 12:03:02 +02:00
Tomasz Gajewski
0a849a1681 prepare_port: cache handling for files with paths
This patch is a follow-up fix for issue #4028 that fixes #4061.
2021-04-20 12:03:02 +02:00
Christian Prochaska
f89414c637 libports: update expat port
Fixes #4060
2021-04-20 12:03:02 +02:00
Christian Helmuth
4cdfeb13e2 vbox6: cleanup code and log output
Issue #4031
2021-04-20 12:03:02 +02:00
Christian Helmuth
1a57a5a959 vbox6: refactor vcpu implementation
Also add recent SVM changes from vbox5.

Issue #4031
2021-04-20 12:03:02 +02:00
Norman Feske
96cc660f95 sculpt: system reset via PS/2 and ACPI
This patch enables sculpt to utilize the CPU reset mechanism via the
PS/2 controller as well as the information provided via the ACPI FADT
information. Whenever the /config/system file is changed to <system
state="reset"/>, both mechanisms are triggered.

Supporting both mechanisms is useful because the PS/2-based reset does
not work reliably on modern machines. The PS/2-based reset is useful in
the case when the FADT reset information refers to the PS/2 command
port. In this case, the platform driver is unable to access this port
because it is already handed out to the PS/2 driver. In this case, the
PS/2 driver kicks in.

Issue #2726
2021-04-20 12:03:02 +02:00
Norman Feske
2c7c7767fc platform_drv: respond to <system state="reset"/>
If 'system="yes"' is specified in the <config>, the platform driver now
monitors the content of the system ROM. Should the value become "reset",
a reset is triggered using information obtained from the ACPI driver.

Related to issue #2726
2021-04-20 12:03:02 +02:00
Norman Feske
9f8c555e7d ps2_drv: respond to <system state="reset"/>
This patch adds the option for monitoring a system ROM to the PS/2
driver and issuing a CPU reset whenever the state becomes "reset".

Issue #2726
2021-04-20 12:03:02 +02:00
Norman Feske
fb9f6812e1 acpi_drv: export ACPI reset info from FADT
The change of the platform driver is needed to avoid a parsing error of
the ACPI ROM when encountering an unexpected <reset> node.

Thanks to Alexander Boettcher for the preventing the regression of #3829
and improving the adherence to the ACPI spec when parsing the reset type.

Related to issue #2726
2021-04-20 12:00:09 +02:00
Christian Helmuth
839183d2b6 vbox6: unify EMT and vCPU entrypoint
Issue #4031
2021-04-20 11:57:19 +02:00
Christian Helmuth
c67e78a7f0 vbox6: update to version 6.1.18
Issue #4031
2021-03-29 15:49:59 +02:00
Christian Helmuth
0ac4d1d411 libc: rename special-purpose pthread creation functions
The functions are used by our VirtualBox ports to hook into thread
creation and, thus, are listed in the ABI symbols.

Issue #4031
2021-03-29 15:48:11 +02:00
1238 changed files with 25406 additions and 11684 deletions

View File

@@ -1 +1 @@
21.02
21.05

View File

@@ -1 +0,0 @@
https://depot.1337.cx

View File

@@ -1,37 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQENBFm3BlYBCADR2ZGIWiYurf/urQ+rAZs3HMobXQ/fckc3FOAdY9qiklrvPr9s
maZZyMF+Wn4J2AmsGctJbBUt3ujcmk09AgZIzrHpVJRagUSz9q+bK7NvAfenDC2q
w4HS5yE9DYxXOjxrcS5a2HhKfE5sZef1zPtFIkEZCJXCvh4IL6maLijOrUZPf9R6
VJ+0itNh0hK9KiYsKA7CwrWuFaw7ZenVkEBV1HGXybFh9aInTTSqopyU6qYLDK1X
U0NG24cjM8TDbMGTaoScpLchcftBGEhjYg7Y2FCu455MDVdrmoOoxDINYgDU1KN6
8GBKKJ+xqG703/o550l+rCMB+TxMN5zKTFhXABEBAAG0IkVtZXJ5IEhlbWluZ3dh
eSA8ZWhtcnlAcG9zdGVvLm5ldD6JAVQEEwEIAD4CGwMFCwkIBwIGFQgJCgsCBBYC
AwECHgECF4AWIQRuEEFO5xYHgfX+6P+xTQQ6JrPSxwUCWgHubgUJAZm9OgAKCRCx
TQQ6JrPSxyJ0B/0eBOIloo3zJwtuQnNXe2ZFAmHFF7MJhrr0IpZ0n5K0OHTFPqXN
VJ+vhTGuI/SlF3a9YEHohIT2KKal1aq+/wVkX6Kdi4G4nGTEXdRsTwlzN/GXHBPF
IW0iUOInJOliKReaamsR/rgXXH5sstq2IU4x+NpHMT/OrkQPNSqVX0RjS9i76Awo
+EqdtW8g3y8qWd8WtTfhbMlQLhuzm99aADbspr4nK9WhZ7UHYLJAz/u7LzZlRiI5
hNa85BCPhNuYz5NTHhn4L9r6PdbKPzUV173XrlAtlteYuGIHk4d/zSAwlgDevChL
0MDRq1vvgfQ2V0SwIqRqIfnO31Ph8uktJ8WRiQEfBBABCAAJBQJaAReyAgcAAAoJ
EIZq4LBroLaERpQH/3Dw0H6N9YF2ATmkse6NNNQjxhKSUoA34UBWj0v4Q1AvXEe6
nHRR0mAa9Gije9ixKUg85VbKM3lUhXCFqW5jzyzpF1rzzTpAHaUTYKb8M2D9iRKo
9ejTK3KrgpstYJ8jthfosxeC+lK24WUXKKWPjgoIhv7Thd31ea/PZdkFVd1MpSwg
5BHRHcogsJI9uou7zWYbap9/k0lxKHJWklLh/oXet+aAoUIL0kTU+nILy3/RZJGW
9WlnZR9g3qSQ8YNpgNSrraEtXpcs6MGsWZSzbzJ1U95NL87NbWEOYgHZA++vhEy5
EXVrd8SuSHbUbqNF36gz1cxmEuKwxAaWZ1/UbGW5AQ0EWbcGVgEIANC9LozG/TXV
4j0TniuLrsq7kkNH+OJQexcD19pBrmEV4eYYD6c8BB9CaBITqvKIqtG0VJrmB5S5
D0oW4mQI+TkcX+Q7y3S7dUkc856d03aUX3vVcNhXEbNgM19qxAGieC8WH2kr4XU1
psu1WvFCXOktrE5c8H0rPCQ1jseB0S67XCA9BLwAqlqu0OuTpbWddjXuE1ahi0ig
Yt5YsHvgCMLup208azQqGCnJ5tFotqzbLg3I6+QzMcLySqsN4BzYmUGbOSSZdUhX
DWxwAK1dB8qa27iwsxCMncdGnqOTkq+mXRmu8ztPTUivyC6YHJ+O5lXvMMADZi4j
8RpQQlh5gFkAEQEAAYkBNgQYAQgAIBYhBG4QQU7nFgeB9f7o/7FNBDoms9LHBQJZ
twZWAhsMAAoJELFNBDoms9LHTmIH/0PuzpA3Ezdrb4xfVwnhUUZGiqfNzULCZipT
qtfym6Ove6To4BbXAihWwnCYs4sgipabW1WaXsDDvU+AmOmz4EPyTna23fUzYRSL
MT/kk77d+BGRGeA8/Gj/BgjPlHlFa7ukbT1DL1lSV0RMQ32tDGnhJ7wMBx4GoYU+
xjlsxrYKKdvZKOQVCCFn4KY/GavqT+8pYYI63stSPGspboQR2iboKqc350MVMvzz
IaDt14YiOYlgV6LoNj2VaPJvFqm9ML+plYl4PPQZTV6KAhFWCDJq2DzEQqwG6RU4
SsneHAqMlG4A5SSMTLEd9F2gZ2sJicybr1WbNLj1KF74ckUhpM4=
=p4q9
-----END PGP PUBLIC KEY BLOCK-----

View File

@@ -362,6 +362,20 @@ in its 'LIBS' declaration and refers to the tools relative to
'$(BUILD_BASE_DIR)'.
Building additional custom targets accompanying library or program
==================================================================
There are cases when it is important to build additional targets
besides standard files built for library or program. Of course there
is no problem with writing specific make rules for commands that
generate those target files but for them to be built a proper
dependency must be specified. To achieve it those additional targets
should be added to 'CUSTOM_TARGET_DEPS' variable like e.g. in
iwl_firmware library from dde_linux repository:
! CUSTOM_TARGET_DEPS += $(addprefix $(BIN_DIR)/,$(IMAGES))
Automated integration and testing
#################################

View File

@@ -4,6 +4,59 @@
===========
Genode OS Framework release 21.05 | 2021-05-31
##############################################
| Version 21.05 introduces webcam support, features an encrypted file vault
| for Sculpt OS, and adds new drivers for the i.MX8 SoC and Pine-A64.
| Furthermore, it is accompanied with a new tool chain based on GCC 10
| and new guidance documentation for driver development.
Device-driver support remains a prominent topic for almost every release.
The just released version 21.05 is no exception, touching hardware topics
ranging from USB, over I2C on i.MX8, over GPIO on Pine-A64, to networking on
RISC-V. Until now, such nitty-gritty driver-development work has been pursued
almost exclusively by the core team at Genode Labs. To encourage developers
outside the inner circle to join the fun, the release is accompanied with the
initial version of a comprehensive guidance documentation for
hardware-related topics.
Feature-wise the two highlights of the new version are webcam support and an
easy-to-use encrypted file store based on our custom CBE block encrypter.
As detailed by the release documentation, both features leverage Genode's
architecture in unique ways to attain high flexibility without an inflation of
complexity.
The release is rounded up by a new tool chain based on GCC 10 and Binutils
2.36, profound performance optimizations, framework refinements, and new
assistive tooling for porting Linux drivers. All the details of the new
version are covered by the official
[https:/documentation/release-notes/21.05 - release documentation of version 21.05...]
Sculpt OS 21.03 boots now in 2.5 seconds | 2021-05-03
#####################################################
| We have released an updated Sculpt 21.03 image featuring several
| hardware-compatibility tweaks and performance improvements.
Since the official Sculpt OS 21.03 release end of March, we continued our
efforts with refining the user experience and broadening hardware
compatibility, thanks to the user feedback we received. We have now released
an updated system image that includes those refinements as well as several
performance optimizations that boost the boot time of Sculpt to less than 2.5
seconds from the first life sign of the kernel to the graphical user
interface (measured on a 5-years old Lenovo x250 laptop).
You can get the new version of the system image named sculpt-21-03b at the
[https://genode.org/download/sculpt - Sculpt OS download] page.
It is binary compatible with the original release version. So you can use it
as a drop-in-replacement.
For manually reproducing the image, please refer to the corresponding
[https://github.com/chelmuth/genode/commits/sculpt_21_03b - Git branch].
Sculpt OS release 21.03 | 2021-03-24
####################################

817
doc/release_notes/21-05.txt Normal file
View File

@@ -0,0 +1,817 @@
===============================================
Release notes for the Genode OS Framework 21.05
===============================================
Genode Labs
The most prominent user-visible features of Genode 21.05 are the support for
webcams and an easy-to-use component for file encryption on
[https://genode.org/download/sculpt - Sculpt OS]. Both topics greatly benefit
from Genode's component architecture. The video-conferencing scenario
described in Section [Webcam support] sandboxes the webcam driver in a
disposable Genode component while using a second instance of the nitpicker GUI
server as a video bridge. This design strikes a beautiful combination of
simplicity, robustness, and flexibility.
The new file vault described in Section
[File vault based on the CBE block encrypter] leverages Genode's dynamic
sandboxing capabilities to manage the creation and operation of an encrypted
file store. Even though the underpinnings can be described as nothing less
than sophisticated machinery, the package presented to the user combines ease
of use with a great sense of control.
The second focus of the current release are the manifold improvements of
Genode's driver and platform support as described in Sections [Device drivers]
and [Platforms]. Our USB support received the attention needed to accommodate
the webcam scenario, the arsenal of i.MX8 drivers got enriched with I2C and
power-domain control, the Pine-A64 board support is growing, Genode has become
able to run on 64-bit ARM Linux, and we enabled principle networking for
RISC-V.
Speaking of platforms, this release features the first version of a new
"Genode Platforms" documentation (Section [Updated and new documentation])
that aids the porting of Genode to new ARM SoCs. With this document, we share
our former in-house know-how and methodology about the porting and development
of drivers with developers outside of Genode Labs.
The release is rounded up by several performance optimizations
(Section [Performance optimizations]) to the benefit of most Genode system
scenarios. Furthermore, it is accompanied with an updated tool chain,
following our established two-years rhythm
(Section [Tool-chain update to GCC 10.3 and binutils 2.36]).
Webcam support
##############
During 2020, the amount of home office and remote work took an unexpected turn.
Video conferences and video chats have become the norm, which people and
companies rely upon. Even though, not to be found on our
[https://genode.org/about/road-map - road map] for 2021, this development
prompted the Genode team to explore the field of webcam and video chat support
on Genode.
Webcams are generally connected via USB to a host device and implement the USB
video device class
([https://www.usb.org/sites/default/files/USB_Video_Class_1_5.zip - UVC spec]).
Therefore, it is possible to drive many different webcam devices using the
same USB interface. To support this protocol, we enabled
[https://ken.tossell.net/libuvc/doc - libuvc], which offers fine-grained control
over UVC exporting USB devices. In order to enable _libuvc_ on Genode, we
simply integrated the library into Genode's port system with no further
changes required. _libuvc_ depends on [https://libusb.info - libusb] as a back
end to access the actual webcam device. While there exists a port of _libusb_
for Genode - that connects through Genode's USB session interface to the USB
host controller - the port still lacked support for isochronous USB transfers
as required by UVC devices. Isochronous transfers represent a continuous
stream of data (either input or output) with a constant rate without delivery
guarantees. We extended _libusb_ to handle isochronous transfers, which were
already supported by Genode's USB session. Observing that this kind of
transfers can cause high load within the USB host driver, we optimized
isochronous transfer support at the host driver level (Section [USB]).
At the front-end side, we created a small _usb_webcam_ component that uses
_libuvc_ in order to enable, disable, and configure the camera. The component
connects to a GUI session, and thus, can be interfaced directly, for example,
to the Nitpicker component for rendering webcam images natively on screen.
Whereas Genode's pixel format is 32 bit RGB, webcams stream data in the YUV2,
MJPEG, or H.264 formats. To handle the conversion of these formats to Genode's
pixel format, we utilize the
[https://chromium.googlesource.com/libyuv/libyuv - libyuv] library and thereby
support the YUV2 as well as the MJPEG pixel format for webcams.
Additionally, we wanted to be able to transfer the webcam data directly into
our VirtualBox port, thus enabling, sophisticated video conference systems
like Jitsi or Skype.
[image webcam]
Our USB host-controller support for VirtualBox is based on the ported Qemu USB
3.0 (XHCI) controller model. Since no USB webcam device model is available for
Qemu, we were required to develop a one from scratch. The new USB webcam model
is attached to the QEMU USB XHCI controller and operates as a bulk endpoint.
In contrast to an isochronous endpoint, the model causes less CPU load and
fewer virtual interrupts. The supported formats offered to the guest are YUV2
and BGR3. By enabling the USB webcam model within the Genode VirtualBox
configuration, a _Capture_ session is used to capture pictures at the rate of
a configured _fps_ value. The following snippet shows the default values of
the supported configuration attributes.
!<config ...>
! ...
! <webcam width="640" height="480" fps="15" vertical_flip="false"
! screen_size="false" report="false"/>
! ...
!</config>
If the _screen_size_ attribute is set to _true_, the device model determines
the resolution from the established capture session. Otherwise, the specified
_width_ and _height_ values are used. The _vertical_flip_ attribute is useful
for the BGR3 format, which is - when interpreted by Linux guests - flipped
vertically and can be flipped back by setting the attribute to _true_.
If the _report_ attribute is set to _true_, a report will be generated
whenever the guest changes the state of the webcam model, either by switching
capturing on/off or by changing the pixel format.
! <capture enabled="true/false" format="YUV2/BGR3"/>
[image webcam_chat]
Finally, our developers, croc and lion, setup the Webcam scenario in Sculpt
and test drive the new feature fascinated. The picture shows a session via
Jitsi, on the right side croc participates at the meeting via a Win10 VM on
Sculpt and lion sitting left joined via an Android tablet.
Performance optimizations
#########################
One of the overarching topics of this year's
[https://genode.org/about/road-map - roadmap] is optimization.
As part of working on the Sculpt OS
[https://genode.org/news/sculpt-os-21.03-boots-now-in-2.5-seconds - version 21.03],
we identified several optimization vectors with the potential for user-visible
improvements. In particular, while interacting with the system, a few effects
made us curious.
Operations that involved changes to the runtime subsystem, e.g., adding or
reconfiguring a component, seemed to interfere with multi-media workloads.
When running a graphical animation, we could see it stutter in such
situations. Another direction of our curiosity was the boot time of the
system. The boot time of Sculpt OS has always been relatively quick compared
to commodity operating systems. E.g., on a 5-years old laptop like a Lenovo
x260, the system used to boot in about 5 seconds to the graphical user
interface. However, with the anticipation of Sculpt OS on lower-end platforms
like the Pinephone and with the vision of instant-on systems, we wondered
about the potential for improvement.
While gathering a CPU-load profile of the boot process using the top tool, we
learned that the boot time was bounded not by I/O but by the CPU load (the
kernel's idle thread did not appear in the profile). Interestingly, a
significant portion of the cycles were consumed by various instances of the
init component, which prompted us to turn our attention to the implementation
of init.
Clock-cycle measurements
------------------------
The next natural step was the benchmarking of various code paths of init using
a cycle-accurate time-stamp counter (TSC). Even though Genode has a
'Trace::timestamp' utility readily available, it remains barely used for
manual instrumentation because such instrumentations require too much labor:
allocation of state variables for gathering the statistics, computing time
differences, traffic-shaping of the debug noise (needed whenever investigating
highly frequently called code). These tasks should better be covered by a
utility so that friction-less performance analysis can become a regular part
of our development work. As a side effect of our investigation, we came up
with a new utility called GENODE_LOG_TSC. This utility is covered by a
dedicated article.
:Performance analysis made easy:
[https://genodians.org/nfeske/2021-04-07-performance]
Thanks to GENODE_LOG_TSC, we were able to identify three concrete
opportunities for optimization in a course of one evening. First, the dynamic
reconfiguration of init apparently did not scale well with a growing number of
components. The code for analysing differences of configuration versions
relied on doubly nested loops in order to stay as simple as possible. With the
typical number of 30 or more components/subsystems hosted in Sculpt's runtime,
we passed a tipping point where quadratic time complexity is justifiable.
Second, during a configuration update, the XML data is evaluated in multiple
passes, which puts pressure on the efficiency of Genode's XML parser. This
pressure could in principle be relieved. Third, the process of taking
session-routing decisions involved XML parsing. In scenarios as sophisticated
as Sculpt, the routing rules can become quite elaborate. Since the rules are
consulted for each session route, the costs for the rule evaluations stack up.
Init optimizations
------------------
These realizations motivated us to replace the hand-crafted configuration
processing by the use of Genode's generic 'List_model' utility. This way, the
parsing follows a common formalism that makes the code easier to maintain and
to understand while reducing the XML parsing to a single pass. The increased
formality cleared the way for further optimizations. In particular, init
became able to skip the re-evaluation of the session routing whenever no
service is affected by the configuration change. This is actually the common
case in Sculpt.
To alleviate the costs for evaluating session routes, we introduced an
internal data model for the routing rules that is optimized for the matching
of routes. With this model, the detection of a definite mismatch (the common
case) comes down to a comparison of a single numeric value.
Combined, those optimizations yield a great effect. In a typical Sculpt
system, the time of a dynamic reconfiguration got reduced by factor 10 to the
order of 10 to 20 milliseconds. Hence, the visual stuttering we observed
during structural changes of the runtime are completely eliminated.
Besides the major optimization of init, we were able to shave off a few
milliseconds from the boot procedure here and there. For example, by deferring
the initialization of the real-time clock driver to its first use, we avoid a
potentially expensive active polling loop during the highly contended boot
phase. Another obvious heuristic improvement is the skipping of the GUI
handling until the framebuffer driver is up because all the nice pixels would
not be visible anyway.
Combined, these optimizations were able to reduce the boot time of Sculpt from
the entering of the kernel up to the graphical user interface down to only 2.3
seconds. The improved performance of init is impactful beyond Sculpt OS
because it is a central component of all Genode systems large and small.
Updated and new documentation
#############################
Genode Platforms
----------------
We are proud to introduce the first version of a new "Genode Platforms"
document, which complements the existing Genode Foundations book with
low-level hardware-related topics. It is primarily intended for integrators
and developers of device drivers.
: <div class="visualClear"><!-- --></div>
: <p>
: <div style="clear: both; float: left; margin-right:20px;">
: <a class="internal-link" href="https://genode.org">
: <img class="image-inline" src="https://genode.org/documentation/genode-platforms-title.png">
: </a>
: </div>
: </p>
In this first edition, the document features a practical guide for the steps
needed to bring Genode to a new ARM SoC. The content is based on the ongoing
Pine Fun article series at [https://genodians.org - Genodians.org].
We plan to continuously extend it with further practical topics as we go.
:Initial revision of the Genode Platforms document:
[https://genode.org/documentation/genode-platforms-21-05.pdf]
Genode Foundations
------------------
The "Genode Foundations" book received its annual update. It is available at
the [https://genode.org] website as a PDF document and an online version.
The most noteworthy additions and changes are:
: <div class="visualClear"><!-- --></div>
: <p>
: <div style="clear: both; float: left; margin-right:20px;">
: <a class="internal-link" href="https://genode.org">
: <img class="image-inline" src="https://genode.org/documentation/genode-foundations-title.png">
: </a>
: </div>
: </p>
* Adaptation to the re-stacked GUI stack introduced in
[https://genode.org/documentation/release-notes/20.08#The_GUI_stack__restacked - version 20.08]
* Coverage of the new uplink, capture, and event session interfaces
* Updated API documentation
: <div class="visualClear"><!-- --></div>
To examine the changes in detail, please refer to the book's
[https://github.com/nfeske/genode-manual/commits/master - revision history].
Base framework and OS-level infrastructure
##########################################
API refinements
===============
VFS-access utilities
--------------------
Low-complexity native Genode components do not depend on a C runtime. To allow
such components to still enjoy the power and flexibility of the Genode's VFS
infrastructure, we provide an evolving front-end API
[https://github.com/genodelabs/genode/blob/master/repos/os/include/os/vfs.h - os/vfs.h]
first introduced in version
[https://genode.org/documentation/release-notes/19.11#Virtual_file-system_infrastructure - 19.11].
The API is tailored and refined according to the relatively simple use cases
of low-complexity Genode components. The current release introduces a new
utility for the creation of new files, appropriately named 'New_file'. The
change is accompanied by a new 'Directory::create_sub_directory' method for
the easy creation of directory hierarchies.
Safeguarded arrays
------------------
To handle arrays in a safe and C++-like fashion, a new helper class has become
available at _base/include/util/array.h_. It accommodates an increasingly used
pattern where elements are dynamically added at construction time but stay the
same once the array is constructed.
Cosmetic changes
----------------
We refined the 'Range_allocator::alloc_aligned' interface to make it more
safe. The former 'from' and 'to' arguments are replaced by a single 'range'
argument. The distinction of the use cases of regular allocations vs.
address-constrained allocations is now covered by a dedicated overload instead
of relying on a default argument. The 'align' argument has been changed from
'int' to 'unsigned' to be better compatible with 'addr_t' and 'size_t'.
The 'Cache_attribute' type has been renamed to 'Cache'.
Input-event handling
====================
A central component for Genode's input-event handling functionality is the
event filter. It merges input events from multiple event sources and passes
them to the event sink (typically the GUI server). In between, it performs
low-level key remapping and applies character mapping rules. Character mapping
rules are essential for supporting different keyboard layouts (including
dead-key sequences). Low-level key remapping is, for instance, used for
changing the emitted key codes of the Num Pad keys according to the Num Lock
state. The different filter functionalities can be arbitrarily assembled into
a filter chain and provided as a dynamic config ROM to the event filter
component. The event sink then receives and processes the filtered events.
Some input devices emit unusual and/or extra key codes in certain situations,
which impedes the event sink's ability to detect key combos correctly. We
therefore added the functionality to completely mute certain key codes. In
order to ignore all unknown key codes for instance, we can now add an
'<ignore-key>' node to the config of the event filter.
! <remap>
! <ignore-key name="KEY_UNKNOWN"/>
! ...
! </remap>
Note, that '<ignore-key>' is part of the '<remap>' filter. The name attribute
refers to the low-level key name before any remapping rule has been applied.
As a second addition, we implemented a '<log>' filter that allows low-level
debugging of the event-filter component and its configuration. The '<log>'
filter can appear at each stage in the filter chain. For instance, we can log
the input events before and after the remap filter as follows.
! <log prefix="REMAPPED ">
! <remap>
! <log prefix="RAW ">
! ...
! </log>
! </remap>
! </log>
The optional 'prefix' attribute thereby helps to distinguish the log output
from different stages.
File-system helpers
===================
The
[https://genode.org/documentation/release-notes/18.08#New_component_for_querying_information_from_a_file_system - fs_query]
component is a simple helper to query information from a file system. E.g., it
is used by the file browser of Sculpt OS to obtain the directory structure.
The component received two welcomed improvements. First, directory content is
now reported in alphabetic order. Thereby, all consumers of the reports become
able to rely on deterministic output. For example, the file browser of Sculpt
OS, the launcher menu items, and the depot-selection items will appear in a
predictable way. Second, the size of files can be queried now. By adding an
attribute 'size="yes"' to a query, fs_query is instructed to report the size
of each queried file as attribute 'size' of the corresponding 'file' node.
Whereas fs_query inspects a file system without changing it, its sister
component fs_tool is able to perform file-system modifications. The new
version adds a '<new-file path="...">' operation, which writes the content of
the XML node into the file specified as 'path' attribute. The directory
structure leading to the file is implicitly created if needed. Should a file
with the specified name already exist, the original file will be overwritten.
Applications
############
File vault based on the CBE block encrypter
===========================================
Over several releases
([https://genode.org/documentation/release-notes/19.11#Preliminary_block-device_encrypter - 19.11],
[https://genode.org/documentation/release-notes/20.05#Feature-completeness_of_the_consistent_block_encrypter - 20.05],
[https://genode.org/documentation/release-notes/20.08#Consistent_Block_Encrypter - 20.08],
[https://genode.org/documentation/release-notes/20.11#Consistent_Block_Encrypter__CBE_ - 20.11]),
we persistently worked at a native solution for modern block encryption - the
SPARK-based CBE-library - and its integration into Genode's VFS. Even though,
this work was already suitable for real-world scenarios like
[https://genodians.org/m-stein/2020-06-12-cbe-linux-vm - hosting a Linux VM on top of an encrypted block device],
it still lacked stress-testing by a regular user base because its integration
into an end-user system - like Sculpt - required tedious low-level wizardry.
This situation had to change because we want to encourage as many people as
possible to expose the codebase around the CBE to their workflows and let it
mature. Therefore, we came up with a new package called file vault that can be
readily deployed on Sculpt OS. It is a graphical front end that aims at making
the creation, use, and maintenance of a CBE-based encrypted file store as
intuitive and secure as possible.
:Introducing the file vault:
[https://genodians.org/m-stein/2021-05-17-introducing-the-file-vault]
[image file_vault_setup]
The file vault only requires two file-system sessions from you (the trust
anchor is stored separately from the payload data). With that, it will
automatically create and connect a trust anchor, set up a CBE image, prepare
an ext2 FS on top of the CBE image and provide it through a file system
service - ready to be used like a simple directory. The directory can be
locked by closing the file vault and unlocked by starting the file vault on
the same trust anchor and entering the correct user passphrase. All controls
for the file vault's underlying CBE encrypter - like for its re-sizing and
re-keying functionality - are presented through a simple and guiding UI that
also provides you with the most relevant status information of your vault.
The file vault package is accompanied by some notable improvements regarding
CBE's key management. Whereas in the previous release, this aspect was still
merely a prototype with almost no protective value, the current implementation
embraces well-known algorithms to generate and encrypt the keys used within
the CBE respectively the file vault. This is explained in detail in the
aforementioned article.
As a note of caution, the primary purpose of the current version of the file
vault is to lift native block encryption in Genode from the development stage
to product quality. At the current stage, it is neither time-tested nor
reviewed by independent cryptography experts. Consequently, you should use it
with a healthy dose of suspicion, for non-critical data only! We would be more
than happy to receive feedback on your experience with the file vault.
VirtualBox
==========
Since the previous release, we continued the enablement of VirtualBox 6 on
Genode and put efforts into stabilizing the port. Therefore, we updated to
version 6.1.18 and reorganized the internal structure for a more
comprehensible execution model with fewer threads. Further, we improved
synchronization in multi-processor use cases and added a Sculpt runtime
package for vbox6.
Finally, as a little treat, our ports of VirtualBox now support to pass extra
buttons of five-button mice to the guest.
Device drivers
##############
Platform driver on ARM
======================
The current release streamlines Genode's API for interacting with the platform
driver on ARM platforms. It eases the access to memory-mapped I/O registers
and interrupts by introducing the notions of
:'Platform::Device': one device obtained from a platform session
:'Platform::Device::Mmio': locally-mapped MMIO registers of a device
:'Platform::Device::Irq': interface for receiving device interrupts
The API is covered in detail by the following article.
:One Platform driver to rule them all:
[https://genodians.org/nfeske/2021-04-29-platform-driver]
It goes without saying that this change touches most ARM-specific drivers.
Closely related, we also revised the concept of the XML based device-info
mechanism provided by the platform driver to accommodate both complex drivers
operating on multiple devices simultaneously such as driver stacks ported from
Linux as well as low-complexity drivers for simple devices. In the new
version, the device XML-information dataspace is only provided if the client's
session policy states 'info="yes"'. The format of the XML information got
refined to include the physical resource names (I/O memory and IRQ addresses)
instead of virtual IDs and page offsets and by using a 'type' attribute
instead of a '<compatible>' node to uniquely identify devices.
Changes specific to i.MX8
-------------------------
The platform driver incarnation specific to i.MX8 got slightly improved. It
can handle the configuration of reset-pins now. Analogously to the already
existent power domains, one can assign reset domains per device. Whenever a
device with a reset domain gets acquired, its reset-pins are de-asserted. When
the device gets released again, its reset-pins are asserted to put it into
reset state. A sample configuration looks as follows:
! <device name="mipi_dsi>
! <reset-domain name="mipi_dsi_pclk"/>
! ...
! </device>
Technically, those reset domains map to pin settings of the System Reset
Controller (SRC) that is part of the i.MX8 SoC. The SRC is under control of
the platform driver now. Currently, only the pins for the MIPI DSI Phy get
exported. They are used by the graphical subsystem to handle panels connected
via MIPI DSI.
I2C driver for i.MX8
====================
Thanks to Jean-Adrien Domage from [https://www.gapfruit.com - gapfruit], an
API for I2C bus transactions and a new I2C bus driver for the i.MX8 SoC
entered our framework. Coincidentally, the need to use the new I2C API more
intensively arose soon after his initial contribution. As a consequence, the
API got extended a bit. The result is a nice joint venture, and looks like the
following:
! void transmit(Transaction & t);
Hereby a 'Transaction' is a simple array of 'Message' objects, and a 'Message'
is an array of bytes that are either read or written. For very simple
use-cases, e.g., a client that polls single bytes from a temperature sensor,
some convenience utilities are incorporated into the 'I2c::Connection'.
USB
===
The USB-driver system has received quite a few refinements, performance
improvements, and robustness handling efforts during the current release
cycle. The HID subsystem is now capable of handling devices where the HID USB
interface is at an arbitrary location within the device descriptors - as
opposed to the assumption that the HID interface is always at the first
position in the interface list of the device. Also, the HID driver now handles
session destruction more gracefully and supports unlimited plug and unplug
events of an associated HID device.
For the USB host driver, various fixes of newer Linux kernel versions have
been back ported, which concern the handling of DMA memory. Error code and
timeout handling have been improved in order to support more corner cases, and
the USB session handles outstanding USB requests (synchronous and
asynchronous) on sudden session disconnects gracefully now.
The CPU usage of the host driver for isochronous transfers has been reduced
significantly for Intel XHCI controllers by adding a fix that reduces the
triggering of an interrupt for every completed isochronous packet to one
interrupt per eight packets, bringing the worst case scenario down to 1000
interrupts per second from a possible 8000 IRQs before.
NIC drivers
===========
Drivers for iPXE-supported Ethernet devices, Wifi adapters, and Linux TAP
devices now support the reporting of the MAC address of detected adapters.
The feature can be enabled by a '<report>' node in the driver configuration as
follows, prompting the driver to request a report session with the label
_devices_.
! <config>
! <report mac_address="true"/>
! </config>
The resulting report is depicted below.
! <devices>
! <nic mac_address="02:00:00:00:00:01"/>
! </devices>
Platforms
#########
Genode/Linux on 64-bit ARM
==========================
The release introduces the support for running the Linux version of Genode on
64-bit ARM platforms. As a part of this line of work, Genode's system call
bindings for Linux underwent a modernization to harmonize the system calls
across the supported CPU architectures. Furthermore, we took the opportunity
to simplify the use of the clone system call by eliminating the need for
passing a TLS pointer.
Expecting that the 64-bit Genode/Linux version will remain a niche use case of
Genode in the foreseeable future, we do not provide a pre-built tool chain.
Hence, as a preparatory step for using this version of Genode, the tool chain
must be built manually via Genode's _tool/tool_chain_ script.
As a known limitation, Genode's 'Trace::timestamp' function is not available
on this version of Genode because Linux prevents the user land from accessing
the cycle counter (pmccntr_el0). So the accuracy of timing is somewhat impeded
to the order of milliseconds. Also, the jitterentropy random-number generator
cannot be used.
Those limitations notwithstanding, one can successfully execute scenarios as
complex as _leitzentrale.run_. When using AARCH64 Linux as host, run scripts
can be executed with the same convenience as on Linux on a PC.
! $ make run/<script> KERNEL=linux BOARD=linux
Pine-A64-LTS single board computer
==================================
The current release continues
[https://genode.org/documentation/release-notes/21.02#Pine-A64-LTS_single_board_computer - our story]
of porting Genode to the
[https://pine64.com/product-category/pine-a64-ltslong-term-supply/ - Pine-A64-LTS]
board. We document the progress in great detail as we go.
# [https://genodians.org/nfeske/2021-03-05-pine-fun-testing - Kernel packaging and testing]
# [https://genodians.org/nfeske/2021-03-17-pine-fun-device-access - Device access from the user level]
# [https://genodians.org/nfeske/2021-04-29-platform-driver - One Platform driver to rule them all]
# [https://genodians.org/nfeske/2021-05-12-pine-fun-linux - Taking Linux out for a Walk]
# [https://genodians.org/nfeske/2021-05-19-pine-dts-pruning - Pruning device trees]
The accumulated material forms the basis for the evolving Genode Platforms
document introduced in Section [Updated and new documentation].
The code of this line of work is available at a dedicated repository:
:Genode board support for Allwinner SoCs:
[https://github.com/nfeske/genode-allwinner]
RISC-V
======
The support for the RISC-V architecture has further been developed into the
direction of a fully supported Genode platform. With this release, we wanted
to enable basic device driver support, which requires a working interrupt
controller. Since the "platform-level interrupt controller" (PLIC) is now
present on most hardware as well as on the Qemu emulator, we have added
support for the PLIC within our base-hw kernel.
With the interrupt controller in place, we implemented a driver for the
[https://opencores.org - OpenCores] Ethernet device as present on the
[https://hensoldt-cyber.com/mig-v - MiG-V] board. The driver component runs on
Qemu (with OpenCores enabled) as well as on the MiG-V board itself. Our RISC-V
board specific line of work can now be found within a separate
[https://github.com/ssumpf/genode-riscv - repository].
With driver support in place, the final step for full RISC-V support in Genode
is to extend our C library for this architecture.
Build system and tools
######################
Tool-chain update to GCC 10.3 and binutils 2.36
===============================================
About every two years, we update our tailored Genode tool chain to recent
versions. This year's update includes GCC 10.3.0, binutils 2.36.1 and GDB 10.2
together with their corresponding Genode libraries and tools (stdcxx, ADA
runtime, libsparkcrypto, gcov, sanitizer).
Feature-wise, changes are not as significant this time as with the
[https://genode.org/documentation/release-notes/19.05#Tool_chain_based_on_GCC_8.3.0_and_binutils_2.32 - previous update],
nevertheless we had to overcome some hurdles worth noting.
* The _gprbuild_ tool, which is needed to build the _ali2dep_
tool had a bug in the version provided by Ubuntu 18.04, which prevented it
from building _ali2dep_ with GCC/GNAT 10. To still be able to build the
tool chain on Ubuntu 18.04, the _gprbuild_ tool is now built from
source (of a newer version) when running the _tool_chain_ script.
* When building the tool chain on armhf Linux, errors occurred because
of mismatching float-abi compiler flags used when building the
dependency libraries (_gmp_, _mpc_, _mpfr_) with the host tool chain and
when building the Genode tool chain with the intermediate bootstrap
tool chain. To solve this problem, the dependency libraries are now
downloaded and built using the GCC build system. This also had the
effect that the _mpc_ and _mpfr_ Genode ports were not needed anymore
and got removed.
* GCC 10 reports more compile errors, which had to be fixed. The most common
errors related to narrowing conversions and potential unaligned pointers
from packed members.
* GCC 10 has the _-fno-common_ option set by default, which caused link
errors especially with some 3rd party ports.
* GCC 10 generated 'memset()' calls in implementations of 'memset()',
which caused stack overflows from this recursion.
* The ARM compiler generates more VFP instructions now, especially when
building for armv6, so we had to update the 'setjmp()' and 'longjmp()'
functions used by _dde_linux_ drivers to additionally save and restore the
FPU registers on ARM.
* With the new binutils version, linker sections with the same name in
multiple linker scripts are not merged anymore. Since we rely on this
behavior when building _core_ for NOVA, we reverted the corresponding change
with a patch.
* With the new binutils version, executable files are not allowed as input
when linking executable output files anymore. The build process of the
Fiasco.OC kernel relied on this behavior and needed to be adapted by the
upstream developers.
The new tool chain has not been enabled for RISC-V yet, because of an unsolved
issue on initialization (resp. initial relocation) of our dynamic linker.
Until we finalized the RISC-V support, we recommend using the tool chain
version 19.05 for this CPU architecture by adding the following two lines to
your build directory's _etc/tools.conf_.
! CROSS_DEV_PREFIX = /usr/local/genode/tool/19.05/bin/genode-riscv-
! REQUIRED_GCC_VERSION = 8.3.0
The updated tool chain can be built from source or downloaded in binary form
as described in this [https://genode.org/download/tool-chain - document].
Utilities for porting Linux drivers
===================================
Dummy-function generator
------------------------
While porting device drivers from the Linux kernel to Genode, one has to
tailor the environment that replaces the original kernel code. Thereby, tons
of missing function and variable implementations have to be written. Most of
them won't even be called by the driver under normal circumstances, but
nonetheless they are needed to link the executable binary.
The production of these dummy functions in the first place is a tiresome and
somewhat annoying work. To free developers from this burden, a new tool
entered the Genode framework under _tool/dde_linux/create_dummies_. Apart from
the creation of missing kernel functions and variables, it can also be used to
easily summarize all missing symbols during the porting work.
For a more detailed explanation of the new tool, please have a look at the
following article.
:Linux device driver ports - Breaking new ground:
[https://genodians.org/skalk/2021-04-08-dde-linux-experiments-1]
Device-tree source processing
-----------------------------
Device-tree source files as featured in the source tree of the Linux kernel
contain valuable information about the structure and parameters of SoCs and
boards. The porting and implementation of device drivers for Genode calls for
tooling that is able to extract and convert this information into digestible
forms. The current release introduces the first version of a new tool set at
_tools/dts/_ for this purpose.
[image dts_extract]
The tool aids the understanding of the hardware and allows for the pruning of
device trees down to a manageable complexity. As an illustration, the
spiderweb on the left shows the device-interdependencies of the Pine-A64-LTS
board. On the right, the device tree is pruned to cover only what's needed to
use Ethernet. The tool is covered in more detail by the following dedicated
article.
:Pruning device trees:
[https://genodians.org/nfeske/2021-05-19-pine-dts-pruning]
Cache for downloaded ports
==========================
When working with ports, it is not uncommon that a port hash is changed due to
some minor change like the addition of a patch. A subsequent call of
'prepare_port' would download the same files that were already downloaded
while preparing a previous version of the port even if the downloaded content
remains the same. This wastes internet bandwidth and developer time. The
current release introduces a simple cache for downloaded archives, which
alleviates these costs.
_Thanks to Tomasz Gajewski for his continuous contributions to improve our_
_development workflows._
Common hook for custom build rules
==================================
There are cases that call for building custom targets in addition to a regular
library or program. For example, the executable binary of an application may
be accompanied by generated data files. The creation of such build artifacts
can be expressed by custom make rules. However, a rule is triggered only if it
is a dependency of the build target. This can now be achieved by adding the
rule to the 'CUSTOM_TARGET_DEPS' variable. For example,
! CUSTOM_TARGET_DEPS += menu_view_styles.tar
!
! menu_view_styles.tar:
! $(VERBOSE)cd $(PRG_DIR); tar cf $(PWD)/bin/$@ styles
_Thanks to Tomasz Gajewski for this welcome contribution._

View File

@@ -1 +1 @@
2021-03-11 d5d038d82badefdb0ec442be4dc7b23064ad2831
2021-05-27 d8e59b010b60eba516a0e20b3aab18e05c85a977

View File

@@ -17,7 +17,6 @@
/* Genode includes */
#include <base/cache.h>
#include <base/ipc.h>
#include <base/stdint.h>
#include <base/native_capability.h>
#include <util/touch.h>
@@ -26,67 +25,12 @@
/* core includes */
#include <util.h>
#include <mapping.h>
/* L4/Fiasco includes */
#include <fiasco/syscall.h>
namespace Genode {
class Mapping;
class Ipc_pager;
}
class Genode::Mapping
{
private:
addr_t _dst_addr;
Fiasco::l4_fpage_t _fpage;
public:
/**
* Constructor
*/
Mapping(addr_t dst_addr, addr_t src_addr,
Cache_attribute cacheability, bool,
unsigned l2size, bool rw, bool)
:
_dst_addr(dst_addr),
_fpage(Fiasco::l4_fpage(src_addr, l2size, rw, false))
{
if (cacheability == WRITE_COMBINED)
_fpage.fp.cache = Fiasco::L4_FPAGE_BUFFERABLE;
}
/**
* Construct invalid flexpage
*/
Mapping() : _dst_addr(0), _fpage(Fiasco::l4_fpage(0, 0, 0, 0)) { }
Fiasco::l4_umword_t dst_addr() const { return _dst_addr; }
Fiasco::l4_fpage_t fpage() const { return _fpage; }
/**
* Prepare map operation
*
* On Fiasco, we need to map a page locally to be able to map it to
* another address space.
*/
void prepare_map_operation()
{
addr_t core_local_addr = _fpage.fp.page << 12;
size_t mapping_size = 1 << _fpage.fp.size;
for (addr_t i = 0; i < mapping_size; i += L4_PAGESIZE) {
if (_fpage.fp.write)
touch_read_write((unsigned char volatile *)(core_local_addr + i));
else
touch_read((unsigned char const volatile *)(core_local_addr + i));
}
}
};
namespace Genode { class Ipc_pager; }
class Genode::Ipc_pager

View File

@@ -29,6 +29,26 @@ using namespace Genode;
using namespace Fiasco;
/**
* Prepare map operation
*
* On Fiasco, we need to map a page locally to be able to map it to another
* address space.
*/
void Mapping::prepare_map_operation() const
{
addr_t const core_local_addr = src_addr;
size_t const mapping_size = 1UL << size_log2;
for (addr_t i = 0; i < mapping_size; i += L4_PAGESIZE) {
if (writeable)
touch_read_write((unsigned char volatile *)(core_local_addr + i));
else
touch_read((unsigned char const volatile *)(core_local_addr + i));
}
}
/***************
** Ipc_pager **
***************/
@@ -51,11 +71,13 @@ void Ipc_pager::wait_for_fault()
void Ipc_pager::reply_and_wait_for_fault()
{
l4_msgdope_t result;
l4_fpage_t const fpage { l4_fpage(_reply_mapping.src_addr,
_reply_mapping.size_log2,
_reply_mapping.writeable, false) };
l4_ipc_reply_and_wait(_last,
L4_IPC_SHORT_FPAGE, _reply_mapping.dst_addr(),
_reply_mapping.fpage().fpage, &_last,
l4_msgdope_t result;
l4_ipc_reply_and_wait(_last, L4_IPC_SHORT_FPAGE,
_reply_mapping.dst_addr, fpage.fpage, &_last,
L4_IPC_SHORT_MSG, &_pf_addr, &_pf_ip,
L4_IPC_SEND_TIMEOUT_0, &result);

View File

@@ -16,6 +16,7 @@
#include <base/allocator_avl.h>
#include <base/sleep.h>
#include <util/misc_math.h>
#include <util/xml_generator.h>
/* base-internal includes */
#include <base/internal/crt0.h>
@@ -466,6 +467,29 @@ Platform::Platform()
init_core_log(Core_log_range { core_local_addr, log_size } );
}
/* export platform specific infos */
{
void * phys_ptr = nullptr;
size_t const size = 1 << get_page_size_log2();
if (ram_alloc().alloc_aligned(size, &phys_ptr,
get_page_size_log2()).ok()) {
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
addr_t const core_local_addr = phys_addr;
region_alloc().remove_range(core_local_addr, size);
Genode::Xml_generator xml(reinterpret_cast<char *>(core_local_addr),
size, "platform_info", [&] ()
{
xml.node("kernel", [&] () { xml.attribute("name", "fiasco"); });
});
_rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, size,
"platform_info"));
}
}
}

View File

@@ -0,0 +1,15 @@
L4: enable GCC 10
diff --git a/l4/mk/Makeconf b/l4/mk/Makeconf
index eb59b51..a7b5955 100644
--- a/l4/mk/Makeconf
+++ b/l4/mk/Makeconf
@@ -52,7 +52,7 @@ L4_KIP_OFFS_SYS_DEBUGGER = 0x900
L4_STACK_ADDR ?= $(L4_STACK_ADDR_$(ARCH))
L4_STACK_SIZE ?= $(if $(L4_STACK_SIZE_MAIN_THREAD),$(L4_STACK_SIZE_MAIN_THREAD),0x8000)
-CC_WHITELIST-gcc := 4.7 4.8 4.9 5 6 7 8 9
+CC_WHITELIST-gcc := 4.7 4.8 4.9 5 6 7 8 9 10
CC_WHITELIST-clang := 3.5 3.6 3.7 3.8 3.9
# This is quite bad: There is no other chance to disable the page-alignedment

View File

@@ -0,0 +1,162 @@
From dd8842dbdae2bb11d4f726f8a49a6ecb4d5d6870 Mon Sep 17 00:00:00 2001
From: Frank Mehnert <frank.mehnert@kernkonzept.com>
Subject: [PATCH] Do not depend on any libstdc++ feature
The libc_minimal library does not provide support for libstdc++ so use
the normal libc headers instead and do not use any 'std' functions.
Change-Id: I9b4e04ddba0e3f366550265a2c30ef0f37df5534
---
server/src/boot_modules.cc | 2 +-
server/src/multiboot2.cc | 24 ++++++++++++------------
server/src/platform/exynos.cc | 2 +-
server/src/platform/x86_pc-base.h | 4 ++--
server/src/platform_common.cc | 2 +-
server/src/support.h | 4 ++--
6 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/server/src/boot_modules.cc b/server/src/boot_modules.cc
index 2446967..6100749 100644
--- a/server/src/boot_modules.cc
+++ b/server/src/boot_modules.cc
@@ -1,6 +1,6 @@
#include "support.h"
#include "panic.h"
-#include <cassert>
+#include <assert.h>
#include "mod_info.h"
#ifdef COMPRESS
#include "uncompress.h"
diff --git a/server/src/multiboot2.cc b/server/src/multiboot2.cc
index c7255a3..17a2fdd 100644
--- a/server/src/multiboot2.cc
+++ b/server/src/multiboot2.cc
@@ -18,7 +18,7 @@
#include <l4/sys/consts.h>
#include <l4/cxx/minmax>
-#include <cstring>
+#include <string.h>
#include <assert.h>
#include <stddef.h>
@@ -62,7 +62,7 @@ public:
// by some other tag type)
void process_modules(l4util_mb2_tag_t *tag)
{
- std::size_t cnt = 0;
+ size_t cnt = 0;
while (tag->type == L4UTIL_MB2_MODULE_INFO_TAG)
{
@@ -146,8 +146,8 @@ public:
void finalize()
{
assert(sizeof(_mbi) <= _size);
- std::memcpy(_buf, &_mbi, sizeof(_mbi));
- std::memset(_buf + sizeof(_mbi), 0, _size - sizeof(_mbi));
+ memcpy(_buf, &_mbi, sizeof(_mbi));
+ memset(_buf + sizeof(_mbi), 0, _size - sizeof(_mbi));
}
private:
@@ -157,25 +157,25 @@ private:
{
char buf[1024];
- std::size_t size = l4_round_size(tag->size, L4UTIL_MB2_TAG_ALIGN_SHIFT);
+ size_t size = l4_round_size(tag->size, L4UTIL_MB2_TAG_ALIGN_SHIFT);
l4util_mb2_tag_t *dst_tag =
reinterpret_cast<l4util_mb2_tag_t *>(end() - size);
char *_src = reinterpret_cast<char *>(tag);
while (size)
{
- std::size_t copied = cxx::min(sizeof(buf), size);
+ size_t copied = cxx::min(sizeof(buf), size);
char *_dst = end() - copied;
- std::memcpy(buf, _src, copied);
- std::memmove(_src, _src + copied, (end() - _src) - copied);
- std::memcpy(_dst, buf, copied);
+ memcpy(buf, _src, copied);
+ memmove(_src, _src + copied, (end() - _src) - copied);
+ memcpy(_dst, buf, copied);
size -= copied;
}
return dst_tag;
}
- void reserve_from_end(std::size_t size)
+ void reserve_from_end(size_t size)
{
size = l4_round_size(size, L4UTIL_MB2_TAG_ALIGN_SHIFT);
assert(_size >= size);
@@ -183,8 +183,8 @@ private:
}
char *_buf;
- std::size_t _size;
- const std::size_t _total_size;
+ size_t _size;
+ const size_t _total_size;
l4util_mb_info_t _mbi;
};
diff --git a/server/src/platform/exynos.cc b/server/src/platform/exynos.cc
index d10d70d..bcd6d02 100644
--- a/server/src/platform/exynos.cc
+++ b/server/src/platform/exynos.cc
@@ -17,7 +17,7 @@
#include "support.h"
#include <l4/drivers/uart_s3c2410.h>
-#include <cstdio>
+#include <stdio.h>
namespace {
class Platform_arm_exynos : public Platform_single_region_ram
diff --git a/server/src/platform/x86_pc-base.h b/server/src/platform/x86_pc-base.h
index d5d53bf..fe0e0dd 100644
--- a/server/src/platform/x86_pc-base.h
+++ b/server/src/platform/x86_pc-base.h
@@ -12,8 +12,8 @@
#include <l4/util/port_io.h>
#include <l4/cxx/static_container>
-#include <cassert>
-#include <cstdio>
+#include <assert.h>
+#include <stdio.h>
/** VGA console output */
diff --git a/server/src/platform_common.cc b/server/src/platform_common.cc
index 0503802..26ae0a9 100644
--- a/server/src/platform_common.cc
+++ b/server/src/platform_common.cc
@@ -1,6 +1,6 @@
#include "support.h"
#include <l4/cxx/minmax>
-#include <cassert>
+#include <assert.h>
#ifdef RAM_SIZE_MB
diff --git a/server/src/support.h b/server/src/support.h
index 472e40e..20d2c04 100644
--- a/server/src/support.h
+++ b/server/src/support.h
@@ -21,8 +21,8 @@
#include <l4/util/mb_info.h>
#include <stdio.h>
#include "region.h"
-#include <cstring>
-#include <cstdlib>
+#include <string.h>
+#include <stdlib.h>
L4::Uart *uart();
void set_stdio_uart(L4::Uart *uart);

View File

@@ -0,0 +1,25 @@
From a4d6d7877c0050308a9c28308fa8a233c86902e1 Mon Sep 17 00:00:00 2001
From: Alexander Warg <alexander.warg@kernkonzept.com>
Date: Mon, 29 Jul 2019 00:00:00 +0000
Subject: [PATCH] Fix amd64 build with binutils 2.32+
We have to make sure that a linker script is not given twice to ld.
Change-Id: Ibd0f8972083f665fb7824df2a65b319183d7b1e7
---
server/src/Make.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/src/Make.rules b/server/src/Make.rules
index 43e8775..c1bbfec 100644
--- a/server/src/Make.rules
+++ b/server/src/Make.rules
@@ -439,7 +439,7 @@ $(OBJ_DIR)/ARCH-amd64/libc32/OBJ-$(ARCH)_$(CPU)/libc32.a: FORCE
bootstrap32.elf: $(OBJ32) bootstrap32.bin $(SRC_DIR)/ARCH-amd64/boot32/bootstrap32.ld $(OBJ_DIR)/ARCH-amd64/libc32/OBJ-$(ARCH)_$(CPU)/libc32.a
@$(LINK_MESSAGE)
$(VERBOSE)$(CC32) -o $@ -nostdlib -static \
- -Wl,-T,$(SRC_DIR)/ARCH-amd64/boot32/bootstrap32.ld,--gc-sections $^ -lgcc
+ -Wl,-T,$(SRC_DIR)/ARCH-amd64/boot32/bootstrap32.ld,--gc-sections $(filter-out %/bootstrap32.ld,$^) -lgcc
$(VERBOSE)chmod 755 $@
bootstrap: bootstrap32.elf

View File

@@ -0,0 +1,15 @@
FOC: enable GCC 10
diff --git a/src/Makeconf b/src/Makeconf
index de5b656..7660daa 100644
--- a/src/Makeconf
+++ b/src/Makeconf
@@ -244,7 +244,7 @@ ifeq ($(CC_TYPE),gcc)
endif
-CC_WHITELIST-gcc := 4.7 4.8 4.9 5 6 7 8 9
+CC_WHITELIST-gcc := 4.7 4.8 4.9 5 6 7 8 9 10
CC_WHITELIST-clang := 3.6 3.7 3.8 3.9 4.0 5.0 6.0 7.0 8.0 9.0
CC_WHITELIST := $(CC_WHITELIST-$(CC_TYPE))

View File

@@ -0,0 +1,234 @@
From f29031cdbe8cebf6c39d02a72dd50c736cec3a69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Jerm=C3=A1=C5=99?= <jakub.jermar@kernkonzept.com>
Subject: [PATCH] amd64: Split _syscall_entry into code and data
This change makes the entire syscall entry table smaller, sparing 32
bytes per a statically configured CPU. Note that some padding is still
used to achieve cacheline alignment of the per-CPU entries of the data
part of the table.
Furthemore, by moving the two data members into a data section and
allowing to modify the handler offset from JDB only, the amd64 kernel is
easier to make completely W^X in the future. The handler entry offset
remains a part of the jump instruction opcode (there is no data
indirection) and JDB is enhanced to be able to patch it when needed.
Change-Id: I22b91f9fd2b108d99e3ceea6611a15ab3db26bb6
Edit for Genode: UX changes not included because of more dependencies
---
src/jdb/ia32/jdb_trace_set-ia32-ux.cpp | 4 +-
src/kern/ia32/64/cpu-64.cpp | 31 +++++-------------
src/kern/ia32/64/entry.S | 29 +++++++++++++++++
src/kern/ia32/64/syscall_entry.cpp | 54 +++++---------------------------
4 files changed, 48 insertions(+), 70 deletions(-)
diff --git a/src/jdb/ia32/jdb_trace_set-ia32-ux.cpp b/src/jdb/ia32/jdb_trace_set-ia32-ux.cpp
index ec23322..0a2f309 100644
--- a/src/jdb/ia32/jdb_trace_set-ia32-ux.cpp
+++ b/src/jdb/ia32/jdb_trace_set-ia32-ux.cpp
@@ -39,7 +39,7 @@ Jdb_set_trace::set_ipc_vector()
Idt::set_entry(0x30, (Address) int30_entry, true);
Jdb::on_each_cpu([fast_entry](Cpu_number cpu){
- Cpu::cpus.cpu(cpu).set_fast_entry(fast_entry);
+ //Cpu::cpus.cpu(cpu).set_fast_entry(fast_entry);
});
if (Jdb_ipc_trace::_trace)
@@ -98,7 +98,7 @@ struct Jdb_ipc_log_pm : Pm_object
else
fast_entry = entry_sys_fast_ipc_c;
- Cpu::cpus.cpu(cpu).set_fast_entry(fast_entry);
+ //Cpu::cpus.cpu(cpu).set_fast_entry(fast_entry);
}
void pm_on_suspend(Cpu_number) override {}
diff --git a/src/kern/ia32/64/cpu-64.cpp b/src/kern/ia32/64/cpu-64.cpp
index 974c677..d18ad16 100644
--- a/src/kern/ia32/64/cpu-64.cpp
+++ b/src/kern/ia32/64/cpu-64.cpp
@@ -4,7 +4,8 @@ INTERFACE [amd64 && !kernel_isolation]:
EXTENSION class Cpu
{
- static Per_cpu_array<Syscall_entry> _syscall_entry;
+ static Per_cpu_array<Syscall_entry_data>
+ _syscall_entry_data asm("syscall_entry_data");
};
@@ -13,14 +14,7 @@ IMPLEMENTATION[amd64 && !kernel_isolation]:
#include "mem_layout.h"
#include "tss.h"
-Per_cpu_array<Syscall_entry> Cpu::_syscall_entry;
-
-PUBLIC
-void
-Cpu::set_fast_entry(void (*func)())
-{
- _syscall_entry[id()].set_entry(func);
-}
+Per_cpu_array<Syscall_entry_data> Cpu::_syscall_entry_data;
IMPLEMENT inline NEEDS["tss.h"]
Address volatile &
@@ -31,11 +25,13 @@ PUBLIC inline
void
Cpu::setup_sysenter()
{
+ extern Per_cpu_array<Syscall_entry_text> syscall_entry_text;
+
wrmsr(0, GDT_CODE_KERNEL | ((GDT_CODE_USER32 | 3) << 16), MSR_STAR);
- wrmsr((Unsigned64)&_syscall_entry[id()], MSR_LSTAR);
- wrmsr((Unsigned64)&_syscall_entry[id()], MSR_CSTAR);
+ wrmsr((Unsigned64)&syscall_entry_text[id()], MSR_LSTAR);
+ wrmsr((Unsigned64)&syscall_entry_text[id()], MSR_CSTAR);
wrmsr(~0U, MSR_SFMASK);
- _syscall_entry[id()].set_rsp((Address)&kernel_sp());
+ _syscall_entry_data[id()].set_rsp((Address)&kernel_sp());
}
IMPLEMENTATION[amd64 && kernel_isolation]:
@@ -43,16 +39,6 @@ IMPLEMENTATION[amd64 && kernel_isolation]:
#include "mem_layout.h"
#include "tss.h"
-PUBLIC
-void
-Cpu::set_fast_entry(void (*func)())
-{
- extern char const syscall_entry_code[];
- extern char const syscall_entry_reloc[];
- auto ofs = syscall_entry_reloc - syscall_entry_code + 3; // 3 byte movebas
- *reinterpret_cast<Signed32 *>(Mem_layout::Mem_layout::Kentry_cpu_page + ofs + 0xa0) = (Signed32)(Signed64)func;
-}
-
PUBLIC inline
void
Cpu::setup_sysenter() const
@@ -78,7 +64,6 @@ Cpu::init_sysenter()
{
setup_sysenter();
wrmsr(rdmsr(MSR_EFER) | 1, MSR_EFER);
- set_fast_entry(entry_sys_fast_ipc_c);
}
diff --git a/src/kern/ia32/64/entry.S b/src/kern/ia32/64/entry.S
index 1cb8137..ed5a04c 100644
--- a/src/kern/ia32/64/entry.S
+++ b/src/kern/ia32/64/entry.S
@@ -372,7 +372,36 @@ entry_\name:
jmp all_syscalls
.endm
+#ifndef CONFIG_KERNEL_ISOLATION
+#ifdef CONFIG_MP
+MAX_NUM_CPUS = CONFIG_MP_MAX_CPUS
+#else
+MAX_NUM_CPUS = 1
+#endif
+
+#define SYSCALL_ENTRY_DATA_SIZE 64
+#define SYSCALL_ENTRY_TEXT_SIZE (0f - 0b)
+#define SYSCALL_ENTRY_OFFSET ((0b - syscall_entry_text) / SYSCALL_ENTRY_TEXT_SIZE)
+#define SYSCALL_ENTRY_DATA (syscall_entry_data + SYSCALL_ENTRY_OFFSET * SYSCALL_ENTRY_DATA_SIZE)
+#define KERN_SP (SYSCALL_ENTRY_DATA + 0)
+#define USER_SP (SYSCALL_ENTRY_DATA + 8)
.section ".entry.text.syscalls", "ax", @progbits
+ .global syscall_entry_text
+ .align 64
+syscall_entry_text:
+.rept MAX_NUM_CPUS
+0:
+ mov %rsp, USER_SP(%rip)
+ mov KERN_SP(%rip), %rsp
+ mov (%rsp), %rsp
+ pushq $GDT_DATA_USER | 3
+ pushq USER_SP(%rip)
+ jmp entry_sys_fast_ipc_c
+ .align 32
+0:
+.endr
+#endif /* !CONFIG_KERNEL_ISOLATION */
+
.p2align 4
.type all_syscalls,@function
all_syscalls:
diff --git a/src/kern/ia32/64/syscall_entry.cpp b/src/kern/ia32/64/syscall_entry.cpp
index b03d1ad..3dd7db3 100644
--- a/src/kern/ia32/64/syscall_entry.cpp
+++ b/src/kern/ia32/64/syscall_entry.cpp
@@ -2,58 +2,22 @@ INTERFACE [amd64]:
#include "types.h"
-class Syscall_entry
+class Syscall_entry_data
{
-private:
- template<int INSN_LEN>
- struct Mem_insn
- {
- Unsigned32 _insn:INSN_LEN * 8;
- Unsigned32 _offset;
- Mem_insn(Unsigned32 insn, void *mem)
- : _insn(insn),
- _offset((Address)mem - (Address)(&_offset + 1))
- {}
- } __attribute__((packed));
-
- Mem_insn<3> _mov_rsp_user_sp;
- Mem_insn<3> _mov_kern_sp_rsp;
- Unsigned32 _mov_rsp_rsp;
- Unsigned8 _push_ss, _ss_value;
- Mem_insn<2> _push_user_rsp;
- Unsigned8 _jmp;
- Signed32 _entry_offset;
- Unsigned8 _pading[33]; // pad to the next 64 byte boundary
- Unsigned64 _kern_sp;
- Unsigned64 _user_sp;
-} __attribute__((packed, aligned(64)));
+ Unsigned64 _kern_sp = 0;
+ Unsigned64 _user_sp = 0;
+} __attribute__((packed, aligned(64))); // Enforce cacheline alignment
+struct Syscall_entry_text
+{
+ char _res[32]; // Keep this in sync with code in syscall_entry_text!
+} __attribute__((packed, aligned(32)));
IMPLEMENTATION [amd64]:
-#include "config_gdt.h"
-
-PUBLIC inline NEEDS["config_gdt.h"]
-Syscall_entry::Syscall_entry()
-: /* mov %rsp, _user_sp(%rip) */ _mov_rsp_user_sp(0x258948, &_user_sp),
- /* mov _kern_sp(%rip), %rsp */ _mov_kern_sp_rsp(0x258b48, &_kern_sp),
- /* mov (%rsp), %rsp */ _mov_rsp_rsp(0x24248b48),
- /* pushq GDT_DATA_USER | 3 */ _push_ss(0x6a), _ss_value(GDT_DATA_USER | 3),
- /* pushq _user_sp(%rip) */ _push_user_rsp(0x35ff, &_user_sp),
- /* jmp *_entry_offset */ _jmp(0xe9)
-{}
-
-PUBLIC inline
-void
-Syscall_entry::set_entry(void (*func)(void))
-{
- _entry_offset = (Address)func
- - ((Address)&_entry_offset + sizeof(_entry_offset));
-}
-
PUBLIC inline
void
-Syscall_entry::set_rsp(Address rsp)
+Syscall_entry_data::set_rsp(Address rsp)
{
_kern_sp = rsp;
}

View File

@@ -0,0 +1,94 @@
ARM: link bootstrap as ET_REL not ET_EXEC
From: Frank Mehnert <frank.mehnert@kernkonzept.com>
Support for linking of ET_EXEC section was deprecated in binutils 2.35
and dropped in binutils 2.36.
Instead, extract the raw section of the fully linked bootstrap object
and create a relocatable object which can be linked to the kernel. The
required symbols for the linker are extracted separately.
Fixes ticket #CD-301.
Change-Id: I0cdc2aacb5dbd01677d93e2bb1103940ac60e848
Edit: fixed merge error for Genode
---
src/Makeconf.arm | 6 ++++++
src/kern/arm/Makerules.KERNEL | 20 ++++++++++++++++----
src/kernel.arm.ld | 4 ++--
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/src/Makeconf.arm b/src/Makeconf.arm
index 7c66a8d..89b9e7d 100644
--- a/src/Makeconf.arm
+++ b/src/Makeconf.arm
@@ -31,3 +31,9 @@ LDFLAGS += $(LDFLAGS-y)
LD_EMULATION_CHOICE-$(CONFIG_BIT32) := armelf armelf_linux_eabi armelf_fbsd
LD_EMULATION_CHOICE-$(CONFIG_BIT64) := aarch64linux aarch64elf
LD_EMULATION_CHOICE := $(LD_EMULATION_CHOICE-y)
+OBJCOPY_BFDNAME-$(CONFIG_BIT32) := elf32-littlearm
+OBJCOPY_BFDNAME-$(CONFIG_BIT64) := elf64-littleaarch64
+OBJCOPY_BFDNAME := $(OBJCOPY_BFDNAME-y)
+OBJCOPY_BFDARCH-$(CONFIG_BIT32) := arm
+OBJCOPY_BFDARCH-$(CONFIG_BIT64) := aarch64
+OBJCOPY_BFDARCH := $(OBJCOPY_BFDARCH-y)
diff --git a/src/kern/arm/Makerules.KERNEL b/src/kern/arm/Makerules.KERNEL
index d706444..fae3013 100644
--- a/src/kern/arm/Makerules.KERNEL
+++ b/src/kern/arm/Makerules.KERNEL
@@ -21,16 +21,28 @@ bootstrap_ldflags += -T$(bootstrap_lds)
bootstrap_export = _start start_of_loader end_of_bootstrap_info
bootstrap_strip = --strip-all $(addprefix --keep-symbol=,$(bootstrap_export))
+bootstrap_syms = end_of_bootstrap_info|_start|start_of_loader
+bootstrap_sed = 's/^0*([0-9a-f]*) [a-zA-Z] ($(bootstrap_syms))/\2 = 0x\1;/p'
bootstrap.$(KERNEL).pre.o: $(OBJ_BOOTSTRAP) $(LIBGCC) $(bootstrap_lds)
$(LINK_MESSAGE)
$(VERBOSE)$(LD) $(bootstrap_ldflags) $(OBJ_BOOTSTRAP) $(LIBGCC) -o $@
-bootstrap.$(KERNEL).o: bootstrap.$(KERNEL).pre.o
- $(LINK_MESSAGE)
- $(VERBOSE)$(OBJCOPY) $(bootstrap_strip) $< $@
+bootstrap.$(KERNEL).bin: bootstrap.$(KERNEL).pre.o
+ $(COMP_MESSAGE)
+ $(VERBOSE)$(OBJCOPY) -O binary --only-section=.bootstrap.text $< $@
+
+bootstrap.$(KERNEL).rel: bootstrap.$(KERNEL).bin
+ $(COMP_MESSAGE)
+ $(VERBOSE)$(OBJCOPY) -I binary -O $(OBJCOPY_BFDNAME) -B $(OBJCOPY_BFDARCH) \
+ --rename-section .data=.bootstrap.text $< $@
+
+# The linker will treat this file as linker script.
+bootstrap.$(KERNEL).sym: bootstrap.$(KERNEL).pre.o
+ $(COMP_MESSAGE)
+ $(VERBOSE)$(NM) $< | sed -n -E $(bootstrap_sed) > $@
-$(KERNEL).image: kernel.arm.lds $(CRT0) bootstrap.$(KERNEL).o $(OBJ_KERNEL_noboot) $(JDB) $(LIBK) $(KERNEL_EXTRA_LIBS) $(LIBDISASM) $(ABI) libdrivers.a $(LIBUART) $(CXXLIB) $(MINILIBC) $(LIBGCC) $(MINILIBC) libgluedriverslibc.a
+$(KERNEL).image: kernel.arm.lds $(CRT0) bootstrap.$(KERNEL).rel bootstrap.$(KERNEL).sym $(OBJ_KERNEL_noboot) $(JDB) $(LIBK) $(KERNEL_EXTRA_LIBS) $(LIBDISASM) $(ABI) libdrivers.a $(LIBUART) $(CXXLIB) $(MINILIBC) $(LIBGCC) $(MINILIBC) libgluedriverslibc.a
$(LINK_MESSAGE)
$(VERBOSE)$(LD) $(LDFLAGS) -m $(LD_EMULATION) $(KERNEL_LDFLAGS) -N -defsym kernel_load_addr=$(CONFIG_KERNEL_LOAD_ADDR) \
-T $< -o $@ $(filter-out $<,$+)
diff --git a/src/kernel.arm.ld b/src/kernel.arm.ld
index 1e3ec75..86c16b3 100644
--- a/src/kernel.arm.ld
+++ b/src/kernel.arm.ld
@@ -61,14 +61,14 @@ SECTIONS {
. = kernel_load_addr + 0x1000;
- .text : {
+ .text kernel_load_addr + 0x1000 : {
MWORD(_start_kernel)
MWORD(my_kernel_info_page)
KEEP(*(.bootstrap.info))
ASSERT (ABSOLUTE(.) == end_of_bootstrap_info, "invalid size of bootstrap.info");
. = ABSOLUTE(start_of_loader);
- *(.bootstrap.text)
+ KEEP(*(.bootstrap.text))
} :bstrap
. = ALIGN(4K);

View File

@@ -1 +1 @@
2e8cbb44d4c009238d96b66a9fc085e038f22e61
abe2de76835f33297ca4e4ac687e69bc04f83dc5

View File

@@ -37,5 +37,11 @@ PATCH_OPT(patches/0014-Always-enable-user-mode-access-for-performance-monit.patc
PATCH_OPT(patches/0015-VMX-disable-event-injection-if-requested-by-VMM.patch) := -p3 -d${DIR(foc)}
PATCH_OPT(patches/0016-svm-provide-cr0-to-guest-if-np-enabled.patch) := -p3 -d${DIR(foc)}
PATCH_OPT(patches/0017-svm-avoid-forceful-exit-on-task-switch.patch) := -p3 -d${DIR(foc)}
PATCH_OPT(patches/0018-L4-enable-gcc_10.patch) := -p2 -d${DIR(mk)}
PATCH_OPT(patches/0019-Bootstrap-do-not-depend-on-any-libstdcxx-feature.patch) := -p1 -d${DIR(bootstrap)}
PATCH_OPT(patches/0020-Bootstrap-fix-amd64-build-with-binutils-2_32.patch) := -p1 -d${DIR(bootstrap)}
PATCH_OPT(patches/0021-FOC-enable-gcc_10.patch) := -p1 -d${DIR(foc)}
PATCH_OPT(patches/0022-FOC-amd64-split-_syscall_entry-into-code-and-data.patch) := -p1 -d${DIR(foc)}
PATCH_OPT(patches/0023-FOC-arm-link-bootstrap-as-et_rel.patch) := -p1 -d${DIR(foc)}
$(call check_tool,gawk)

View File

@@ -1 +1 @@
2021-03-11 c1f7d1de07d3a55d5e43f6ab5fb67b502ab1d0bb
2021-05-27 8cfe2fe4913b79b6b58ae5dc1e47e4c96881b9fb

View File

@@ -1 +1 @@
2021-03-11 9383498670ce6668c8b99da3e62008b21a5932aa
2021-05-27 af377c6c3dcc0adcd59cd2e8668f47bdcc12d4c1

View File

@@ -1 +1 @@
2021-03-11 50104241d20d23e928d3b27d0931d14112c68e82
2021-05-27 475462d2565c1eb0cb0df6c3ba4f58007f73ac04

View File

@@ -1 +1 @@
2021-03-11 43cc39f70c8bfe4df3427c94d096d7e218b7b24c
2021-05-27 778e2a540f54b8164db8f459931211964cafeb58

View File

@@ -1 +1 @@
2021-03-11 742459157b61720e96c17bb6cfbf7ac085a4df2f
2021-05-27 d977d90dd21a266a9325b355da80def7bf26cd0f

View File

@@ -16,7 +16,6 @@
#define _CORE__INCLUDE__IPC_PAGER_H_
/* Genode includes */
#include <base/cache.h>
#include <base/ipc.h>
#include <base/stdint.h>
#include <base/native_capability.h>
@@ -28,67 +27,15 @@
/* base-internal includes */
#include <base/internal/native_thread.h>
/* core-local includes */
#include <mapping.h>
/* Fiasco.OC includes */
#include <foc/syscall.h>
namespace Genode {
class Mapping;
class Ipc_pager;
}
namespace Genode { class Ipc_pager; }
class Genode::Mapping
{
private:
addr_t _dst_addr;
Foc::l4_fpage_t _fpage { };
Cache_attribute _cacheability;
bool _iomem;
public:
/**
* Constructor
*/
Mapping(addr_t dst_addr, addr_t src_addr,
Cache_attribute c, bool io_mem,
unsigned log2size, bool write, bool executable)
:
_dst_addr(dst_addr), _cacheability(c), _iomem(io_mem)
{
typedef Foc::L4_fpage_rights Rights;
Rights rights = ( write && executable) ? Foc::L4_FPAGE_RWX :
( write && !executable) ? Foc::L4_FPAGE_RW :
(!write && !executable) ? Foc::L4_FPAGE_RO :
Foc::L4_FPAGE_RX;
_fpage = Foc::l4_fpage(src_addr, log2size, rights);
}
/**
* Construct invalid flexpage
*/
Mapping() : _dst_addr(0), _fpage(Foc::l4_fpage_invalid()),
_cacheability(UNCACHED), _iomem(false) { }
Foc::l4_umword_t dst_addr() const { return _dst_addr; }
bool grant() const { return false; }
Foc::l4_fpage_t fpage() const { return _fpage; }
Cache_attribute cacheability() const { return _cacheability; }
bool iomem() const { return _iomem; }
/**
* Prepare map operation is not needed on Fiasco.OC, since we clear the
* dataspace before this function is called.
*/
void prepare_map_operation() { }
};
/**
* Special paging server class
*/
class Genode::Ipc_pager : public Native_capability
{
public:
@@ -97,14 +44,14 @@ class Genode::Ipc_pager : public Native_capability
private:
Native_thread _last { }; /* origin of last fault */
addr_t _pf_addr { 0 }; /* page-fault address */
addr_t _pf_ip { 0 }; /* ip of faulter */
Mapping _reply_mapping { }; /* page-fault answer */
unsigned long _badge; /* badge of faulting thread */
Native_thread _last { }; /* origin of last fault */
addr_t _pf_addr { 0 }; /* page-fault address */
addr_t _pf_ip { 0 }; /* ip of faulter */
Mapping _reply_mapping { }; /* page-fault answer */
unsigned long _badge; /* badge of faulting thread */
Foc::l4_msgtag_t _tag { }; /* receive message tag */
Foc::l4_exc_regs_t _regs { }; /* exception registers */
Msg_type _type { PAGEFAULT };
Msg_type _type { PAGEFAULT };
void _parse_msg_type(void);
void _parse_exception(void);

View File

@@ -29,6 +29,13 @@ using namespace Genode;
using namespace Foc;
/*
* There is no preparation needed because the entire physical memory is known
* to be mapped within core.
*/
void Mapping::prepare_map_operation() const { }
void Ipc_pager::_parse(unsigned long label)
{
_badge = label & ~0x3;
@@ -94,31 +101,35 @@ void Ipc_pager::reply_and_wait_for_fault()
l4_umword_t label;
l4_msgtag_t snd_tag = l4_msgtag(0, 0, 1, 0);
l4_umword_t grant = _reply_mapping.grant() ? L4_MAP_ITEM_GRANT : 0;
l4_utcb_mr()->mr[0] = _reply_mapping.dst_addr() | L4_ITEM_MAP | grant;
l4_utcb_mr()->mr[0] = _reply_mapping.dst_addr | L4_ITEM_MAP;
switch (_reply_mapping.cacheability()) {
bool const bufferable = !_reply_mapping.io_mem || _reply_mapping.write_combined;
case WRITE_COMBINED:
l4_utcb_mr()->mr[0] |= L4_FPAGE_BUFFERABLE << 4;
break;
l4_fpage_cacheability_opt_t const
cacheability = _reply_mapping.cached ? L4_FPAGE_CACHEABLE
: bufferable ? L4_FPAGE_BUFFERABLE
: L4_FPAGE_UNCACHEABLE;
case CACHED:
l4_utcb_mr()->mr[0] |= L4_FPAGE_CACHEABLE << 4;
break;
l4_utcb_mr()->mr[0] |= cacheability << 4;
case UNCACHED:
if (!_reply_mapping.iomem())
l4_utcb_mr()->mr[0] |= L4_FPAGE_BUFFERABLE << 4;
else
l4_utcb_mr()->mr[0] |= L4_FPAGE_UNCACHEABLE << 4;
break;
}
l4_utcb_mr()->mr[1] = _reply_mapping.fpage().raw;
auto rights = [] (bool writeable, bool executable)
{
if ( writeable && executable) return L4_FPAGE_RWX;
if ( writeable && !executable) return L4_FPAGE_RW;
if (!writeable && !executable) return L4_FPAGE_RO;
return L4_FPAGE_RX;
};
l4_fpage_t const fpage = l4_fpage(_reply_mapping.src_addr,
_reply_mapping.size_log2,
rights(_reply_mapping.writeable,
_reply_mapping.executable));
l4_utcb_mr()->mr[1] = fpage.raw;
_tag = l4_ipc_send_and_wait(_last.kcap, l4_utcb(), snd_tag,
&label, L4_IPC_SEND_TIMEOUT_0);
int err = l4_ipc_error(_tag, l4_utcb());
int const err = l4_ipc_error(_tag, l4_utcb());
if (err) {
error("Ipc error ", err, " in pagefault from ", Hex(label & ~0x3));
wait_for_fault();
@@ -139,7 +150,7 @@ void Ipc_pager::acknowledge_wakeup()
void Ipc_pager::acknowledge_exception()
{
_regs = *l4_utcb_exc();
*l4_utcb_exc() = _regs;
l4_cap_idx_t dst = Foc::Capability::valid(_last.kcap)
? _last.kcap : (l4_cap_idx_t)L4_SYSF_REPLY;
Foc::l4_msgtag_t const msg_tag =

View File

@@ -493,7 +493,11 @@ Platform::Platform()
pages << get_page_size_log2(),
"platform_info", [&] ()
{
xml.node("kernel", [&] () { xml.attribute("name", "foc"); });
xml.node("kernel", [&] () {
xml.attribute("name", "foc");
xml.attribute("acpi", true);
xml.attribute("msi" , true);
});
xml.node("hardware", [&] () {
_setup_platform_info(xml, sigma0_map_kip()); });

View File

@@ -1 +1 @@
2021-03-11 5f70d9ee12b71eeda56fed778219365271c78934
2021-05-27 602a4250ab4812d355255f87600ae5b2d058ff6c

View File

@@ -1 +1 @@
2021-03-11 d370add0c416bc0f2e7ae83de6d2f10f9ea59823
2021-05-27 5a92bddc377068791d0eb704411e8f64f408b7a3

View File

@@ -1 +1 @@
2021-03-11 be82a7e08f0a16f93f689b8d3d747ea90fab396f
2021-05-27 03207ecbb46d304aecf94b491dd7f5f18434a3ba

View File

@@ -1 +1 @@
2021-03-11 0f3db9a963d53504843478924551bc619667d8d4
2021-05-27 e561b3c3024c5e66fc47a14741ad51f94772023d

View File

@@ -1 +1 @@
2021-03-28 d4983186c11a48fecfc87fbc15f16f6bb45d91e5
2021-05-27 a45306f7af1fbe6b5414fc79d6d7df72d90cc051

View File

@@ -1 +1 @@
2021-03-11 8176ee1808ba28e0e84ad00154d88ecf8d0cbfff
2021-05-27 0e52b14f12fb8387836c1d282c5b3bdd43308a33

View File

@@ -1 +1 @@
2021-03-11 76290d876f3ca43436d7cfd0558b264be0aac69a
2021-05-27 04b1d602e9705d398191f25bd5650df55e02d15e

View File

@@ -1 +1 @@
2021-03-11 b399a660467f8107c0297cb502f80f64432d6ef6
2021-05-27 6a261650e7781a3fe05b2884c3222c4a684989b9

View File

@@ -1 +1 @@
2021-03-11 6bc53d97397ed97bd275b81a4af771e59f0a29db
2021-05-27 6a7d93057760db316c708ed862f57552e1d30076

View File

@@ -1 +1 @@
2021-03-11 37a51e7eeed1c8902b6a12a7e6f9ba0c4857fb45
2021-05-27 f297a9e79ff7645be095431c9b4d8a6caeea84e3

View File

@@ -1 +1 @@
2021-03-11 d722eae5ebbafea313995f3443f903c0c965be9f
2021-05-27 a461ab6e948dd5d96a908bec57a9eecbf7088f3b

View File

@@ -1 +1 @@
2021-03-11 06c48030f17bcd7ba888145b208e27146c6ea687
2021-05-27 f2aa981b5a6eee8a4f246b2f03c785558e001f09

View File

@@ -1 +1 @@
2021-03-11 7eed185acd78e556e5cc69ecd1db6ce43a724238
2021-05-27 c2d6204ae3de07ef6bca3aceacb7cc0df6b8939a

View File

@@ -175,7 +175,7 @@ Platform::Platform()
using namespace Genode;
/* prepare the ram allocator */
board.early_ram_regions.for_each([this] (Memory_region const & region) {
board.early_ram_regions.for_each([this] (unsigned, Memory_region const & region) {
ram_alloc.add(region); });
ram_alloc.remove(bootstrap_region);
@@ -207,6 +207,6 @@ Platform::Platform()
/* add all left RAM to bootinfo */
ram_alloc.for_each_free_region([&] (Memory_region const & r) {
bootinfo.ram_regions.add(r); });
board.late_ram_regions.for_each([&] (Memory_region const & r) {
board.late_ram_regions.for_each([&] (unsigned, Memory_region const & r) {
bootinfo.ram_regions.add(r); });
}

View File

@@ -27,6 +27,7 @@
/* core-local includes */
#include <kernel/signal_receiver.h>
#include <hw/mapping.h>
#include <mapping.h>
#include <object.h>
#include <rpc_cap_factory.h>
@@ -56,28 +57,6 @@ namespace Genode {
}
struct Genode::Mapping : Hw::Mapping
{
Mapping() {}
Mapping(addr_t virt,
addr_t phys,
Cache_attribute cacheable,
bool io,
unsigned size_log2,
bool writeable,
bool executable)
:
Hw::Mapping(phys, virt, 1 << size_log2,
{ writeable ? Hw::RW : Hw::RO,
executable ? Hw::EXEC : Hw::NO_EXEC, Hw::USER,
Hw::NO_GLOBAL, io ? Hw::DEVICE : Hw::RAM, cacheable })
{ }
void prepare_map_operation() const {}
};
class Genode::Ipc_pager
{
protected:

View File

@@ -67,7 +67,7 @@ void Platform::_init_io_mem_alloc()
{
/* add entire adress space minus the RAM memory regions */
_io_mem_alloc.add_range(0, ~0x0UL);
_boot_info().ram_regions.for_each([this] (Hw::Memory_region const &r) {
_boot_info().ram_regions.for_each([this] (unsigned, Hw::Memory_region const &r) {
_io_mem_alloc.remove_range(r.base, r.size); });
};
@@ -82,7 +82,7 @@ Hw::Memory_region_array const & Platform::_core_virt_regions()
addr_t Platform::core_phys_addr(addr_t virt)
{
addr_t ret = 0;
_boot_info().elf_mappings.for_each([&] (Hw::Mapping const & m)
_boot_info().elf_mappings.for_each([&] (unsigned, Hw::Mapping const & m)
{
if (virt >= m.virt() && virt < (m.virt() + m.size()))
ret = (virt - m.virt()) + m.phys();
@@ -132,7 +132,10 @@ void Platform::_init_platform_info()
Genode::Xml_generator xml(reinterpret_cast<char *>(virt_addr),
rom_size, rom_name, [&] ()
{
xml.node("kernel", [&] () { xml.attribute("name", "hw"); });
xml.node("kernel", [&] () {
xml.attribute("name", "hw");
xml.attribute("acpi", true);
});
_init_additional_platform_info(xml);
xml.node("affinity-space", [&] () {
xml.attribute("width", affinity_space().width());
@@ -162,11 +165,11 @@ Platform::Platform()
_core_mem_alloc.virt_alloc().add_range(Hw::Mm::core_heap().base,
Hw::Mm::core_heap().size);
_core_virt_regions().for_each([this] (Hw::Memory_region const & r) {
_core_virt_regions().for_each([this] (unsigned, Hw::Memory_region const & r) {
_core_mem_alloc.virt_alloc().remove_range(r.base, r.size); });
_boot_info().elf_mappings.for_each([this] (Hw::Mapping const & m) {
_boot_info().elf_mappings.for_each([this] (unsigned, Hw::Mapping const & m) {
_core_mem_alloc.virt_alloc().remove_range(m.virt(), m.size()); });
_boot_info().ram_regions.for_each([this] (Hw::Memory_region const & region) {
_boot_info().ram_regions.for_each([this] (unsigned, Hw::Memory_region const & region) {
_core_mem_alloc.phys_alloc().add_range(region.base, region.size); });
_init_io_port_alloc();

View File

@@ -61,11 +61,24 @@ void Pager_entrypoint::entry()
if (!locked_ptr.valid()) continue;
Hw::Address_space * as = static_cast<Hw::Address_space*>(&*locked_ptr);
as->insert_translation(_mapping.virt(), _mapping.phys(),
_mapping.size(), _mapping.flags());
Hw::Page_flags const flags {
.writeable = _mapping.writeable ? Hw::RW : Hw::RO,
.executable = _mapping.executable ? Hw::EXEC : Hw::NO_EXEC,
.privileged = Hw::USER,
.global = Hw::NO_GLOBAL,
.type = _mapping.io_mem ? Hw::DEVICE : Hw::RAM,
.cacheable = _mapping.cached ? Genode::CACHED : Genode::UNCACHED
};
as->insert_translation(_mapping.dst_addr, _mapping.src_addr,
1UL << _mapping.size_log2, flags);
}
/* let pager object go back to no-fault state */
po->wake_up();
}
}
void Mapping::prepare_map_operation() const { }

View File

@@ -39,7 +39,7 @@ Kernel::Vm::Vm(unsigned,
void Vm::exception(Cpu & cpu)
{
switch(_state.cpu_exception) {
case Genode::Cpu_state::INTERRUPT_REQUEST: [[fallthrough]]
case Genode::Cpu_state::INTERRUPT_REQUEST: [[fallthrough]];
case Genode::Cpu_state::FAST_INTERRUPT_REQUEST:
_interrupt(cpu.id());
return;

View File

@@ -65,8 +65,7 @@ Capability<Vm_session::Native_vcpu> Vm_session_component::create_vcpu(Thread_cap
Vcpu & vcpu = *_vcpus[_vcpu_id_alloc];
try {
vcpu.ds_cap = _constrained_md_ram_alloc.alloc(_ds_size(),
Cache_attribute::UNCACHED);
vcpu.ds_cap = _constrained_md_ram_alloc.alloc(_ds_size(), Cache::UNCACHED);
vcpu.ds_addr = _region_map.attach(vcpu.ds_cap);
} catch (...) {
if (vcpu.ds_cap.valid())

View File

@@ -1,63 +0,0 @@
/*
* \brief Array class with static size
* \author Stefan Kalkowski
* \date 2016-09-30
*/
/*
* Copyright (C) 2016-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _SRC__LIB__HW__ARRAY_H_
#define _SRC__LIB__HW__ARRAY_H_
#include <base/log.h>
namespace Hw { template <typename, unsigned> class Array; }
template <typename T, unsigned MAX>
class Hw::Array
{
private:
unsigned _count = 0;
T _objs[MAX];
void _init(unsigned i, T obj) { _objs[i] = obj; }
template <typename ... TAIL>
void _init(unsigned i, T obj, TAIL ... tail)
{
_objs[i] = obj;
_init(i+1, tail...);
}
public:
Array() {}
template<typename ... ARGS>
Array(ARGS ... args) : _count(sizeof...(ARGS))
{
static_assert(sizeof...(ARGS) <= MAX, "Array too small!");
_init(0, args...);
}
void add(T const & obj)
{
if (_count == MAX) Genode::error("Array too small!");
else _objs[_count++] = obj;
}
template <typename FUNC>
void for_each(FUNC f) const {
for (unsigned i = 0; i < _count; i++) f(_objs[i]); }
unsigned count() const { return _count; }
};
#endif /* _SRC__LIB__HW__ARRAY_H_ */

View File

@@ -22,7 +22,7 @@ namespace Hw { template <typename> struct Boot_info; }
template <typename PLAT_INFO>
struct Hw::Boot_info
{
using Mapping_pool = Array<Mapping, 32>;
using Mapping_pool = Genode::Array<Mapping, 32>;
addr_t const table;
addr_t const table_allocator;

View File

@@ -45,7 +45,7 @@ struct Hw::Mmio_space : Hw::Memory_region_array
void for_each_mapping(FUNC f) const
{
addr_t virt_base = Mm::core_mmio().base;
auto lambda = [&] (Memory_region const & r) {
auto lambda = [&] (unsigned, Memory_region const & r) {
f(Mapping { r.base, virt_base, r.size, PAGE_FLAGS_KERN_IO });
virt_base += r.size + get_page_size();
};

View File

@@ -15,13 +15,13 @@
#define _SRC__LIB__HW__MEMORY_REGION_H_
#include <base/output.h>
#include <hw/array.h>
#include <util/array.h>
#include <hw/util.h>
namespace Hw {
struct Memory_region;
using Memory_region_array = Array<Memory_region, 16>;
using Memory_region_array = Genode::Array<Memory_region, 16>;
}

View File

@@ -31,12 +31,12 @@ namespace Hw {
struct Hw::Page_flags
{
Writeable writeable;
Executeable executable;
Privileged privileged;
Global global;
Type type;
Genode::Cache_attribute cacheable;
Writeable writeable;
Executeable executable;
Privileged privileged;
Global global;
Type type;
Genode::Cache cacheable;
void print(Genode::Output & out) const
{

View File

@@ -199,8 +199,8 @@ class Hw::Long_translation_table
struct Attribute_index : Base::template Bitfield<2, 3>
{
enum {
UNCACHED = Genode::Cache_attribute::UNCACHED,
CACHED = Genode::Cache_attribute::CACHED,
UNCACHED = Genode::Cache::UNCACHED,
CACHED = Genode::Cache::CACHED,
DEVICE
};

View File

@@ -122,7 +122,7 @@ class Hw::Level_4_translation_table
static access_t create(Page_flags const &flags, addr_t const pa)
{
bool const wc = flags.cacheable == Genode::Cache_attribute::WRITE_COMBINED;
bool const wc = flags.cacheable == Genode::Cache::WRITE_COMBINED;
return Common::create(flags)
| G::bits(flags.global)
@@ -303,7 +303,7 @@ class Hw::Page_directory
static typename Base::access_t create(Page_flags const &flags,
addr_t const pa)
{
bool const wc = flags.cacheable == Genode::Cache_attribute::WRITE_COMBINED;
bool const wc = flags.cacheable == Genode::Cache::WRITE_COMBINED;
return Base::create(flags)
| Base::Ps::bits(1)

View File

@@ -0,0 +1,34 @@
/*
* \brief Trace timestamp
* \author Norman Feske
* \date 2021-05-01
*/
/*
* Copyright (C) 2021 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _INCLUDE__SPEC__ARM_64__TRACE__TIMESTAMP_H_
#define _INCLUDE__SPEC__ARM_64__TRACE__TIMESTAMP_H_
#include <base/fixed_stdint.h>
namespace Genode { namespace Trace {
typedef uint64_t Timestamp;
/*
* In Linux/AARCH64, the 'mrs' instruction cannot be executed in user land.
* It triggers the abort of the program with an illegal-instruction
* exception.
*
* By returning 0, we discharge the timestamp-based interpolation of
* 'Timer::Connection::curr_time', falling back to a precision of 1 ms.
*/
inline Timestamp timestamp() { return 0; }
} }
#endif /* _INCLUDE__SPEC__ARM_64__TRACE__TIMESTAMP_H_ */

View File

@@ -74,7 +74,7 @@ EXT_OBJECTS += $(shell $(CUSTOM_CC) $(CC_MARCH) -print-file-name=crtbegin.o)
EXT_OBJECTS += $(shell $(CUSTOM_CC) $(CC_MARCH) -print-file-name=crtend.o)
EXT_OBJECTS += $(shell $(CUSTOM_HOST_CC) $(CC_MARCH) -print-file-name=crtn.o)
LX_LIBS_OPT += -lgcc -lgcc_s -lsupc++ -lc -lpthread
LX_LIBS_OPT += -lgcc_s -lsupc++ -lc -lpthread -lgcc
USE_HOST_LD_SCRIPT = yes
@@ -98,6 +98,11 @@ CXX_LINK_OPT += -Wl,--dynamic-linker=/lib/ld-linux.so.3
LD_SCRIPT_STATIC = ldscripts/armelf_linux_eabi.xc
endif
ifeq (arm_64,$(findstring arm_64,$(SPECS)))
CXX_LINK_OPT += -Wl,--dynamic-linker=/lib/ld-linux-aarch64.so.1
LD_SCRIPT_STATIC = /usr/lib/aarch64-linux-gnu/ldscripts/aarch64elf.xc
endif
#
# Because we use the host compiler's libgcc, omit the Genode toolchain's
# version and put all libraries here we depend on.

View File

@@ -11,6 +11,7 @@ HOST_INC_DIR += /usr/include/$(shell $(CUSTOM_HOST_CC) -dumpmachine)
#
HOST_INC_DIR += /usr/include/i386-linux-gnu
HOST_INC_DIR += /usr/include/x86_64-linux-gnu
HOST_INC_DIR += /usr/include/aarch64-linux-gnu
#
# Some header files installed on GNU/Linux test for the GNU compiler. For

View File

@@ -0,0 +1,69 @@
GEN_CORE_DIR := $(BASE_DIR)/src/core
LIBS := syscall-linux
BOARD ?= unknown
SRC_CC := main.cc \
platform.cc \
platform_thread.cc \
platform_services.cc \
pd_session_component.cc \
ram_dataspace_support.cc \
rom_session_component.cc \
cpu_session_component.cc \
cpu_session_support.cc \
cpu_thread_component.cc \
pd_session_support.cc \
dataspace_component.cc \
native_pd_component.cc \
native_cpu_component.cc \
capability_space.cc \
rpc_cap_factory_linux.cc \
ram_dataspace_factory.cc \
core_rpc_cap_alloc.cc \
io_mem_session_component.cc \
irq_session_component.cc \
signal_source_component.cc \
signal_transmitter_proxy.cc \
signal_receiver.cc \
trace_session_component.cc \
thread_linux.cc \
stack_area.cc \
core_log.cc \
core_log_out.cc \
default_log.cc \
env_reinit.cc \
heartbeat.cc \
thread.cc \
thread_myself.cc
INC_DIR += $(REP_DIR)/src/core/include \
$(GEN_CORE_DIR)/include \
$(REP_DIR)/src/platform \
$(REP_DIR)/src/include \
$(BASE_DIR)/src/include
vpath main.cc $(GEN_CORE_DIR)
vpath pd_session_component.cc $(GEN_CORE_DIR)
vpath core_log.cc $(GEN_CORE_DIR)
vpath cpu_session_component.cc $(GEN_CORE_DIR)
vpath cpu_session_support.cc $(GEN_CORE_DIR)
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
vpath pd_upgrade_ram_quota.cc $(GEN_CORE_DIR)
vpath pd_session_support.cc $(GEN_CORE_DIR)
vpath capability_space.cc $(GEN_CORE_DIR)
vpath ram_dataspace_factory.cc $(GEN_CORE_DIR)
vpath signal_source_component.cc $(GEN_CORE_DIR)
vpath signal_transmitter_proxy.cc $(GEN_CORE_DIR)
vpath signal_receiver.cc $(GEN_CORE_DIR)
vpath trace_session_component.cc $(GEN_CORE_DIR)
vpath default_log.cc $(GEN_CORE_DIR)
vpath heartbeat.cc $(GEN_CORE_DIR)
vpath thread.cc $(BASE_DIR)/src/lib/base
vpath thread_myself.cc $(BASE_DIR)/src/lib/base
vpath trace.cc $(BASE_DIR)/src/lib/base
vpath env_reinit.cc $(REP_DIR)/src/lib/base
vpath dataspace_component.cc $(REP_DIR)/src/core/spec/$(BOARD)
vpath io_mem_session_component.cc $(REP_DIR)/src/core/spec/$(BOARD)
vpath irq_session_component.cc $(REP_DIR)/src/core/spec/$(BOARD)
vpath platform_services.cc $(REP_DIR)/src/core/spec/$(BOARD)
vpath %.cc $(REP_DIR)/src/core

View File

@@ -0,0 +1 @@
include $(REP_DIR)/lib/mk/core-linux.inc

View File

@@ -0,0 +1,3 @@
LIBS += timeout-arm
include $(REP_DIR)/lib/mk/base-linux.mk

View File

@@ -0,0 +1,3 @@
BASE_LIBS += base-linux-common base-linux
include $(BASE_DIR)/lib/mk/spec/arm_64/ld-platform.inc

View File

@@ -0,0 +1,3 @@
SRC_BIN += seccomp_bpf_policy.bin
vpath seccomp_bpf_policy.bin $(REP_DIR)/src/lib/seccomp/spec/arm_64

View File

@@ -0,0 +1 @@
include $(BASE_DIR)/lib/mk/spec/arm_64/startup.inc

View File

@@ -0,0 +1,5 @@
SRC_S += lx_clone.S
SRC_S += lx_syscall.S
vpath lx_clone.S $(REP_DIR)/src/lib/syscall/spec/arm_64
vpath lx_syscall.S $(REP_DIR)/src/lib/syscall/spec/arm_64

View File

@@ -0,0 +1,7 @@
include $(REP_DIR)/lib/mk/core-linux.inc
SRC_CC += io_port_session_support.cc \
io_port_session_component.cc
vpath io_port_session_support.cc $(GEN_CORE_DIR)/spec/x86
vpath io_port_session_component.cc $(REP_DIR)/src/core/spec/$(BOARD)

View File

@@ -1,4 +1,4 @@
FROM_BASE_LINUX := etc src/lib/syscall src/lib/lx_hybrid lib/import
FROM_BASE_LINUX := etc src/lib/syscall src/lib/lx_hybrid lib/import include
FROM_BASE_LINUX_AND_BASE := lib/mk src/lib/base src/include
FROM_BASE := src/lib/timeout

View File

@@ -1 +1 @@
2021-03-11 4ab4ab408aa38109d6f12f402f477667c90229da
2021-05-09 e5ecbb3c8bdace835f144f0084c9aa91649e0bab

View File

@@ -6,10 +6,10 @@ lib/import src/ld:
$(mirror_from_rep_dir)
content:
for spec in x86_32 x86_64 arm; do \
for spec in x86_32 x86_64 arm arm_64; do \
mv lib/mk/spec/$$spec/ld-linux.mk lib/mk/spec/$$spec/ld.mk; done;
sed -i "s/core-linux/core/" src/core/linux/target.mk
sed -i "s/BOARD.*unknown/BOARD := linux/" src/core/linux/target.mk
sed -i "/TARGET/s/core-linux/core/" src/core/linux/target.mk
sed -i "s/BOARD.*unknown/BOARD := linux/" lib/mk/core-linux.inc
sed -i "s/ld-linux/ld/" src/lib/ld/linux/target.mk
sed -i "s/linux_timer_drv/timer/" src/timer/linux/target.mk
rm -rf src/lib/initramfs

View File

@@ -1 +1 @@
2021-03-11 2847f916b65cee82243e88b9ac37550148f46dc5
2021-05-27 9534bb2a4c39f66505bdbbad8ccb9da9506617c5

View File

@@ -32,7 +32,7 @@
inline int lx_mkdir(char const *pathname, mode_t mode)
{
return lx_syscall(SYS_mkdir, pathname, mode);
return lx_syscall(SYS_mkdirat, AT_FDCWD, pathname, mode);
}
@@ -44,7 +44,7 @@ inline int lx_ftruncate(int fd, unsigned long length)
inline int lx_unlink(const char *fname)
{
return lx_syscall(SYS_unlink, fname);
return lx_syscall(SYS_unlinkat, AT_FDCWD, fname, 0);
}
@@ -52,19 +52,30 @@ inline int lx_unlink(const char *fname)
** Functions used by core's rom-session support code **
*******************************************************/
inline int lx_open(const char *pathname, int flags, mode_t mode = 0)
inline int lx_open(char const *pathname, int flags, mode_t mode = 0)
{
return lx_syscall(SYS_open, pathname, flags, mode);
return lx_syscall(SYS_openat, AT_FDCWD, pathname, flags, mode);
}
inline int lx_stat(const char *path, struct stat64 *buf)
inline int lx_stat_size(char const *path, Genode::uint64_t &out_size)
{
#ifdef _LP64
return lx_syscall(SYS_stat, path, buf);
#ifdef __aarch64__
struct statx buf { };
int result = lx_syscall(SYS_statx, AT_FDCWD, path, 0, STATX_SIZE, &buf);
out_size = buf.stx_size;
#else
return lx_syscall(SYS_stat64, path, buf);
#ifdef _LP64
struct stat buf { };
int result = lx_syscall(SYS_stat, path, &buf);
out_size = buf.st_size;
#else
struct stat64 buf { };
int result = lx_syscall(SYS_stat64, path, &buf);
out_size = buf.st_size;
#endif
#endif
return result;
}
@@ -119,7 +130,7 @@ inline int lx_kill(int pid, int signal)
}
inline int lx_create_process(int (*entry)(void *), void *stack, void *arg)
inline int lx_create_process(int (*entry)(), void *stack)
{
/*
* The low byte of the flags denotes the signal to be sent to the parent
@@ -127,7 +138,7 @@ inline int lx_create_process(int (*entry)(void *), void *stack, void *arg)
* this condition.
*/
int const flags = CLONE_VFORK | LX_SIGCHLD;
return lx_clone((int (*)(void *))entry, stack, flags, arg);
return lx_clone((int (*)())entry, stack, flags);
}
@@ -253,7 +264,7 @@ inline int lx_connect(int sockfd, const struct sockaddr *serv_addr,
inline int lx_pipe(int pipefd[2])
{
return lx_syscall(SYS_pipe, pipefd);
return lx_syscall(SYS_pipe2, pipefd, 0);
}

View File

@@ -74,8 +74,7 @@ class Genode::Dataspace_component : public Rpc_object<Linux_dataspace>
/**
* Constructor
*/
Dataspace_component(size_t size, addr_t addr,
Cache_attribute, bool writable,
Dataspace_component(size_t size, addr_t addr, Cache, bool writable,
Dataspace_owner * owner)
:
_size(size), _addr(addr), _cap(), _writable(writable), _owner(owner)
@@ -94,7 +93,7 @@ class Genode::Dataspace_component : public Rpc_object<Linux_dataspace>
* reasons and should not be used.
*/
Dataspace_component(size_t size, addr_t, addr_t phys_addr,
Cache_attribute, bool writable, Dataspace_owner *_owner);
Cache, bool writable, Dataspace_owner *_owner);
/**
* This constructor is especially used for ROM dataspaces

View File

@@ -34,9 +34,9 @@ class Genode::Io_mem_session_component : public Rpc_object<Io_mem_session>
Rpc_entrypoint &_ds_ep;
Io_mem_dataspace_capability _ds_cap;
size_t get_arg_size(const char *);
addr_t get_arg_phys(const char *);
Cache_attribute get_arg_wc(const char *);
size_t get_arg_size(char const *);
addr_t get_arg_phys(char const *);
Cache get_arg_wc (char const *);
public:

View File

@@ -75,7 +75,7 @@ class Genode::Platform : public Platform_generic
bool valid_addr(addr_t ) const override { ASSERT_NEVER_CALLED; }
bool alloc(size_t, void **) override { ASSERT_NEVER_CALLED; }
Alloc_return alloc_aligned(size_t, void **, int, addr_t, addr_t) override
Alloc_return alloc_aligned(size_t, void **, unsigned, Range) override
{ ASSERT_NEVER_CALLED; }
Alloc_return alloc_addr(size_t, addr_t) override
@@ -94,10 +94,9 @@ class Genode::Platform : public Platform_generic
return true;
}
Alloc_return alloc_aligned(size_t, void **out_addr, int,
addr_t, addr_t) override
Alloc_return alloc_aligned(size_t, void **out, unsigned, Range) override
{
*out_addr = 0;
*out = 0;
return Alloc_return::OK;
}

View File

@@ -1,83 +1,10 @@
TARGET = core-linux
REQUIRES = linux
LIBS = cxx base-linux-common syscall-linux startup-linux
TARGET := core-linux
REQUIRES := linux
LIBS := cxx base-linux-common startup-linux core-linux
BOARD ?= unknown
BOARD ?= unknown
include $(BASE_DIR)/src/core/version.inc
GEN_CORE_DIR = $(BASE_DIR)/src/core
SRC_CC = main.cc \
platform.cc \
platform_thread.cc \
platform_services.cc \
pd_session_component.cc \
ram_dataspace_support.cc \
rom_session_component.cc \
cpu_session_component.cc \
cpu_session_support.cc \
cpu_thread_component.cc \
pd_session_support.cc \
dataspace_component.cc \
native_pd_component.cc \
native_cpu_component.cc \
capability_space.cc \
rpc_cap_factory_linux.cc \
ram_dataspace_factory.cc \
core_rpc_cap_alloc.cc \
io_mem_session_component.cc \
io_port_session_component.cc \
io_port_session_support.cc \
irq_session_component.cc \
signal_source_component.cc \
signal_transmitter_proxy.cc \
signal_receiver.cc \
trace_session_component.cc \
thread_linux.cc \
stack_area.cc \
core_log.cc \
core_log_out.cc \
default_log.cc \
env_reinit.cc \
heartbeat.cc \
thread.cc \
thread_myself.cc
INC_DIR += $(REP_DIR)/src/core/include \
$(GEN_CORE_DIR)/include \
$(REP_DIR)/src/platform \
$(REP_DIR)/src/include \
$(BASE_DIR)/src/include
LD_TEXT_ADDR ?= 0x01000000
LD_SCRIPT_STATIC = $(BASE_DIR)/src/ld/genode.ld \
$(call select_from_repositories,src/ld/stack_area.ld)
include $(GEN_CORE_DIR)/version.inc
vpath main.cc $(GEN_CORE_DIR)
vpath pd_session_component.cc $(GEN_CORE_DIR)
vpath core_log.cc $(GEN_CORE_DIR)
vpath cpu_session_component.cc $(GEN_CORE_DIR)
vpath cpu_session_support.cc $(GEN_CORE_DIR)
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
vpath pd_upgrade_ram_quota.cc $(GEN_CORE_DIR)
vpath pd_session_support.cc $(GEN_CORE_DIR)
vpath capability_space.cc $(GEN_CORE_DIR)
vpath ram_dataspace_factory.cc $(GEN_CORE_DIR)
vpath signal_source_component.cc $(GEN_CORE_DIR)
vpath signal_transmitter_proxy.cc $(GEN_CORE_DIR)
vpath signal_receiver.cc $(GEN_CORE_DIR)
vpath trace_session_component.cc $(GEN_CORE_DIR)
vpath default_log.cc $(GEN_CORE_DIR)
vpath heartbeat.cc $(GEN_CORE_DIR)
vpath io_port_session_support.cc $(GEN_CORE_DIR)/spec/x86
vpath thread.cc $(BASE_DIR)/src/lib/base
vpath thread_myself.cc $(BASE_DIR)/src/lib/base
vpath trace.cc $(BASE_DIR)/src/lib/base
vpath env_reinit.cc $(REP_DIR)/src/lib/base
vpath dataspace_component.cc $(REP_DIR)/src/core/spec/$(BOARD)
vpath io_mem_session_component.cc $(REP_DIR)/src/core/spec/$(BOARD)
vpath irq_session_component.cc $(REP_DIR)/src/core/spec/$(BOARD)
vpath io_port_session_component.cc $(REP_DIR)/src/core/spec/$(BOARD)
vpath platform_services.cc $(REP_DIR)/src/core/spec/$(BOARD)
vpath %.cc $(REP_DIR)/src/core
LD_TEXT_ADDR ?= 0x01000000
LD_SCRIPT_STATIC = $(BASE_DIR)/src/ld/genode.ld \
$(call select_from_repositories,src/ld/stack_area.ld)

View File

@@ -15,6 +15,7 @@
#include <util/arg_string.h>
#include <base/log.h>
#include <base/snprintf.h>
#include <cpu/consts.h>
/* core-local includes */
#include <pd_session_component.h>
@@ -35,33 +36,48 @@ using namespace Genode;
***************/
/**
* Argument frame for passing 'execve' paremeters through 'clone'
* Argument frame and initial stack for passing 'execve' parameters through 'clone'
*/
struct Execve_args
struct Execve_args_and_stack
{
char const *filename;
char * const *argv;
char * const *envp;
Lx_sd const parent_sd;
struct Args
{
char const *filename;
char **argv;
char **envp;
Lx_sd parent_sd;
};
Execve_args(char const *filename,
char * const *argv,
char * const *envp,
Lx_sd parent_sd)
:
filename(filename), argv(argv), envp(envp), parent_sd(parent_sd)
{ }
Args args;
/* initial stack used by the child until calling 'execve' */
enum { STACK_SIZE = 4096 };
char stack[STACK_SIZE];
void *initial_sp()
{
return (void *)Abi::stack_align((addr_t)(stack + STACK_SIZE));
}
};
static Execve_args_and_stack &_execve_args_and_stack()
{
static Execve_args_and_stack inst { };
return inst;
}
/**
* Startup code of the new child process
*/
static int _exec_child(Execve_args *arg)
static int _exec_child()
{
lx_dup2(arg->parent_sd.value, PARENT_SOCKET_HANDLE);
auto const &args = _execve_args_and_stack().args;
return lx_execve(arg->filename, arg->argv, arg->envp);
lx_dup2(args.parent_sd.value, PARENT_SOCKET_HANDLE);
return lx_execve(args.filename, args.argv, args.envp);
}
@@ -148,31 +164,15 @@ void Native_pd_component::_start(Dataspace_component &ds)
argv_buf[0] = pname_buf;
argv_buf[1] = 0;
/*
* We cannot create the new process via 'fork()' because all our used
* memory including stack memory is backed by dataspaces, which had been
* mapped with the 'MAP_SHARED' flag. Therefore, after being created, the
* new process starts using the stack with the same physical memory pages
* as used by parent process. This would ultimately lead to stack
* corruption. To prevent both processes from concurrently accessing the
* same stack, we pause the execution of the parent until the child calls
* 'execve'. From then on, the child has its private memory layout. The
* desired behaviour is normally provided by 'vfork' but we use the more
* modern 'clone' call for this purpose.
*/
enum { STACK_SIZE = 4096 };
static char stack[STACK_SIZE]; /* initial stack used by the child until
calling 'execve' */
_execve_args_and_stack().args = Execve_args_and_stack::Args {
.filename = filename,
.argv = argv_buf,
.envp = env,
.parent_sd = Capability_space::ipc_cap_data(_pd_session._parent).dst.socket
};
/*
* Argument frame as passed to 'clone'. Because, we can only pass a single
* pointer, all arguments are embedded within the 'execve_args' struct.
*/
Execve_args arg(filename, argv_buf, env,
Capability_space::ipc_cap_data(_pd_session._parent).dst.socket);
_pid = lx_create_process((int (*)(void *))_exec_child,
stack + STACK_SIZE - sizeof(umword_t), &arg);
_pid = lx_create_process((int (*)())_exec_child,
_execve_args_and_stack().initial_sp());
if (strcmp(filename, tmp_filename) == 0)
lx_unlink(filename);

View File

@@ -54,10 +54,11 @@ Linux_dataspace::Filename Dataspace_component::_file_name(const char *args)
size_t Dataspace_component::_file_size()
{
struct stat64 s;
if (lx_stat(_fname.buf, &s) < 0) throw Service_denied();
uint64_t size = 0;
if (lx_stat_size(_fname.buf, size) < 0)
throw Service_denied();
return align_addr(s.st_size, 12);
return align_addr(size, 12);
}
@@ -73,7 +74,7 @@ Dataspace_component::Dataspace_component(const char *args)
Dataspace_component::Dataspace_component(size_t size, addr_t, addr_t phys_addr,
Cache_attribute, bool, Dataspace_owner *_owner)
Cache, bool, Dataspace_owner *_owner)
:
_size(size), _addr(phys_addr), _cap(), _writable(false), _owner(_owner)
{

View File

@@ -53,7 +53,7 @@ Io_mem_session_component::Io_mem_session_component(Range_allocator &io_mem_alloc
}
Cache_attribute Io_mem_session_component::get_arg_wc(const char *)
Cache Io_mem_session_component::get_arg_wc(const char *)
{
warning(__func__, " not implemented");
return UNCACHED;

View File

@@ -53,10 +53,11 @@ Linux_dataspace::Filename Dataspace_component::_file_name(const char *args)
Genode::size_t Dataspace_component::_file_size()
{
struct stat64 s;
if (lx_stat(_fname.buf, &s) < 0) throw Service_denied();
uint64_t size = 0;
if (lx_stat_size(_fname.buf, &size) < 0)
throw Service_denied();
return s.st_size;
return size;
}
@@ -72,7 +73,7 @@ Dataspace_component::Dataspace_component(const char *args)
Dataspace_component::Dataspace_component(size_t size, addr_t, addr_t phys_addr,
Cache_attribute, bool writable, Dataspace_owner *_owner)
Cache, bool writable, Dataspace_owner *_owner)
:
_size(size), _addr(phys_addr), _cap(), _writable(writable), _owner(_owner)
{

View File

@@ -40,7 +40,7 @@ addr_t Io_mem_session_component::get_arg_phys(const char *args)
}
Cache_attribute Io_mem_session_component::get_arg_wc(const char *args)
Cache Io_mem_session_component::get_arg_wc(const char *args)
{
Arg const a = Arg_string::find_arg("wc", args);
if (a.valid() && a.bool_value(0)) {

View File

@@ -79,8 +79,7 @@ class Stack_area_region_map : public Genode::Region_map
struct Stack_area_ram_allocator : Genode::Ram_allocator
{
Genode::Ram_dataspace_capability alloc(Genode::size_t,
Genode::Cache_attribute) override {
Genode::Ram_dataspace_capability alloc(Genode::size_t, Genode::Cache) override {
return Genode::Ram_dataspace_capability(); }
void free(Genode::Ram_dataspace_capability) override { }

View File

@@ -66,6 +66,6 @@ void Thread::_deinit_platform_thread() { }
void Thread::start()
{
native_thread().tid = lx_create_thread(Thread::_thread_start, stack_top(), this);
native_thread().tid = lx_create_thread(Thread::_thread_start, stack_top());
native_thread().pid = lx_getpid();
}

View File

@@ -160,7 +160,7 @@ void Thread::start()
threadlib_initialized = true;
}
native_thread().tid = lx_create_thread(Thread::_thread_start, stack_top(), this);
native_thread().tid = lx_create_thread(Thread::_thread_start, stack_top());
native_thread().pid = lx_getpid();
/* wait until the 'thread_start' function got entered */

View File

@@ -84,8 +84,7 @@ extern "C" void wait_for_continue(void);
*********************************************************/
extern "C" long lx_syscall(int number, ...);
extern "C" int lx_clone(int (*fn)(void *), void *child_stack,
int flags, void *arg);
extern "C" int lx_clone(int (*fn)(), void *child_stack, int flags);
/*****************************************
@@ -118,7 +117,7 @@ inline int lx_dup(int fd)
inline int lx_dup2(int fd, int to)
{
return lx_syscall(SYS_dup2, fd, to);
return lx_syscall(SYS_dup3, fd, to, 0);
}
@@ -237,7 +236,7 @@ struct Lx_socketpair
inline Lx_epoll_sd lx_epoll_create()
{
int const ret = lx_syscall(SYS_epoll_create, 1);
int const ret = lx_syscall(SYS_epoll_create1, 0);
if (ret < 0) {
/*
* No recovery possible, just leave a diagnostic message and block
@@ -259,7 +258,7 @@ inline int lx_epoll_ctl(Lx_epoll_sd epoll, int op, Lx_sd fd, epoll_event *event)
inline int lx_epoll_wait(Lx_epoll_sd epoll, struct epoll_event *events,
int maxevents, int timeout)
{
return lx_syscall(SYS_epoll_wait, epoll.value, events, maxevents, timeout);
return lx_syscall(SYS_epoll_pwait, epoll.value, events, maxevents, timeout, 0);
}
@@ -357,7 +356,7 @@ inline int lx_sigaction(int signum, void (*handler)(int), bool altstack)
* with EINTR. We therefore set the SA_RESTART flag in signal handlers.
*/
#ifdef _LP64
#ifdef __x86_64__
/*
* The SA_RESTORER flag is not officially documented, but used internally
* by the glibc implementation of sigaction(). Without specifying this flag
@@ -404,18 +403,12 @@ inline int lx_sigaltstack(void *signal_stack, Genode::size_t stack_size)
}
inline int lx_create_thread(void (*entry)(), void *stack, void *arg)
inline int lx_create_thread(void (*entry)(), void *stack)
{
int flags = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND
| CLONE_THREAD | CLONE_SYSVSEM;
/*
* The syscall binding for clone does not exist in the FreeBSD libc, which
* we are using as libc for Genode. In glibc, clone is implemented as a
* assembler binding without external libc references. Hence, we are safe
* to rely on the glibc version of 'clone' here.
*/
return lx_clone((int (*)(void *))entry, stack, flags, arg);
return lx_clone((int (*)())entry, stack, flags);
}

View File

@@ -0,0 +1,19 @@
/*
* \brief Linux clone() binding
* \author Norman Feske
* \date 2021-04-12
*/
#define SYS_clone 220
.text
.globl lx_clone
.type lx_clone, #function
lx_clone:
stp x29, x30, [sp, #-16]! /* save sp and link register */
stp x3, x0, [x1, #-16]! /* supply fn and argp at new thread's stack */
mov x0, x2 /* flags */
mov w8, #SYS_clone
svc #0 /* syscall, return value in x0 */
ldp x29, x30, [sp], #16 /* restore sp and link register */
ret

View File

@@ -0,0 +1,21 @@
/*
* \brief Linux syscall() binding
* \author Norman Feske
* \date 2021-04-07
*/
.text
.globl lx_syscall
.type lx_syscall, #function
lx_syscall:
stp x29, x30, [sp, #-16]! /* save sp and link register */
mov x8, x0 /* system call number */
mov x0, x1 /* arguments ... */
mov x1, x2
mov x2, x3
mov x3, x4
mov x4, x5
mov x5, x6
svc #0 /* syscall, return value in x0 */
ldp x29, x30, [sp], #16 /* restore sp and link register */
ret

View File

@@ -592,10 +592,11 @@ namespace Nova {
} gdtr, idtr;
unsigned long long tsc_val, tsc_off;
} __attribute__((packed));
mword_t mr[(4096 - 4 * sizeof(mword_t)) / sizeof(mword_t)];
};
/* message payload */
mword_t * msg() { return reinterpret_cast<mword_t *>(&mtd); }
mword_t * msg() { return mr; }
struct Item {
mword_t crd;
@@ -747,7 +748,9 @@ namespace Nova {
}
mword_t mtd_value() const { return static_cast<Mtd>(mtd).value(); }
} __attribute__((packed));
};
static_assert(sizeof(Utcb) == 4096, "Unexpected size of UTCB");
/**
* Size of event-specific portal window mapped at PD creation time

View File

@@ -1 +1 @@
0316f8810c665d115fb860399d824a6531aa5aad
2ff8c9abf7389a2bdb7e0aa8aa4d2fec688c51af

View File

@@ -4,7 +4,7 @@ DOWNLOADS := nova.git
# r10 branch
URL(nova) := https://github.com/alex-ab/NOVA.git
REV(nova) := 98b501b243bcd7aa1be36454cf58a63aae362c2e
REV(nova) := 5c64bba1ee59902eb2a4ce4abe4b867eaf085dac
DIR(nova) := src/kernel/nova
PATCHES := $(sort $(wildcard $(REP_DIR)/patches/*.patch))

View File

@@ -1 +1 @@
2021-02-22 b6091dc3f0529cf78b05eb2f648fe2a89c3982af
2021-05-09 7e538243f9886048199e49cec7643674585b164c

View File

@@ -1 +1 @@
2021-03-11 17d4c88f9d9a66aaa4a12881c052368c750934fc
2021-05-27 8ae888b469b89a1a4ca3e4f8334967e2144f2f7d

View File

@@ -19,50 +19,38 @@
#include <base/ipc.h>
#include <base/stdint.h>
/* core-local includes */
#include <mapping.h>
/* NOVA includes */
#include <nova/syscalls.h>
namespace Genode {
class Mapping;
class Ipc_pager;
namespace Genode { class Ipc_pager; }
namespace Genode { enum { PAGE_SIZE_LOG2 = 12 }; }
static inline Nova::Rights nova_map_rights(Genode::Mapping const &mapping)
{
return Nova::Rights(true, mapping.writeable, mapping.executable);
}
class Genode::Mapping
static inline Nova::Mem_crd nova_src_crd(Genode::Mapping const &mapping)
{
private:
return Nova::Mem_crd(mapping.src_addr >> Genode::PAGE_SIZE_LOG2,
mapping.size_log2 - Genode::PAGE_SIZE_LOG2,
nova_map_rights(mapping));
}
addr_t const _dst_addr;
Cache_attribute const _attr;
Nova::Mem_crd const _mem_crd;
enum { PAGE_SIZE_LOG2 = 12 };
public:
/**
* Constructor
*/
Mapping(addr_t dst_addr, addr_t source_addr,
Cache_attribute c, bool /* io_mem */,
unsigned size_log2,
bool writeable, bool executable)
:
_dst_addr(dst_addr),
_attr(c),
_mem_crd(source_addr >> PAGE_SIZE_LOG2,
size_log2 - PAGE_SIZE_LOG2,
Nova::Rights(true, writeable, executable))
{ }
void prepare_map_operation() { }
Nova::Mem_crd mem_crd() const { return _mem_crd; }
bool dma() { return _attr != CACHED; };
bool write_combined() { return _attr == WRITE_COMBINED; };
addr_t dst_addr() { return _dst_addr; }
};
static inline Nova::Mem_crd nova_dst_crd(Genode::Mapping const &mapping)
{
return Nova::Mem_crd(mapping.dst_addr >> Genode::PAGE_SIZE_LOG2,
mapping.size_log2 - Genode::PAGE_SIZE_LOG2,
nova_map_rights(mapping));
}
class Genode::Ipc_pager

View File

@@ -23,6 +23,10 @@
using namespace Genode;
void Mapping::prepare_map_operation() const { }
Ipc_pager::Ipc_pager(Nova::Utcb &utcb, addr_t pd_dst, addr_t pd_core)
:
_pd_dst(pd_dst),
@@ -44,23 +48,20 @@ Ipc_pager::Ipc_pager(Nova::Utcb &utcb, addr_t pd_dst, addr_t pd_core)
}
void Ipc_pager::set_reply_mapping(Mapping m)
void Ipc_pager::set_reply_mapping(Mapping const mapping)
{
Nova::Utcb &utcb = *(Nova::Utcb *)Thread::myself()->utcb();
utcb.set_msg_word(0);
bool res = utcb.append_item(m.mem_crd(), 0, true, false,
false, m.dma(), m.write_combined());
/* one item ever fits on the UTCB */
bool res = utcb.append_item(nova_src_crd(mapping), 0, true, false, false,
mapping.dma_buffer, mapping.write_combined);
/* one item always fits in the UTCB */
(void)res;
/* receive window in destination pd */
Nova::Mem_crd crd_mem(m.dst_addr() >> 12, m.mem_crd().order(),
Nova::Rights(m.mem_crd().rights().readable(),
m.mem_crd().rights().writeable(),
m.mem_crd().rights().executable()));
/* asynchronously map memory */
_syscall_res = Nova::delegate(_pd_core, _pd_dst, crd_mem);
_syscall_res = Nova::delegate(_pd_core, _pd_dst, nova_dst_crd(mapping));
}

View File

@@ -66,34 +66,31 @@ void Pd_session_component::map(addr_t virt, addr_t size)
uint8_t err = Nova::NOVA_PD_OOM;
do {
utcb.set_msg_word(0);
bool res = utcb.append_item(mapping.mem_crd(), 0, true, false,
false, mapping.dma(),
mapping.write_combined());
bool res = utcb.append_item(nova_src_crd(mapping), 0, true, false,
false,
mapping.dma_buffer,
mapping.write_combined);
/* one item ever fits on the UTCB */
(void)res;
Nova::Rights const map_rights (true,
region->write() && dsc->writable(),
region->executable());
err = Nova::delegate(pd_core, pd_dst, nova_dst_crd(mapping));
/* receive window in destination pd */
Nova::Mem_crd crd_mem(mapping.dst_addr() >> 12,
mapping.mem_crd().order(), map_rights);
err = Nova::delegate(pd_core, pd_dst, crd_mem);
} while (err == Nova::NOVA_PD_OOM &&
Nova::NOVA_OK == Pager_object::handle_oom(Pager_object::SRC_CORE_PD,
_pd->pd_sel(),
"core", "ep",
Pager_object::Policy::UPGRADE_CORE_TO_DST));
addr_t const map_crd_size = 1UL << (mapping.mem_crd().order() + 12);
addr_t const mapped = mapping.dst_addr() + map_crd_size - virt;
addr_t const map_size = 1UL << mapping.size_log2;
addr_t const mapped = mapping.dst_addr + map_size - virt;
if (err != Nova::NOVA_OK)
if (err != Nova::NOVA_OK) {
error("could not map memory ",
Hex_range<addr_t>(mapping.dst_addr(), map_crd_size) , " "
Hex_range<addr_t>(mapping.dst_addr, map_size) , " "
"eagerly error=", err);
}
return mapped;
};

View File

@@ -680,7 +680,11 @@ Platform::Platform()
pages << get_page_size_log2(),
"platform_info", [&] ()
{
xml.node("kernel", [&] () { xml.attribute("name", "nova"); });
xml.node("kernel", [&] () {
xml.attribute("name", "nova");
xml.attribute("acpi", true);
xml.attribute("msi" , true);
});
if (efi_sys_tab_phy) {
xml.node("efi-system-table", [&] () {
xml.attribute("address", String<32>(Hex(efi_sys_tab_phy)));

View File

@@ -1 +1 @@
2021-03-11 36594a3e445254981972ee7344007c39d01343c7
2021-05-27 4394ee99a7779bcaf5f1ca8fe9e7f2f82ade9fdb

View File

@@ -14,61 +14,16 @@
#ifndef _CORE__INCLUDE__IPC_PAGER_H_
#define _CORE__INCLUDE__IPC_PAGER_H_
#include <base/cache.h>
/* Genode includes */
#include <base/ipc.h>
#include <base/stdint.h>
/* base-internal includes */
#include <base/internal/okl4.h>
namespace Genode {
/* core-local includes */
#include <mapping.h>
class Mapping;
class Ipc_pager;
}
class Genode::Mapping
{
private:
addr_t _phys_addr { 0 };
Okl4::L4_Fpage_t _fpage { };
Okl4::L4_PhysDesc_t _phys_desc { };
public:
/**
* Constructor
*/
Mapping(addr_t dst_addr, addr_t src_addr,
Cache_attribute cacheability, bool io_mem,
unsigned l2size, bool rw, bool executable);
/**
* Construct invalid mapping
*/
Mapping();
/**
* Return flexpage describing the virtual destination address
*/
Okl4::L4_Fpage_t fpage() const { return _fpage; }
/**
* Return physical-memory descriptor describing the source location
*/
Okl4::L4_PhysDesc_t phys_desc() const { return _phys_desc; }
/**
* Prepare map operation
*
* On OKL4, we do not need to map a page core-locally to be able to
* map it into another address space. Therefore, we can leave this
* function blank.
*/
void prepare_map_operation() { }
};
namespace Genode { class Ipc_pager; }
class Genode::Ipc_pager

View File

@@ -61,24 +61,11 @@ static inline L4_ThreadId_t thread_get_my_global_id()
}
/*************
** Mapping **
*************/
Mapping::Mapping(addr_t dst_addr, addr_t src_addr, Cache_attribute, bool,
unsigned l2size, bool rw, bool)
:
_fpage(L4_FpageLog2(dst_addr, l2size)),
/*
* OKL4 does not support write-combining as mapping attribute.
*/
_phys_desc(L4_PhysDesc(src_addr, 0))
{
L4_Set_Rights(&_fpage, rw ? L4_ReadWriteOnly : L4_ReadeXecOnly);
}
Mapping::Mapping() { }
/*
* On OKL4, we do not need to map a page core-locally to be able to map it into
* another address space. Therefore, we can leave this method blank.
*/
void Mapping::prepare_map_operation() const { }
/***************
@@ -121,10 +108,21 @@ void Ipc_pager::reply_and_wait_for_fault()
L4_SpaceId_t to_space;
to_space.raw = L4_ThreadNo(_last) >> Thread_id_bits::THREAD;
/* map page to faulting space */
int ret = L4_MapFpage(to_space, _reply_mapping.fpage(),
_reply_mapping.phys_desc());
/* flexpage describing the virtual destination address */
Okl4::L4_Fpage_t fpage { L4_FpageLog2(_reply_mapping.dst_addr,
_reply_mapping.size_log2) };
L4_Set_Rights(&fpage, _reply_mapping.writeable ? L4_ReadWriteOnly
: L4_ReadeXecOnly);
/*
* Note that OKL4 does not support write-combining as mapping attribute.
*/
/* physical-memory descriptor describing the source location */
Okl4::L4_PhysDesc_t phys_desc { L4_PhysDesc(_reply_mapping.src_addr, 0) };
/* map page to faulting space */
int ret = L4_MapFpage(to_space, fpage, phys_desc);
if (ret != 1)
error("L4_MapFpage returned ", ret, ", error=", L4_ErrorCode());

View File

@@ -16,6 +16,7 @@
#include <base/allocator_avl.h>
#include <base/sleep.h>
#include <util/misc_math.h>
#include <util/xml_generator.h>
/* base-internal includes */
#include <base/internal/crt0.h>
@@ -208,6 +209,33 @@ Platform::Platform()
init_core_log(Core_log_range { core_local_addr, log_size } );
}
/* export platform specific infos */
{
void * core_local_ptr = nullptr;
void * phys_ptr = nullptr;
unsigned const pages = 1;
size_t const size = pages << get_page_size_log2();
if (ram_alloc().alloc_aligned(size, &phys_ptr, get_page_size_log2()).ok()) {
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
/* let one page free after the log buffer */
region_alloc().alloc_aligned(size, &core_local_ptr, get_page_size_log2());
addr_t const core_local_addr = reinterpret_cast<addr_t>(core_local_ptr);
if (map_local(phys_addr, core_local_addr, pages)) {
Genode::Xml_generator xml(reinterpret_cast<char *>(core_local_addr),
size, "platform_info", [&] () {
xml.node("kernel", [&] () { xml.attribute("name", "okl4"); });
});
_rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, size,
"platform_info"));
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More