Commit Graph

382 Commits

Author SHA1 Message Date
Norman Feske b3727a9b46 Add missing override annotations
Issue #3159
2019-02-19 11:12:11 +01:00
Stefan Kalkowski 5136d9ddc7 base: fix timer_ticks_to_us casting error
Fix #3155
2019-02-19 11:12:11 +01:00
Norman Feske aa66b5d62f base: remove dependency from deprecated APIs
This patch adjusts the implementation of the base library and core such
that the code no longer relies on deprecated APIs except for very few
cases, mainly to keep those deprecated APIs in tact for now.

The most prominent changes are:

- Removing the use of base/printf.h

- Removing of the log backend for printf. The 'Console' with the
  format-string parser is still there along with 'snprintf.h' because
  the latter is still used at a few places, most prominently the
  'Connection' classes.

- Removing the notion of a RAM session, which does not exist in
  Genode anymore. Still the types were preserved (by typedefs to
  PD session) to keep up compatibility. But this transition should
  come to an end now.

- Slight rennovation of core's tracing service, e.g., the use of an
  Attached_dataspace as the Argument_buffer.

- Reducing the reliance on global accessors like deprecated_env() or
  core_env(). Still there is a longish way to go to eliminate all such
  calls. A useful pattern (or at least a stop-gap solution) is to
  pass the 'Env' to the individual compilation units via init functions.

- Avoiding the use of the old 'Child_policy::resolve_session_request'
  interface that returned a 'Service' instead of a 'Route'.

Issue #1987
2019-02-19 11:08:17 +01:00
Norman Feske c629a92aa2 base: init_env_ram_session -> init_env_pd_session
The notion of a RAM session does not exist anymore. Hence, we have to
adjust the name of 'init_env_ram_session'. Since this change modifies
the ABI, it comes as separate commit.

Issue #2407
2019-02-19 11:08:17 +01:00
Alexander Boettcher 0c24e1efdc vm_session: extensions
- support to create multiple vCPUs
- support to implement Vm_session methods client side within base library
- adjust muen specific virtualbox4 version to compile/link

Issue #3111
2019-02-19 11:08:17 +01:00
Ehmry - 38ab456c78 Remove pointers from Genode::Fifo interface
Replace methods of Genode::Fifo returning pointers with methods which
call lambdas with references.

Ref #3135
2019-02-19 11:08:17 +01:00
Stefan Kalkowski 161f39f7af imx6q_sabrelite: enable sd_card_drv 2019-02-19 11:08:17 +01:00
Norman Feske f9373b4430 base: new Allocator_avl::construct_metadata method
The new method allows for the construction of a meta-data object inside
the reserved space of the allocator's meta data. It thereby alleviates
the need to copy the meta data object (via the assignment operator) as
done by the traditional 'metadata' setter method. This, in turn, allows
one to use non-copyable objects (like objects with constant member
variables) as meta data.
2019-02-12 10:33:12 +01:00
Christian Prochaska 4b805ccde9 base: move 'Buffered_output' class into public header
Fixes #3128
2019-01-30 13:49:55 +01:00
Norman Feske 5f1f67153b Xml_node: safe alternatives to unsafe accessors
Issue #3125
2019-01-30 13:49:54 +01:00
Norman Feske fdbf30fc4c Xml_node: replace value(T *out) by value(T &out)
Promote the use of references instead of pointers.

Issue #1987
2019-01-30 13:49:54 +01:00
Norman Feske af146e7dcd Remove base/timed_semaphore.h from API
The former 'Genode::Timed_semaphore' mechanism is moved to the private
part of the two remaining users, namely dde_rump and the libc. Note
there are now two private copies of 'timed_semaphore.h'. This should be
regarded as an interim step until the use of this mechanism is removed
from both users.

This patch also cleans up the mechanism from legacy Genode API calls and
global side effects (alarm-thread singleton). The test/timed_semaphore
is now located at the libports repository as it now tests a mechanism of
the libc. The former timed_semaphore library is no more.

Fixes #3121
2019-01-30 13:35:29 +01:00
Alexander Boettcher 9a2bdf8798 vm_session: move from base-hw to base
Issue #3111
2019-01-30 13:35:28 +01:00
Stefan Kalkowski c65860ee53 enable i.MX6 Quad Sabrelite board for hw and foc 2019-01-30 13:35:28 +01:00
Stefan Kalkowski 6b4d76739e base: remove Signal_receiver::pending() method
Fix #1864
2019-01-30 13:35:28 +01:00
Norman Feske bf62d6b896 Move timer from os to base repository
Since the timer and timeout handling is part of the base library (the
dynamic linker), it belongs to the base repository.

Besides moving the timer and its related infrastructure (alarm, timeout
libs, tests) to the base repository, this patch also moves the timer
from the 'drivers' subdirectory directly to 'src' and disamibuates the
timer's build locations for the various kernels. Otherwise the different
timer implementations could interfere with each other when using one
build directory with multiple kernels.

Note that this patch changes the include paths for the former os/timer,
os/alarm.h, os/duration.h, and os/timed_semaphore.h to base/.

Issue #3101
2019-01-14 12:33:57 +01:00
Norman Feske cd29ca3c40 base: add List_model::apply_first
The new 'apply_first' method enables users of the list model to manually
traverse the list model via the 'Element::next' method instead of
iterating via 'for_each'. This is needed in situations where the
list-model elements are visited via recursion, not via a loop.

Issue #3094
2019-01-07 12:33:56 +01:00
Alexander Boettcher 67fd3333e2 base: avoid null pointer reference warning
Issue #3022
2019-01-07 12:25:45 +01:00
Alexander Boettcher 1ec0619b3e base: avoid warnings in fifo.h
error: member 'Element' found in multiple base classes of different types

Issue #3022
2019-01-07 12:25:45 +01:00
Alexander Boettcher 7536b665f1 core: avoid null pointer reference warning
Issue #3022
2019-01-07 12:25:44 +01:00
Martin Stein 79ca4e1718 init: show args on "denied env session" error
It can be hard to resolve "denied env session" errors when you don't have the
session label.
2019-01-07 12:25:43 +01:00
Johannes Schlatow 4e375ec6df zynq: move RAM size to board defs 2018-11-29 11:46:02 +01:00
Norman Feske 19d7a488de init: health monitoring of child components
Fixes #3039
2018-11-27 11:36:34 +01:00
Stefan Kalkowski d56a7beadc hw: increase cpu frequency on Wandboard Quad
Ref #1807
2018-11-16 15:17:06 +01:00
Alexander Boettcher f53a56982c clang: use template keyword on template methods
avoids tons of warnings

Issue #3022
2018-11-16 14:37:18 +01:00
Alexander Boettcher f7364d8463 base: avoid warnings in list.h
clang:

error: member 'Element' found in multiple base classes of different types

Issue #3022
2018-11-16 14:37:18 +01:00
Alexander Boettcher 17f7147ac1 base: avoid warnings about shift operations
clang:
 warning: The result of the '<<' expression is undefined
2018-11-16 14:37:18 +01:00
Alexander Boettcher 4b62f091a9 base: fix accessibility of enum in bit_array.h
avoids warning by clang:

error: 'BITS_PER_WORD' is a private member of 'Genode::Bit_array_base'

Issue #3022
2018-11-16 14:37:18 +01:00
Ehmry - 3958ea50a0 Allocator_avl: apply_any method
Provide an `apply_any` method for accessing any member of the allocator,
this is provided for destructing members of the allocator.

Ref #2996
2018-10-29 09:36:22 +01:00
Alexander Boettcher 5446c52c43 base: make Entrypoint placeable on specific cpu
Fixes #3008
2018-10-29 09:36:22 +01:00
Alexander Boettcher b8cc468f02 base: support assignment of invalid weak_ptr
This fixes the region-map component implementation in core, which uses a
'Genode::Weak_ptr<Genode::Region_map_component> _faulting_region_map'
member. This member is assigned a valid weak_ptr or an invalid weak_ptr
according to the state machine.

Fixes #3012
2018-10-29 09:36:22 +01:00
Norman Feske 7d641d5f1f base: add Reconstructible::conditional method
The new 'conditional' method simplifies the typical use case for
'Constructible' objects where the constructed/destructed state depends
on a configuration parameter. The method alleviates the need to
re-implement the logic again and again.

The patch also removes the 'Reconstructible' constructor arguments
because they are unused.

Fixes #3006
2018-10-29 09:36:21 +01:00
Martin Stein 364f69edad Xml_generator: fix and test missing '\0'
Ensure that a '\0' always appears at the end of the ouput of the XML
generator.  Previously, exceptions during the Node(...) constructor
might have prevented this. This commit also extends the xml_generator
test to drive a harder test on exceptions in the Xml_generator.

Issue #2953
2018-10-29 09:36:20 +01:00
Martin Stein 85d589a49c Xml_generator: fix exception handling in Node(...)
When the functor provided to the Node constructor throws an exception,
do revert all changes in reverse order. Previously, the changes made
to the parent node were not considered by the exception handler which
caused unnecessary characters to remain in the out buffer for each
reverted node.

Issue #2953
2018-10-29 09:36:20 +01:00
Martin Stein cc4a72243d print_lines: fix bugs in line length calculation
1) The loop for determining the line length read from a character offset
   before checking whether the offset is smaller than the given string
   length. This could have caused access outside the string buffer.

2) The routine for determining the line length first seeked for the
   offset of the last real character of the line and than added one for
   getting the length but only if the following character was '\n'. This
   has to be done for any other line-terminating character too. The only
   case where you don't want to do this is when the end of the whole
   string is reached.

Issue #2967
2018-09-13 15:21:11 +02:00
Norman Feske ac0562ec18 base: avoid Pd_session::Invalid_session condition
By adding a sanity check for the validity of the PD session targeted by
a transfer_quota operation, the corner case of an incomplete PD session
of a child can no longer trigger an 'Invalid_session' exception.
2018-08-02 14:36:44 +02:00
Norman Feske 4b46abf813 base: rm first-class support for static binaries
This patch removes the detection of statically linked executables from
the base framework. It thereby fixes the corner cases encountered with
Sculpt when obtaining the binaries of the runtime from the depot_rom
service that is hosted within the runtime.

Statically linked binaries and hybrid Linux/Genode (lx_hybrid) binaries
can still be started by relabeling the ROM-session route of "ld.lib.so"
to the binary name, pretending that the binary is the dynamic linker.
This can be achieved via init's label rewriting mechanism:

  <route>
    <service name="ROM" unscoped_label="ld.lib.so">
      <parent label="test-platform"/> </service>
  </route>

However, as this is quite cryptic and would need to be applied for all
lx_hybrid components, the patch adds a shortcut to init's configuration.
One can simply add the 'ld="no"' attribute to the <start> node of the
corresponding component:

  <start name="test-platform" ld="no"/>

Fixes #2866
2018-08-02 14:36:38 +02:00
Martin Stein fbe9d26c47 trace: initialize trace control in Thread::start
Previously, the trace control of a thread was initialized in its
constructor (which is generic for all components). This has the
disadvantage that the CPU-session-pointer member of the thread might not
be valid at this point. And it cannot be replaced by using the
"deprecated_env" CPU session neither as constructing the deprecated
environment in causes troubles in Core. But as the trace control
shouldn't be needed in Core anyway, the initialization can be moved to
the Thread::start implementation of non-core components. This code
already takes care of the CPU session pointer.

Fixes #2901
2018-08-02 14:36:35 +02:00
Norman Feske a3858bff3c base: handle cancelation of session creation
This patch improves the handling of the corner case where a client
vanishes while a session request is in flight (CREATE_REQUESTED but
not yet AVAILABLE). This corner case could be sporadically observed with
the init_loop test on base-linux.

In the original version, the session would eventually be delivered but
never picked up by anyone. Such a stale session still uses resources that
should better be released. In the new version, the parent checks for the
liveliness of the client whenever a session is delivered. If there is no
client of the session, a close request is immediately issued to the
server. The session state must be preserved until the close requests has
been answered.
2018-07-03 09:39:32 +02:00
Ehmry - 98f1d83194 Automatic session quota upgrades for RM connections
Fix #2838
2018-06-29 10:44:54 +02:00
Martin Stein fc90c5f8f0 session_label: make typedef String public
Internally, Genode::Session_label has a typedef from String<capacity()> to
String. To have this typedef public is especially useful when reading a
label from an XML node. This can then be written as

! Session_label label = node.attribute_value("label", Session_label::String());

instead of

! Session_label label = node.attribute_value("label", String<160>());

which would be less generic (Session_label cannot be used directly as there
is no appropriate ascii_to implementation).

Issue #2840
2018-06-29 10:40:14 +02:00
Alexander Boettcher ef482513c4 base: reset unfinished xml nodes in xml_generator
Fixes #2855
2018-06-13 13:50:35 +02:00
Norman Feske 81613afa03 base: fix quota transfer to async env services
Whenever an environment session was provided by an asynchronous service,
e.g., the depot_rom of the sculpt scenario, the session quota was not
transferred to the server at session-creation time. This resulted in a
slow depletion of the server's quota over time. This patch ensures that
the delivery of session quota is consistent with the information
reported to the server as session argument.
2018-06-12 12:11:47 +02:00
Norman Feske 7b6b3a4535 base: fix destruction of async env sessions
When an environment session is provided by a async service such as a
sibling component, the session metadata must be preserved until end of
the lifetime of the session at the server has been acknowledged by the
server. Since the session meta data of env sessions are always part of
the 'Child' object, the destruction of this object must be deferred
until this point.
2018-05-30 13:36:30 +02:00
Alexander Boettcher e6d20aba93 base: support to attach RAM dataspaces readonly
Fixes #1633
2018-05-30 13:36:27 +02:00
Norman Feske 24e6b677bd util/list_model.h: graceful handling of duplicates
This patch makes the 'List_model' utility robust against duplicated
occurrences of node IDs in the supplied XML data. If two or more XML
nodes correspond to the same model element, the existing element is
updated with the information of the subsequent XML nodes.
2018-05-30 13:36:18 +02:00
Martin Stein 2bd163533b string.h: ascii_to for unsigned char
Issue #2795
2018-05-30 13:36:11 +02:00
Norman Feske bf0ef1b8eb base: remove unused argument name in list_model.h
Needed to use the utility with -Weffc++.
2018-05-30 13:36:09 +02:00
Johannes Schlatow 9fc3344ee8 trace/buffer: keep "last" entry on wraps
When the former trace buffer implementation wrapped, the last entry
according to commit order couldn't be detected anymore. Now, the last
committed entry is always followed by an entry with length 0.

As a downside of this, there are now two meanings of "last" entry: It
means either that the entry marks the empty padding after the entry with
the highest memory address or that it actually marks the end of the
buffer according to commit order. This is an example state of the buffer
with the two types of "last" entry:

                           last                                     last
+-------------+------------+---+---------+-------------+------------+---+-------+
| len3  data3 | len4 data4 | 0 | empty   | len1  data1 | len2 data2 | 0 | empty |
+-------------+------------+---+---------+-------------+------------+---+-------+

If the entry with the highest memory address fits perfectly, the first
type of "last" entry is not needed:

                                  last
+------------+--------------------+---+-------+-------------+-------------------+
| len3 data3 | len4         data4 | 0 | empty | len1  data1 | len2        data2 |
+------------+--------------------+---+-------+-------------+-------------------+

If the buffer didn't wrap so far, there is only one "last" entry that
has both meanings:

                                                      last
+--------------------------+------------+-------------+---+---------------------+
| len1               data1 | len2 data2 | len3  data3 | 0 | empty               |
+--------------------------+------------+-------------+---+---------------------+

Issue #2735

Co-authored-by: Martin Stein <martin.stein@genode-labs.com>
2018-05-03 15:31:54 +02:00
Stefan Kalkowski f653be1ebc gpio_drv: add support for i.MX6
Fix #2750
2018-04-19 12:38:24 +02:00