Commit Graph

617 Commits

Author SHA1 Message Date
Norman Feske 6d82dd14d6 mk: access linker scripts via BASE_DIR
The use of 'select_from_repositories' for locating the linker script for
dynamically-linked executables only works if 'BASE_DIR' appears in the
list of 'REPOSITORIES'. This is the case when using the build system in
the traditional way but it is not desired when building binary archives
of individual components.
2017-04-11 15:34:16 +02:00
Christian Helmuth b35df4578b Check Registered base class provides virtual destructor
The base class of Registered must provide a virtual destructor to enable
safe deletion with just a base class pointer. This requirement can be
lifted by using Registered_no_delete in places where the deletion
property is not needed.

Fixes #2331
2017-03-24 16:20:04 +01:00
Christian Helmuth cb43e04691 ldso: defer execution of static constructors
Ldso now does not automatically execute static constructors of the
binary and shared libraries the binary depends on. If static
construction is required (e.g., if a shared library with constructor is
used or a compilation unit contains global statics) the component needs
to execute the constructors explicitly in Component::construct() via
Genode::Env::exec_static_constructors().

In the case of libc components this is done by the libc startup code
(i.e., the Component::construct() implementation in the libc).

The loading of shared objects at runtime is not affected by this change
and constructors of those objects are executed immediately.

Fixes #2332
2017-03-24 16:20:04 +01:00
Norman Feske 48d1141917 core: improve formatting of allocator dumps
This patch uses the 'Hex_range' and 'Number_of_bytes' utilities to make
the formatted output of 'Allocator_avl_base' better readable.
2017-03-24 16:19:58 +01:00
Norman Feske d56374e4b9 base: handle 0 in Number_of_bytes::print
This patch avoids printing the number 0 as "0G".
2017-03-24 16:19:58 +01:00
Norman Feske d227db4574 base: destruction order of binary/linker ROMs
This patch destructs the environment sessions for the binary and the
dynamic linker along with the other environment sessions to avoid a
warning about reverting quota that occurs when attempting to close
these sessions too late.
2017-03-24 16:19:57 +01:00
Norman Feske 0202048eb6 base: gracefully handle invalid env session routes
This patch addresses the corner cases where an environment session
could not be routed, i.e., if an environment LOG log session is
routed to a non-existing child.
2017-03-24 16:19:56 +01:00
Norman Feske 48174ab974 base: pass separate label to Local_connection
This patch extends the constructor of 'Local_connection' with an
optional 'label' argument, which was previously passed implicitly as
part of the 'args' argument. Keeping the label separate from 'args'
enables us to distinguish the client-specified label from a label that
resulted from a server-side label as it is used when rewriting a label
of an environment session (i.e., the binary name) in init's routing
policy. In principle, this patch eliminates the need for init's
explicite handling of the binary name via the '<binary>' node, or
at least allows us to simplity the binary-node handling.
2017-03-24 16:19:55 +01:00
Alexander Boettcher 391339a4bb base: handle race in Genode::Registry class
The race may happen when element objects get destructed by another thread then
the thread handling the for_each loop. In this case it may happen that the
object is already destructed (left the ~Element destructor) but the thread
handling the loop touches the invalid memory afterwards (the Element lock).

detected during issue #2299

Fixes #2320
2017-03-15 12:32:28 +01:00
Christian Helmuth b9834bc388 Rename Linux audio driver to linux_audio_drv
Related to #2190
Fixes #2278
2017-03-15 12:32:27 +01:00
Christian Helmuth 43e7cc56a3 Rename Linux NIC driver to linux_nic_drv
Related to #2190
Issue #2278
2017-03-15 12:32:27 +01:00
Stefan Kalkowski f1b632af68 affinity.run: do not test non-SMP platforms 2017-03-15 12:32:25 +01:00
Martin Stein 0bb752674f panda: fix timer speed
Previously we had configured the timer for the Panda ES with 700 MHz
CPU clock. But the Panda A6 that we use as reference now runs with
800 MHz.

Fixes #2308
2017-03-15 12:32:24 +01:00
Martin Stein e744c76bf2 mmio: make base address member private
Ref #2196
2017-03-15 12:32:24 +01:00
Martin Stein ecbb7534b9 register set: make noncopyable
If a register set gets copied, the '_plain_access' of the copy references
the plain access object of the original object.

Ref #2196
2017-03-15 12:32:23 +01:00
Alexander Boettcher bed28dfe49 base: extend cxa guards to support threads on various priorities
Fixes #2299
2017-03-15 12:32:23 +01:00
Alexander Boettcher 16e6533a0a base: extend thread test to test cxa guards
with various priorities.

Showcases issue #2299
2017-03-15 12:24:45 +01:00
Martin Stein 442c24420d mmio: separate MMIO access and register logic
By separating the plain MMIO access implementation from the generic bit
and offset logic of registers, we can now use the latter also with other
types of register access like I2C. The register and MMIO front-ends have
not changed due to the separation.

Ref #2196
2017-03-15 12:24:42 +01:00
Alexander Boettcher 25ac3cdd86 base: handle twice Lock::lock calls correctly
to avoid loosing threads in the applicants list if lock owner calls 'twice'
Lock::lock().

Fixes #2300
2017-03-15 12:24:42 +01:00
Alexander Boettcher 8102b78d22 base: extend thread test to test locks
Showcase issue #2300
2017-03-15 12:24:42 +01:00
Christian Helmuth 40f319e9e9 Terminate if pure virtual function is called
Fixes #2229
2017-03-15 12:24:41 +01:00
Norman Feske 226ff08304 core: increase stack size of init-child entrypoint
With the commit "init: session-label rewriting", the stack usage
increased due to the handling of session-label strings as local
variables. The stack overrun occurred in the vmm scenario on
base-hw.
2017-02-28 13:00:44 +01:00
Martin Stein daaddbd584 base*, os: get rid of all env() calls
Issue #1987
2017-02-28 13:00:42 +01:00
Martin Stein 56cafb3b57 hw: fix race in signal dispatching
There was a race when the component entrypoint wanted to do
'wait_and_dispatch_one_signal'. In this function it raises a flag for
the signal proxy thread to notice that the entrypoint also wants to
block for signals. When the flag is set and the signal proxy wakes up
with a new signal, it tried to cancel the blocking of the entrypoint.
However, if the entrypoint had not reached the signal blocking at this
point, the cancel blocking failed without a solution. Now, the new
Kernel::cancel_next_signal_blocking call solves the problem by storing a
request to cancel the next signal blocking of a thread immediately
without blocking itself.

Ref #2284
2017-02-28 13:00:41 +01:00
Norman Feske 29b8d609c9 Adjust file headers to refer to the AGPLv3 2017-02-28 12:59:29 +01:00
Sebastian Sumpf 35d2d582a4 base: free 'Cpu_free_component' from EP construction fails
It can happen that when Cpu_free_component is constructed the insertion
of the object through 'manage' succeeds for the EP put not for the pager
EP, which in turn raises an Out_of_meta_data exception. Because we are
within the constructor, the descstructor is not called, leading to a
dangling object pool entry for the EP.

issue #2289
2017-02-28 12:59:28 +01:00
Norman Feske fcb861689a base: support for re-validating session routes
This patch supplements 'Session_state' with the methods needed to test
the validity of a session with a changed routing policy.
2017-02-28 12:59:26 +01:00
Sebastian Sumpf 553a4222f4 base: entrypoint dissolve signal proxy
If not dissolved in ~Entrypoint, the signal proxy is found within NOVA's
and FOC's object pool upon Rpc_entrypoint destruction. This leads to a
deadlock because the signal proxy is destructed before the RPC EP.

issue #2284
2017-02-28 12:59:24 +01:00
Norman Feske dfc4c58782 root/component.h: POLICY::release on exception
This patch ensures that the POLICY::release is called whenever the
session creation aborted with an exception. In the original version, an
exception like 'Quota_exceeded' caused a single-session root interface
to deny subsequent session requests.
2017-02-28 12:59:24 +01:00
Norman Feske 7d9f68493a base: support for multi-staged child startup
This patch enhances the 'Child' and 'Child_policy' with the ability to
separate the different steps of bootstrapping children. If the
'Child_policy::initiate_env_sessions()' returns false, the child's
environment sessions remain unrouted at construction time. This way,
child objects for many children can be initialized to a state that
allows the children to represent services for other children. Therefore,
session routing can be applied before any child executes.

At this stage, the environment RAM sessions of all children can be
created. Note that this step still has the limitation that RAM sessions
are generally expected to be provided by either the parent or a local
service.

Once all children are equipped with RAM, they can in principle receive
session-quota donations. Hence, all other environment sessions can now
be arbitrarily routed and initiated.

Once the environment of a child is complete, the child's process and
initial thread is created.
2017-02-28 12:59:23 +01:00
Norman Feske 9cba459958 base: remove Child::heap
This patch improves the accounting for the backing store of
session-state meta data. Originally, the session state used to be
allocated by a child-local heap partition fed from the child's RAM
session. However, whereas this approach was somehow practical from a
runtime's (parent's) point of view, the child component could not count
on the quota in its own RAM session. I.e., if the Child::heap grew at
the parent side, the child's RAM session would magically diminish. This
caused two problems. First, it violates assumptions of components like
init that carefully manage their RAM resources (and giving most of them
away their children). Second, if a child transfers most of its RAM
session quota to another RAM session (like init does), the child's RAM
session may actually not allow the parent's heap to grow, which is a
very difficult error condition to deal with.

In the new version, there is no Child::heap anymore. Instead, session
states are allocated from the runtime's RAM session. In order to let
children pay for these costs, the parent withdraws the local session
costs from the session quota donated from the child when the child
initiates a new session. Hence, in principle, all components on the
route of the session request take a small bite from the session quota to
pay for their local book keeping

Consequently, the session quota that ends up at the server may become
depleted more or less, depending on the route. In the case where the
remaining quota is insufficient for the server, the server responds with
'QUOTA_EXCEEDED'. Since this behavior must generally be expected, this
patch equips the client-side 'Env::session' implementation with the
ability to re-issue session requests with successively growing quota
donations.

For several of core's services (ROM, IO_MEM, IRQ), the default session
quota has now increased by 2 KiB, which should suffice for session
requests to up to 3 hops as is the common case for most run scripts. For
longer routes, the retry mechanism as described above comes into effect.
For the time being, we give a warning whenever the server-side quota
check triggers the retry mechanism. The warning may eventually be
removed at a later stage.
2017-02-28 12:59:23 +01:00
Norman Feske 9d683a56a0 base: add Child_policy::session_state_changed()
This method is a hook to enable a runtime to respond to state changes.
In particular, in init this hook is used to trigger the generation of a
new state report, if configured.

Furthermore, the patch introduces the 'generate_client_side_info' and
'generate_server_side_info' methods to the 'Session_state', which
generates an XML representation of the session states to appear in
reports produced by init.

Issue #2246
2017-02-28 12:59:22 +01:00
Martin Stein d301022fe7 nic_router.run: do not append but concatenate
Makes the script more readable and saves 100 LOC.

Ref #2193
2017-02-28 12:59:22 +01:00
Martin Stein 412c5e5be4 run/platform_drv: add append-free interface
Normally, the platform driver helpers adapt the global run variables directly
via append. But the introduction of a more elegant run script style, that
incorporates dependent strings inline may be a good idea. Thus, we need the
backends of the helpers available as functions that return their string rather
than appending it.

The old interface still exists and uses the new interface as backend.

Ref #2193
2017-02-28 12:59:22 +01:00
Norman Feske bfdadc55b2 base: Add Number_of_bytes::print method
This method attempts to print the number with a K/M/G unit if possible
and thereby increases the human readability of generated output.
2017-02-28 12:59:20 +01:00
Norman Feske c0af463b81 base: Add Child_policy::Route
The new return value of 'resolve_session_request' allows the child
policy to define the label used as the policy selector at the server.

Because this patch introduces the distinction of the child-provided
label from the label as presented to the server along with the session
request, the latter is now handled as a dedicated 'Session_state'
argument.

Issue #2248
2017-02-28 12:59:20 +01:00
Norman Feske 8e6306e8e3 base: tolerate nested signal handling (but warn) 2017-02-27 15:37:50 +01:00
Sebastian Sumpf b66716d278 base: entrypoint 'wait_and_dispatch_one_signal'
There existed a race when 'wait_and_dispatch_one_signal' is called form
a RPC context, because the 'signal_proxy' or 'main' will block and the
signal semaphore, when the EP then calls 'wait_and_dispatch_one_signal',
the signal proxy is woken up ands sends an RPC to the EP, leading to a
dead lock if no further signal arrive, because the EP will then remain
blocked in the signal semaphore.

Therefore, for this case, the signal proxy will now perform a semaphore
up operation and does not perform an RPC if the EP is within
'wait_and_dispatch_one_signal'.
2017-02-27 15:37:50 +01:00
Johannes Schlatow 762728fee0 base: remove superfluous line feeds in print_lines
Fixes #2279
2017-02-23 15:03:29 +01:00
Christian Helmuth 6e5f3d432e Post signal-handler hook in entrypoint
A Signal_handler may schedule a hook function that is executed after the
signal handler returned. This can be used if the hook function may
trigger a (nested) signal handler by means of
wait_and_dispatch_one_signal(). Otherwise, an occurrence of the same
signal that triggered the original signal handler results in a dead lock
just before calling the nested handler (due to the Signal_context
destruction lock).
2017-02-23 14:54:51 +01:00
Stefan Kalkowski cf943dac65 hw: bootstrap into kernel
Put the initialization of the cpu cores, setup of page-tables, enabling of
MMU and caches into a separate component that is only used to bootstrap
the kernel resp. core.

Ref #2092
2017-02-23 14:54:42 +01:00
Stefan Kalkowski a97e92c7ec base: make Allocator_avl::_avl_tree accessable
This hook allows the export of the allocator's state by a derrived
class. I.e., the final state of the allocator used for bootstrapping
core.

Ref #2092
2017-02-07 19:20:30 +01:00
Stefan Kalkowski 7c8281f2d6 util: turn max, min, and abs into const_expr
Ref #2092
2017-02-07 19:20:29 +01:00
Stefan Kalkowski 786a81c846 core: unify log() initialization between kernels
* initialize the log environment implicitly for core
* removing the redundant lock
* unify between base-hw and all others

Ref #2092
2017-02-07 19:20:29 +01:00
Josef Söntgen f26532803f core: use proper size in Trace-Policies Tslab
Issue #2260.
2017-02-07 11:12:26 +01:00
Emery Hemingway 92978933c7 root/component: log error on Out_of_memory
Servers should account and handle this condition locally.
2017-02-07 11:12:24 +01:00
Norman Feske aa29ebe751 base/shared_object.h: add missing includes 2017-02-07 11:12:23 +01:00
Christian Prochaska a1b4e905ab Signal_receiver::wait_for_signal(): check for pending signal before blocking
Fixes #2267
2017-02-07 11:12:23 +01:00
Christian Helmuth ce3d10465e Mark warnings from the signal dispatcher as such 2017-01-31 14:58:36 +01:00
Christian Helmuth 7386c4e1d1 More robust handling of suspend in entrypoint
First, calls to manage and dissolve signal contexts now check if the
signal receiver was constructed. There is a small window during suspend
where it is destructed before reconstructed again.

Last, we ensure that processing of incoming signal was deblocked by the
suspend signal before entering the suspend operation. This way we ensure
already queued signal are handled.
2017-01-31 14:58:36 +01:00
Alexander Boettcher dd5592cc50 Fix String(Hex()) usage
- additional add test casye to log.run

Fixes #2265
2017-01-31 12:02:21 +01:00
Norman Feske cd3a5852d6 Warn about the use of deprecated headers
This commit enables compile-time warnings displayed whenever a deprecated
API header is included, and adjusts the existing #include directives
accordingly.

Issue #1987
2017-01-31 12:01:18 +01:00
Stefan Kalkowski c76c199f8d hw: enable SMP for Wandboard (fix #2253) 2017-01-31 12:01:16 +01:00
Martin Stein ed62199957 test/reconstructible: move to base
The test uses only stuff from the base repo.

Ref #1987
2017-01-31 12:01:15 +01:00
Martin Stein d1134644cc test/synced_interface: move to base
The test uses only stuff from the base repo.

Ref #1987
2017-01-31 12:01:15 +01:00
Norman Feske 47a129c6af run/platform_drv.inc: add 'need_usb_hid' function
This function returns the information whether the used platform relies
on USB HID for interactive scenarios by default as is the case for most
ARM platforms. In contrast, for x86 the USB driver can be omitted because
we can use the PS/2 driver (that is readily available in repos/os/).
2017-01-31 12:01:12 +01:00
Alexander Boettcher f52c44647f core: replace misleading avl warning in detach
If the detach address is not the beginning of the region, one gets:

"virtual void Genode::Allocator_avl_base::free(void*): given
 address (0x180e0) is not the block start address (0x18000)"

Instead, print an explicit warning in front of the detach call.
2017-01-31 12:01:12 +01:00
Norman Feske 02d5efcf3f init: apply routing to environment sessions
The init component used to create the CPU/RAM/PD/ROM sessions (the child
environment) for its children by issuing session requests to its parent,
which is typically core. This policy was hard-wired. This patch enables
the routing of the environment sessions of the children of init
according to the configured routing policy.

Because there is no hard-wired policy regarding the environment sessions
anymore, routes to respective services must be explicitly declared in
the init configuration. For this reason, the patch adjusts several run
scripts in this respect.

This patch removes the outdated '<if-args>' special handling of session
labels. The '<if-args>' feature will eventually be removed completely
(ref #2250)

Issue #2197
Issue #2215
Issue #2233
Issue #2250
2017-01-31 12:01:11 +01:00
Norman Feske e43da51bd6 base: handle dangling env sessions in ~Child
This commit addresses the situation where an environment session
outlives the session-providing service. In this case, the env session
got already invaidated at the destruction time of the server. However,
the underlying session-state structure continues to exist until the
client is destructed. During the eventual destruction of such a dangling
environment session, we have to be careful not to interact with the
no-longer existing service.

Ref #2197
2017-01-20 16:47:01 +01:00
Norman Feske 21458e6efa base: destruction of env-session-providing child
This patch addresses the corner case of destructing a child that
provides an enviroment session to another child. Before this patch,
this situation could result in an infinite loop.

The problem was introduced as a side effect of issue #2197 "base: apply
routing policy to environment sessions".
2017-01-20 16:47:00 +01:00
Christian Prochaska ec5dbe66db trace_fs: API transition (fix 'deprecated' warnings)
Issue #1987
2017-01-20 16:46:58 +01:00
Christian Prochaska 7948a7261b ldso: constrain second linker symbol relocation pass on x86_64
Handle only GLOB_DAT relocations in the second relocation pass, like it is
done on x86_32 and ARM.

Fixes #2219
2017-01-20 16:46:55 +01:00
Norman Feske a7f40b24ca Warn about the use of deprecated env() function
This patch enables warnings if one of the deprecate functions that rely
in the implicit use of the global Genode::env() accessor are called.

For the time being, some places within the base framework continue
to rely on the global function while omitting the warning by calling
'env_deprecated' instead of 'env'.

Issue #1987
2017-01-13 13:07:13 +01:00
Norman Feske 73837ef56a init: print error for denied environment sessions
Fixes #2214
2017-01-13 13:07:08 +01:00
Stefan Kalkowski aa004cf211 base: transition to new API for tests (ref #1987) 2017-01-13 13:07:07 +01:00
Martin Stein 613f4171f3 sd_card: i.MX6 support
The i.MX6 driver shares most of its code with the i.MX53 driver.

Ref #2206
2017-01-13 13:07:06 +01:00
Stefan Kalkowski fc273f3840 run: remove vanished kernel/platform specifier 2017-01-13 13:07:01 +01:00
Stefan Kalkowski 3886686b83 hw: get rid of global makefiles specific to hw
This commit mostly removes the globally visible NR_OF_CPUS define
from the global makefile specifiers defined in the base-hw repository.
Whereever necessary it adds platform specific makefiles to the base
repository when they were missing.

Ref #2190
2017-01-13 13:06:55 +01:00
Norman Feske 3d7b92ea50 Generalize ABI mechanism to shared objects
This patch make the ABI mechanism available to shared libraries other
than Genode's dynamic linker. It thereby allows us to introduce
intermediate ABIs at the granularity of shared libraries. This is useful
for slow-moving ABIs such as the libc's interface but it will also
become handy for the package management.

To implement the feature, the build system had to be streamlined a bit.
In particular, archive dependencies and shared-lib dependencies are now
handled separately, and the global list of 'SHARED_LIBS' is no more.
Now, the variable with the same name holds the per-target list of shared
libraries used by the target.
2017-01-13 13:06:54 +01:00
Norman Feske 9745effc53 mk: remove obsolete PRG_LIBS variable 2017-01-13 13:06:53 +01:00
Norman Feske a360452a10 base: remove platform.mk and syscall.mk
The purpose of those libraries is now covered by the kernel-specific
syscall-<kernel> libraries.
2017-01-13 13:06:53 +01:00
Norman Feske 4da52517c1 Simpify startup of dynamically linked binaries
This patch removes the component_entry_point library, which used to
proved a hook for the libc to intercept the call of the
'Component::construct' function. The mechansim has several shortcomings
(see the discussion in the associated issue) and was complex. So we
eventually discarded the approach in favor of the explicit handling of
the startup.

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

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

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

Issue #2199
2017-01-13 13:06:52 +01:00
Sebastian Sumpf 6e14aa4364 ldso: mark functions used during self relocation
These functions are marked as always inline through the 'SELF_RELOC' macro. This
became necessary because on riscv functions calls are performed through the
global offset table, which is not initialized at this point.

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

  make run/log KERNEL=nova

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Issue #2190
Issue #2195
2016-12-23 16:50:28 +01:00
Alexander Boettcher e4a1904456 core: fix deadlock in region_map destruction
Introduced by:

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

    core: use weak_ptr for Rm_faulter and Region_map

    Issue #2086
2016-12-14 11:22:30 +01:00
Norman Feske ccffbb0dfc Build dynamically linked executables by default
Fixes #2184
2016-12-14 11:22:27 +01:00
Norman Feske d882277ce3 base: let ldso use the default stack size 2016-12-14 11:19:38 +01:00
Norman Feske 4e4cdacab3 base: trim main-thread size to 4/8 KiB
The main thread does no longer execute application code. It is solely
responsible for the initialization of the component's entrypoint and for
retrieving asynchronous notifications. Since the stack usage is no
longer dependent on application-specific code, we can significantly
shrink it to reduce the memory footprint of components. In the worst
case - should the stack overrun - we would observe a page fault because
the stack is placed in the stack area, surrounded by guard pages.
2016-12-14 11:19:38 +01:00
Norman Feske cc98cef770 genode_rel.ld: add .gcc_except_table to RO segment
By moving .gcc_except_table section to the read-only ELF segment, this
patch reduces the size of the dynamically allocated data/bss segment.
2016-12-14 11:19:37 +01:00
Norman Feske a387d68c2c base: use a default stack size of 64 KiB
This patch replaces the former machine-word-dependent default stack size
by the fixed value of 64 KiB which should suffice for components on both
32 and 64 bit. Previously, the default stack size on 64 bit was 128 KiB,
which is wasteful. If a component needs more stack than 64 KiB, it can
specify a custon stack size by implementing 'Component::stack_size'.
2016-12-14 11:19:37 +01:00
Norman Feske 28f5688dcf base: reduce size of initial stack from 32K to 4K
The initial stack is solely used to initialize the Genode environment
along with the application stack located in the stack area. It never
executes application code. Hence, we can make it small. To check that it
is not dimensioned too small, the patch introduces a sanity check right
before switching to the application stack.
2016-12-02 15:20:31 +01:00
Norman Feske 92460cdab7 base: remove initial heap chunk from heap
This change reduces the BSS segment by 32 KiB (on 64 bit).
2016-12-02 15:20:31 +01:00
Norman Feske 25a7ea3d40 base: rename 'Volatile_object' to 'Reconstructible'
Fixes #2151
2016-12-01 17:46:50 +01:00
Christian Helmuth 53271d8c5f Use default component stack size where appropriate 2016-11-30 13:38:06 +01:00
Edgard Schmidt f97e0f3fa0 Allow RPC arguments w/o default constructor
Fixes #2150
2016-11-30 13:38:03 +01:00
Norman Feske 6a24d70120 Fix clang compile errors
Thanks Keiko Nakata for reporting!

Fixes #2164
2016-11-30 13:37:07 +01:00
Norman Feske 5a1cef6381 Make label prefixing more strict
This patch unconditionally applies the labeling of sessions and thereby
removes the most common use case of 'Child_policy::filter_session_args'.
Furthermore, the patch removes an ambiguity of the session labels of
sessions created by the parent of behalf of its child, e.g., the PD
session created as part of 'Child' now has the label "<child-name>"
whereas an unlabeled PD-session request originating from the child
has the label "<child-name> -> ". This way, the routing-policy of
'Child_policy::resolve_session_request' can differentiate both cases.

As a consequence, the stricter labeling must now be considered wherever
a precise label was specified as a key for a session route or a server-
side policy selection. The simplest way to adapt those cases is to use a
'label_prefix' instead of the 'label' attribute. Alternatively, the
'label' attribute may used by appending " -> " (note the whitespace).

Fixes #2171
2016-11-30 13:37:07 +01:00
Alexander Boettcher c83eb515f9 base: sanity check for slab element allocation
Issue #1039
2016-11-30 13:37:06 +01:00
Alexander Boettcher b8f9f92731 base: remove allocation warning in heap
The heap typically first tries to allocate larger chunks than necessary, and
if it fails the actual minimal one. The first attempt already triggers warnings
which are not critical at all. If the second (critical) allocation fails,
then there are additionally checks and warnings already in place.

Issue #1039
2016-11-30 13:37:06 +01:00
Norman Feske 5ba245f476 base: minor style fixes 2016-11-30 13:37:06 +01:00
Alexander Boettcher 33b40ec5d9 base: free memory of object throwing exception
in constructor.

Extend test case to verify it and run it by autopilot.
2016-11-30 13:37:05 +01:00
Alexander Boettcher 03f0f38567 cxx: avoid warnings about cxx exception memory
Avoids warnings like

Warning: 2 dangling allocations at allocator destruction time

during noux process destruction.
2016-11-30 13:37:05 +01:00
Alexander Boettcher 3c4372210e core: remove redundant datastructure
Avl allocator provides a method to lookup any element, which is sufficient
to find all regions to destruct.

Issue #2173
2016-11-30 13:37:04 +01:00
Martin Stein 82443ddee6 thread test: handle capability ref-count overflow
Triggered by the create-as-many-threads test as it tries to
create as many threads as possible.

Ref #2120
2016-11-30 13:37:04 +01:00
Martin Stein 99f18a2fe6 core: handle cap-ref-cnt overflow in create_thread
The code in Core's Cpu_session_component::create_thread might throw a
capability refernce-count overflow if one creates many threads, which would
kill core if not handled.

Ref #2120
2016-11-30 13:37:04 +01:00
Martin Stein 288c2c50ba base: throw exception on cap-ref-count overflow
Ref #2120
2016-11-30 13:37:04 +01:00
Norman Feske cfdbccc5c2 Remove blocking calls from root and parent RPCs
This is a redesign of the root and parent interfaces to eliminate
blocking RPC calls.

- New session representation at the parent (base/session_state.h)
- base-internal root proxy mechanism as migration path
- Redesign of base/service.h
- Removes ancient 'Connection::KEEP_OPEN' feature
- Interface change of 'Child', 'Child_policy', 'Slave', 'Slave_policy'
- New 'Slave::Connection'
- Changed child-construction procedure to be compatible with the
  non-blocking parent interface and to be easier to use
- The child's initial LOG session, its binary ROM session, and the
  linker ROM session have become part of the child's envirenment.
- Session upgrading must now be performed via 'env.upgrade' instead
  of performing a sole RPC call the parent. To make RAM upgrades
  easier, the 'Connection' provides a new 'upgrade_ram' method.

Issue #2120
2016-11-25 16:06:42 +01:00
Norman Feske baf61df0fd base: new 'Registry' data structure
This data structure is meant as a safe alternative for a list wherever
the list is solely used to remember objects and iterate through them in
an unspecified order. One use case is the 'Service_registry'.
2016-11-25 15:30:58 +01:00
Norman Feske 513a3f1d37 base: new 'Id_space' data structure
This data structure allows the association of objects with IDs. IDs are
kept in an AVL tree. So in contrast to a bit allocator, the ID space can be
sparsely populated and does not need to be dimensioned. The lifetime of
an ID is bound to an 'Element' object, which relieves the programmer
from manually allocating/deallocating IDs for objects.

Issue #2120
2016-11-25 15:30:58 +01:00
Alexander Boettcher 81f0cacf66 core: prefer RAM allocation in high memory
We preserve lower RAM for device drivers with physical memory
constraints. If no physical RAM constraint exists, the allocations above
3G (32-bit) or 4G (64-bit) are preferred.
2016-11-25 15:30:57 +01:00
Christian Helmuth f75f199947 ldso: initialize ELF object before relocating
This fixes a regression on Ubuntu 16.04 (resp. Linux systems with recent
kernel versions) and address-space randomization originating from an
uninitialized relocation base of 0.
2016-11-25 15:27:28 +01:00
Norman Feske 82107bef9b base: buffer session args in 'Connection'
This patch is a preparation of the forthcoming async parent interface.
Note that this patch increases the size of connection objects.
Furthermore it adds a diagnostic message whenever a connection fails.

Issue #2166
2016-11-25 15:27:28 +01:00
Norman Feske ac1794ed7d base: add const operator * to 'Volatile_object' 2016-11-25 15:27:27 +01:00
Norman Feske 0e0f830a14 base: make Volatile_object noncopyable
Unfortunately, the volatile object does not inherit the noncopyable
attribute of the enclosed object. By making all volatile objects
noncopyable, we prevent the accidental copying of a noncopyable object
wrapped in a volatile object.
2016-11-25 15:27:27 +01:00
Norman Feske b8e98f2355 base: forward args in Output::print
The original version copied the arguments, which does not work for the
output of complex types, in particular non-copyable objects.
2016-11-25 15:27:27 +01:00
Norman Feske 35fa67768f base: add 'Volatile_object::print' method
The method prints the message "<unconstructed>" if the object is not
available. Otherwise, it prints the encapsulated object.
2016-11-25 15:27:26 +01:00
Stefan Kalkowski f60cf697d2 core: simplify Rom_module and Rom_fs
* replace print_fs with Output::print equivalent
* use Avl_tree::for_each instead of own implementation
* extend constness

Ref #2159
2016-11-08 15:45:21 +01:00
Stefan Kalkowski e1ec39e476 base: replace dump utilities in Allocator_avl
Replace 'dump()' debug utilities within Allocator_avl with Output::print
equivalents, and use the new Avl_tree::for_each utility to simplify
the implementation.

Ref #2159
2016-11-08 15:44:55 +01:00
Stefan Kalkowski 1542d92165 base: iterator for AVL tree (fix #2159) 2016-11-08 15:43:53 +01:00
Emery Hemingway eff90d759f remove global namespacing from internal base headers
Making the Genode namespace global can cause name collisions on
base-linux.

Fix #2158
2016-11-08 15:26:33 +01:00
Norman Feske f577c451ef increase stack size of signal-proxy thread
This fixes the warning "small stack of 3996 bytes [...] may break Linux
signal handling" on 32-bit base-linux.
2016-11-08 15:26:33 +01:00
Norman Feske 784e728727 Clean ldso from using deprecated APIs
Issue #1987
2016-11-08 15:26:32 +01:00
Norman Feske 20faa8b84e base: 'String' constructor overload for literals
This overload covers the common case for initializing a string from a
literal without employing the 'Output' mechanism. This way, such
strings can by constructed without calling virtual functions, which in
turn makes the 'String' usable for the 'init_rtld' phase of the dynamic
linker.
2016-11-08 15:26:31 +01:00
Norman Feske b9280678fb base-linux: fix race in region_map_mmap
This patch fixes a race condition triggered by the thread test running
on Linux inside VirtualBox. The 'test_stack_alloc' sporadically produced
one of two errors: A segfault in the 'Thread::deinit_platform_thread' on
the attempt to access the 'native_thread' of the to-be-destructed thread
(this data structure is located on the thread's stack). Or, an error
message about a region conflict within the stack area.

The problem was that two instances of 'Region_map_mmap' issued a
sequence of munmap and mmap each. Even though each instance locked the
attach/detach operations, the lock was held per instance. In a situation
where two instances performed attach/detach operations in parallel, the
syscall sequences could interfere with each other.

In the test scenario, the two region-map instances are the test's
address space and the stack area. When creating a thread, the thread's
trace-control dataspace is attached at an arbitrary place (picked by
the Linux kernel) within the address space whereas the stack is attached
at the stack area. The problem is the following sequence:

Thread A wants to destruct a thread:
1. Remove stack from stack area
   (issue unmap syscall)
2. Preserve virtual address range that was occupied from the stack
   so that Linux won't use it
   (issue mmap syscall)

Thread B wants to construct a thread:
1. Request trace-control dataspace from CPU session
2. Attach trace-control dataspace to address space at a location
   picked by the Linux kernel
   (issue mmap syscall)

The problem occurs when thread B's second step is executed in between
the steps 1 and 2 of thread A and the Linux kernel picks the
just-unmapped address as the location for the new trace-control mapping.
Now, the trace control dataspace is mapped at the virtual address that
was designated for the stack of the to-be-created thread, and the
attempt to map the real stack fails.

The patch fixes the problem by replacing the former region-map-local
locks by a component-global lock.

Furthermore, it cleans up core's implementation of the support function
for the region-map-mmap implementation, eliminating the temporary
unlocking of the region-map lock during RPC.
2016-11-08 15:26:30 +01:00
Norman Feske afed9cfd95 base: let string accept multiple arguments
Issue #2064
2016-11-08 15:26:30 +01:00
Stefan Kalkowski 7e1692d997 core: unify handling of boot modules
Instead of solving the problem to deliver ROM modules to core while booting
differently for the several kernels (multi-boot, elfweaver, core re-linking),
this commit unifies the approaches. It always builds core as a library, and
after all binaries are built from a run-script, the run-tool will link an
ELF image out of the core-library and all boot modules. Thereby, core can
access its ROM modules directly.

This approach now works for all kernels except Linux.

With this solution, there is no [build_dir]/bin/core binary available anymore.
For debugging purposes you will find a core binary without boot modules, but
with debug symbols under [run_dir].core.

Fix #2095
2016-11-08 15:26:27 +01:00
Norman Feske 9572ff9413 base: remove original PDBG from base/printf.h
This macro is superseded by base/debug.h.

Issue #2125
2016-11-08 15:26:27 +01:00
Emery Hemingway ef5f36bf4e Redefine PDBG to use new log output function
PDBG is redefined in base/debug.h, an aide to development which is not
to be included in release code.

Fix #2125
2016-10-21 12:45:44 +02:00
Stefan Kalkowski 2a2e5c2df4 base-*: remove usage of printf
base generic code:
  * Remove unused verbosity code from mmio framework
  * Remove escape sequence end heuristic from LOG
  * replace Core_console with Core_log (no format specifiers)
  * move test/printf to test/log
  * remove `printf()` tests from the log test
  * check for exact match of the log test output
base-fiasco:
  * remove unused Fiasco::print_l4_threadid function
base-nova:
  * remove unused hexdump utility from core
base-hw:
  * remove unused Kernel::Thread::_print_* debug utilities
  * always print resource summary of core during startup
  * remove Kernel::Ipc_node::pd_label (not used anymore)
base*:
  * Turn `printf`,`PWRN`, etc. calls into their log equivalents

Ref #1987
Fix #2119
2016-10-21 12:39:36 +02:00
Alexander Boettcher c99729093a base: fix race in multiple lock.unlock() calls
Fixes #2122
2016-10-21 12:39:34 +02:00
Alexander Boettcher 3449985fdf base: avoid deadlock in region_map destruction
Fixes #2115
2016-10-21 12:39:33 +02:00
Christian Prochaska 3a1f852318 base: don't use the 'size' argument in 'Heap::free()'
The Heap reports that 'free()' does not rely on a valid 'size' argument,
so it should not use it.

Fixes #2113
2016-10-21 12:39:32 +02:00
Stefan Kalkowski 3f6e148621 base: remove obsolete _prog_img_data symbol
Fix #2099
2016-10-21 12:39:31 +02:00
Emery Hemingway 80558374f5 base: print support for Xml_node
Ref #1987
2016-10-21 12:39:29 +02:00
Norman Feske e370e08e01 Define Genode::size_t as unsigned long
Fixes #2105
2016-10-21 12:39:29 +02:00
Alexander Boettcher 99fbb23ec5 core: use weak_ptr for Rm_faulter and Region_map
Fixes #2086
2016-09-14 11:53:04 +02:00
Stefan Kalkowski 2147c42ec6 base: unify page-fault notification for kernels
* Enable page-fault messages for regions not directly managed by core
* Unify output given when a page-fault occurs related to those regions

Fix #2082
2016-09-09 11:49:34 +02:00
Christian Helmuth 5a92c9b6eb Increase stack size of mp_server test 2016-09-09 11:48:43 +02:00
Christian Helmuth fcf5bc9187 base: start signal-proxy thread on construction
Thanks @ssumpf for the investigation.
2016-09-09 11:48:43 +02:00
Stefan Kalkowski e7d5b34fc5 base: String constructor for different lengths
Let the copy constructor compile for different CAPACITYs of
the String<CAPACITY> class.

Fix #2085
2016-09-09 11:48:43 +02:00
Norman Feske fac69eff48 core: handle out-of-memory in RM service
This patch adds the missing exception handling for depleted RM session
quotas. If core runs out of session quota while creating a new region
map, it now reflects this condition as a Region_map::Out_of_metadata
exception to the RM client. Thanks to Denis Huber for reporting the
issue!
2016-08-29 17:29:37 +02:00
Christian Prochaska d2e246d916 base: allow to set label in Log_connection
Fixes #2074
2016-08-29 17:29:36 +02:00
Norman Feske a845bdafeb core: fix regression in sig context ownership test
This patch fixes a problem similar to issue #2065 but for the freeing of
signal contexts.
2016-08-29 17:29:33 +02:00
Norman Feske 8d1cf08b1a core: fix regression in dataspace ownership test
This patch revives our ds_ownership test from 2012, which just revealed
a regression in core where the dataspace-free operation of the RAM
service would unconditionally destroy dataspace objects from foreign
sessions. The patch fixes the bug and adds an updated version of the
test to the autopilot.

Fixes #2065
2016-08-29 17:29:33 +02:00
Alexander Boettcher 9c098752b0 core: fix memory mapping calc. for big regions
Fixes #2063
2016-08-29 17:29:32 +02:00
Norman Feske 17c79a9e23 base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.

While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).

To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.

Issue #1987
2016-08-29 17:27:10 +02:00
Christian Prochaska a5d3aa8373 base: increase label length limit of core LOG session
Fixes #2061
2016-08-29 17:27:10 +02:00
Norman Feske 892f21fd54 base: document error-message style conventions 2016-08-29 17:27:10 +02:00
Norman Feske 26a4534a37 base: helper for hex-formatted output of ranges 2016-08-29 17:27:09 +02:00
Norman Feske 9c2f229246 base: helper for printing individual characters 2016-08-29 17:27:09 +02:00
Johannes Schlatow acd2a40076 base: print() functions for floating point types
Fixes #2055
2016-08-29 17:23:19 +02:00
Christian Helmuth 1776babbd1 Revert "arm: prevent 64K default alignment of text segment"
This reverts commit 2127c8acf2 because the
alignment is already sanitized by commit 11c31c4432.

(discussed here 2127c8acf2)
2016-08-10 11:07:57 +02:00
Alexander Boettcher 155621767a sel4: limit mp_server.run to 1 cpu for sel4
Issue #2044
2016-08-10 11:07:55 +02:00
Alexander Boettcher b5ff552460 base: extend core_mem_alloc free by phys_addr
required by base-sel4 to turn used page frames back to untyped memory

Issue #2044
2016-08-10 11:07:52 +02:00
Alexander Boettcher e89b28ca1b sel4: add signal support
Fixes #1716
Issue #2044
2016-08-10 11:07:51 +02:00
Alexander Boettcher 8b505306ed core: name initial threads not just "name"
to make debugging more comfortable

Issue #2044
2016-08-10 11:07:50 +02:00
Alexander Boettcher cb675a12d8 base: factor out irq parsing into helper header
to be used by sel4 in the next commit

Issue #2044
2016-08-10 11:07:50 +02:00
Alexander Boettcher 464181b01d base: refactor io_port session implementation
Split port API implementation into separate io_port_session_support.cc file,
so that base-sel4 may implement this part alternatively.

Issue #2044
2016-08-10 11:07:50 +02:00
Alexander Boettcher 027e89f91a base: catch uncaught exceptions of threads
and show some message about. On sel4 sometimes exceptions are thrown and no
message is shown, it just seems to hang. With this patch at least you get
an idea that something bad happened.

Issue #2044
2016-08-10 11:07:50 +02:00
Alexander Boettcher 5a0bc07d30 demo: make cancel_blocking working
- remove special handling from base-nova
- add to rpc_server where it actually should be applied to
- required to work for sel4 cancel_blocking

Issue #2044
2016-08-10 11:07:50 +02:00
Christian Helmuth 6726e6d7fe Increase quota of ACPI driver
Platforms with more complex ACPI configurations require more RAM in the
driver, e.g., ~160K for the test notebook on my desk.
2016-08-10 11:07:48 +02:00
Emery Hemingway 1ae0357171 base/sesson_label.h: do not prefix empty strings
Session_label prefix(a, b) shall not return ' -> b' or 'a -> '.

Issue #1787
2016-08-10 11:07:48 +02:00
Norman Feske 38a1e95979 base: add 'String::print' method
This way, we can conveniently output strings without calling the
string() method.
2016-07-15 11:38:27 +02:00
Norman Feske 2127c8acf2 arm: prevent 64K default alignment of text segment 2016-07-15 11:38:27 +02:00
Norman Feske 2cbef82b61 ldso-startup: support build from non-base repos
By always fetching the source relative to BASE_DIR, we can
include the ldso-startup.mk file from other repositories, i.e.,
API packages.
2016-07-15 11:38:27 +02:00
Norman Feske 345f22a5e7 mk: shortcircuit select_from_ports for pkg tool 2016-07-15 11:38:26 +02:00
Norman Feske b2fddf4b99 mk: always use linker scripts from base
The linker scripts are known to reside in BASE_DIR. By using them
directly from this location instead of searching them in the
REPOSITORIES, we don't need to specify the repos/base as a repository in
order to link.
2016-07-15 11:38:26 +02:00
Norman Feske a804802bcd Let default tools.conf cover each architecture
This patch handles x86_32 and x86_64 separately since this is the SPEC
value directly supplied to the package build tool. This way, we achieve
that a CROSS_DEV_PREFIX is defined for each supported argument.
2016-07-15 11:38:26 +02:00
Norman Feske 62d65d00e0 Remove signal-source headers from public API
Those headers implement a platform-specific mechanism. They are never
used by components directly.

This patch also cleans up a few other remaining platform-specific
artifact such as the Fiasco.OC-specific assert.h.

Issue #1993
2016-07-15 11:38:25 +02:00
Emery Hemingway 2b8c1af9e0 remove 'filename' from ROM sesion args
Conveying the ROM filename as the final label element simplifies
routing policy and session construction.

Annotations by nfeske:

This commit also changes the ROM session to use base/log.h instead of
base/printf.h, which produced build error of VirtualBox because the
vbox headers have a '#define Log', which collides with the content of
base/log.h. Hence, this commit has to take precautions to resolve this
conflict.

The commit alse refines the previous session-label change by adding a
new 'Session_label::prefix' method and removing the use of 'char const *'
from this part of the API.

Fixes #1787
2016-07-11 13:24:36 +02:00
Emery Hemingway f8337b511b Move Session_label from os to base
Session_label constructor now takes a bare string rather than a
serialized argument buffer.
Replace all instances of previous constructor with 'label_from_args'
function.

Issue #1787
2016-07-11 13:09:24 +02:00
Norman Feske 88b358c5ef Unification of native_capability.h
This patch establishes the sole use of generic headers across all
kernels. The common 'native_capability.h' is based on the version of
base-sel4. All traditional L4 kernels and Linux use the same
implementation of the capability-lifetime management. On base-hw, NOVA,
Fiasco.OC, and seL4, custom implementations (based on their original
mechanisms) are used, with the potential to unify them further in the
future.

This change achieves binary compatibility of dynamically linked programs
across all kernels.

Furthermore, the patch introduces a Native_capability::print method,
which allows the easy output of the kernel-specific capability
representation using the base/log.h API.

Issue #1993
2016-07-11 13:07:37 +02:00
Norman Feske d71f0a9606 Cleanup of parent-cap handling
This patch alleviates the need for a Native_capability::Dst at the API
level. The former use case of this type as argument to
Deprecated_env::reinit uses the opaque Native_capability::Raw type
instead. The 'Raw' type contains the portion of the capability that is
transferred as-is when delegating the capability (i.e., when installing
the parent capability into a new component, or when installing a new
parent capability into a new forked Noux process). This information can
be retrieved via the new Native_capability::raw method.

Furthermore, this patch moves the functions for retriving the parent
capability to base/internal/parent_cap.h, which is meant to be
implemented in platform-specific ways. It replaces the former set of
startup/internal/_main_parent_cap.h headers.

Issue #1993
2016-07-11 13:05:27 +02:00
Norman Feske f7bdd383e2 Remove base/native_types.h headers
Issue #1993
2016-07-11 12:06:50 +02:00
Christian Prochaska 29a12ab9a2 base: add 'Thread::mystack() function
The static 'Thread::mystack()' function returns the stack boundaries of
the calling thread. It is useful when a thread uses a diffent stack than
the primary one.

Fixes #2037
2016-07-11 12:06:05 +02:00
Christian Helmuth c8fe0df0ed Overloads for printing signed/unsigned/bool base types
Issue #1942
2016-06-28 11:09:28 +02:00
Alexander Boettcher 4e9aeb45ea platform_drv: sync startup between acpica
- platform_drv announces a separate "Acpi" session
- platform_drv waits for ROM "system" to change state to "acpi_ready"
- acpica waits for "Acpi" announcement
- acpica uses the platform driver via "Acpi" to reconfigure PCI devices
- acpica changes "system" state to "acpi_ready" after it ready with initialization
- platform_drv reacts on "system" state change to "acpi_ready" by announcing "Platform" session
- drivers start to operate as usual

Issue #2009
2016-06-22 12:21:42 +02:00
Norman Feske 2030ae678e Supplement base/log.h with raw output function
This patch introduces the Genode::raw function that prints output
directly via a low-level kernel mechanism, if available.

On base-linux, it replaces the former 'raw_write_str' function.
On base-hw, it replaces the former kernel/log.h interface.

Fixes #2012
2016-06-22 12:21:42 +02:00
Stefan Kalkowski 1e5c08bb1a base: invert hex value padding to correct meaning
Fix #1996
2016-06-06 09:38:29 +02:00
Christian Helmuth cf771c10d6 Improve tokenizing to support XML comments
The whole XML comment has to be parsed as one XML tag to support strange
but valid combinations like

  <!---->
  <!--invisible-tag></invisible-tag-->

Fixes #1424
2016-06-06 09:37:47 +02:00
Josef Söntgen 941a71346a base: add print method for unsigned long long
Fixes #1991.
2016-06-04 13:45:27 +02:00
Alexander Boettcher 6289a2379d base: deny session creation if quota insufficient
Quota_exceeded message are of no use during session construction, since
the arguments of the ram_quota are used and no upgrade can take place (the
session construction failed and is so not available for upgrade)

Fixes #1983
2016-05-31 12:02:05 +02:00
Alexander Boettcher 5c10653d8a slab: throw exception if initial allocation fails
Issue #1983
2016-05-31 12:02:04 +02:00
Norman Feske 97a41394b4 Documentation changes on account of the book
This patch removes the outdates doc/architecture.txt since the
topics are covered by the book. We keep repos/os/doc/init.txt
because it contains a few details not present in the book (yet).
The patch streamlines the terminology a bit. Furthermore, it
slightly adjusts a few source-code comments to improve the book's
functional specification chapter.
2016-05-26 15:54:16 +02:00
Norman Feske 357b84835a base: add modern Root_component constructor 2016-05-26 15:54:15 +02:00
Martin Stein 1208d14681 hw: use kernel timer for timer driver
* Adds public timeout syscalls to kernel API
  * Kernel::timeout installs a timeout and binds a signal context to it that
    shall trigger once the timeout expired
  * With Kernel::timeout_max_us, one can get the maximum installable timeout
  * Kernel::timeout_age_us returns the time that has passed since the
    calling threads last timeout installation

* Removes all device specific back-ends for the base-hw timer driver and
  implements a generic back-end taht uses the kernel timeout API

* Adds assertions about the kernel timer frequency that originate from the
  requirements of the the kernel timeout API and adjusts all timers
  accordingly by using the their internal dividers

* Introduces the Kernel::Clock class. As member of each Kernel::Cpu object
  it combines the management of the timer of the CPU with a timeout scheduler.
  Not only the timeout API uses the timeout scheduler but also the CPUs job
  scheduler for installing scheduling timeouts.

* Introduces the Kernel::time_t type for timer tic values and values inherited
  from timer tics (like microseconds).

Fixes #1972
2016-05-26 15:54:15 +02:00
Alexander Boettcher 57f47db823 platform_drv/x86: support ACPI reset
Evaluate fadt xml node in report from acpi_drv. If the io ports in the range
of 0xcf8+4 are necessary for the reset than the platform driver will
react on the 'system' state 'reset' and reboot.

Issue #1962
2016-05-26 15:54:14 +02:00
Alexander Boettcher 6b0022f032 platform_drv: drop deprecated config syntax
- policy entry without deprecated rom node
- skip if_arg and use label directly for routing

see Issue #1801

Issue #1962
2016-05-26 15:54:13 +02:00
Sebastian Sumpf ee05fb9259 base: Remove dynamic segment check from Elf_binary
Don't check for supported segment types of dynamic binaries, it is to
restrictive. If something goes wrong the dynamic linker will throw an error.
2016-05-23 15:52:51 +02:00
Christian Prochaska 44648bb5c7 tool_chain/cxx: use '__cxa_demangle()' for exception names
Fixes #1976
2016-05-23 15:52:50 +02:00
Christian Prochaska 2cde1d36c1 base: changes for GDB monitor
- add a new function 'binary_ready_hook_for_gdb()' in ldso. GDB can set a
  breakpoint at this function to know when ldso has loaded the binary
  into memory.
- get the thread state from the NOVA kernel immediately on 'pause()'

Fixes #1968
2016-05-23 15:52:49 +02:00
Norman Feske 807be83b1b Remove inconsistent use of 'is_' prefix
Fixes #1963
2016-05-23 15:52:39 +02:00
Norman Feske 15141f3ca7 Remove hand-crafted Rpc_functions typedefs 2016-05-23 15:52:39 +02:00
Norman Feske ef9a7d2230 base: remove length limit of Type_list 2016-05-23 15:52:39 +02:00
Norman Feske a99989af40 Separation of thread operations from CPU session
This patch moves the thread operations from the 'Cpu_session'
to the 'Cpu_thread' interface.

A noteworthy semantic change is the meaning of the former
'exception_handler' function, which used to define both, the default
exception handler or a thread-specific signal handler. Now, the
'Cpu_session::exception_sigh' function defines the CPU-session-wide
default handler whereas the 'Cpu_thread::exception_sigh' function
defines the thread-specific one.

To retain the ability to create 'Child' objects without invoking a
capability, the child's initial thread must be created outside the
'Child::Process'. It is now represented by the 'Child::Initial_thread',
which is passed as argument to the 'Child' constructor.

Fixes #1939
2016-05-23 15:52:39 +02:00
Christian Helmuth 3ba61a2ddf Move rust support to libports
Issue #1899
2016-05-23 15:52:38 +02:00
Norman Feske a7b3072cc2 Pass Env & as first argument to connection objects
This patch supplements each existing connection type with an new
constructor that is meant to replace the original one. The new
one takes a reference to the component's environment as argument and
thereby does not rely on the presence of the globally accessible
'env()' interface.

The original constructors are marked as deprecated. Once we have
completely abolished the use of the global 'env()', we will remove them.

Fixes #1960
2016-05-23 15:52:37 +02:00
Norman Feske 3361651e9e base: remove dependency from deprecated config lib
Issue #1959
2016-05-23 15:52:37 +02:00
Norman Feske 8da737acfd base: add Attached_rom_dataspace::xml method
Issue #1959
2016-05-23 15:52:36 +02:00
Norman Feske e0c0794f33 base: supplement comment of Xml_node constructor 2016-05-23 15:52:36 +02:00
Norman Feske 8d797105b3 Move Attach_*dataspace utils from os to base
Fixes #1958
2016-05-23 15:52:36 +02:00
Christian Helmuth 16914bddc8 Implement affinity test as component
This enables the use of the current Thread API to set thread affinity on
construction.
2016-05-23 15:52:36 +02:00
Norman Feske f6dec901bb base: remove Component::name from API
It turns out that the name function does not have much use in practice
except for naming the thread of the component's initial entrypoint. For
dynamically linked components, this thread is created by the dynamic
linker. It is named "ep" in these cases. Considering that we will
eventually turn all regular components into dynamically linked
executables, the additional information provided by the
Component::name() function remains unused. So it is better to not bother
the component developers with adding boilerplate code.
2016-05-23 15:49:56 +02:00
Waylon Cude 1e95af5bab Fixed linking and memory allocation for rust
Now rlibs are actually linked to programs. Target files have been
modified to not generate code that requires compiler-rt. Added a target
for libstd-rust, but it's very broken right now. Moved alloc_system to
the libports folder because either a memory allocator needs to be
written in rust or posix_memalign needs to be implemented. Changed
liblibc to use freebsd as the OS instead of netbsd. Added a library with
unwind dummy functions.

Rust relies on atomic builtins, which are not implemented in libgcc for
ARM. One was implemented in rust, which was sufficient to get the
current rust test to run. Rust libs were added into the group of libs
for the linker so order no longer matters. The raspberry pi now uses an
armv6 target.
2016-05-23 15:49:56 +02:00
Norman Feske ab88599682 base: document the return value of String::length 2016-05-23 15:49:56 +02:00