Commit Graph

85 Commits

Author SHA1 Message Date
Norman Feske bcdc706f42 Unify 'ipc.h' and 'ipc_generic.h' across platforms
The distinction between 'ipc.h' and 'ipc_generic.h' is no more. The only
use case for platform-specific extensions of the IPC support was the
marshalling of capabilities. However, this case is accommodated by a
function interface ('_marshal_capability', '_unmarshal_capability'). By
moving the implementation of these functions from the headers into the
respective ipc libraries, we can abandon the platform-specific 'ipc.h'
headers.
2013-02-14 13:23:37 +01:00
Norman Feske bbca9912e2 Remove 'Native_lock' type from 'native_types.h' 2013-02-14 13:23:36 +01:00
Norman Feske b1f63e3356 Turn 'platform_env.h' into a private header
This patch removes 'platform_env.h' from the public API headers because
this header was not part of the API anyway.
2013-02-14 13:23:36 +01:00
Alexander Boettcher 9453d319cb base: add remove_client to rm_session
Fixes #13
2013-02-11 12:01:25 +01:00
Norman Feske bef78dd9f8 Core: Fix registration of CPU exception handler 2013-01-11 22:16:25 +01:00
Norman Feske 73ab30c22c Update copyright headers to 2013 2013-01-10 21:44:47 +01:00
Alexander Boettcher e8c063a8b4 base: release signal context from signal list
Remove signal context object from signal source component list (_signal_queue)
before destruction, otherwise we get a dangling pointer.

On native hardware for base-nova, the signal source thread triggered page
faults in the Signal_source_component::wait_for_signal() method when the signal
context got freed up in Signal_session_component::free_context but was still
enqueued in Signal_source_component::_signal_queue.

Fixes #600
2013-01-10 21:17:42 +01:00
Alexander Boettcher c2d3543e62 base: replace obj_by_* by lookup_and_lock
Add functionality to lookup an object and lock it. Additional the case is
handled that a object may be already in-destruction and the lookup will deny
returning the object.

The object_pool generalize the lookup and lock functionality of the rpc_server
and serve as base for following up patches to fix dangling pointer issues.
2013-01-10 11:13:13 +01:00
Norman Feske 9f82764316 core: Introduce default CPU exception handler
The CPU session interfaces comes with the ability to install an
exception handler per thread. This patch enhances the feature with the
provision of a default signal handler that is used if no thread-specific
handler is installed. The default signal handler can be set by
specifying an invalid thread capability and a valid signal context
capability.

Furthermore, this patch relaxes the requirement of the order of the
calls of 'exception_handler' and 'set_pager'. Originally, the exception
handler could be installed not before setting a pager. Now, we remember
the installed exception handler in the 'Cpu_thread' and propagate to to
the platform thread at a later time.
2013-01-04 15:26:16 +01:00
Alexander Boettcher 8c4e1b7eb0 base: extend cap_session with memory allocator
Required to allocate memory to remember per session created capabilities.
During session destruction all capabilities have to be freed up.
2012-12-21 14:54:20 +01:00
Stefan Kalkowski bc38a13353 Fiasco.OC: only access valid UTCB (fix #547)
If no platform thread was created before somebody destroys a thread object,
there is no valid UTCB available. Thereby, we've to check this before accessing
the UTCB when destroying a thread object.
2012-12-05 14:01:23 +01:00
Christian Prochaska 42cef716e1 CPU session meta data RAM quota upgrade support
Fixes #541.
2012-11-30 16:27:29 +01:00
Alexander Boettcher fa2cbdc7cb Fix: don't deference stale pager pointer in core
Reset pager pointer in platform_thread if pager object is removed.

Fixes #532
2012-11-29 13:44:07 +01:00
Christian Prochaska 46a81ab890 foc: don't call 'sleep_forever()' on thread exit
The generic 'sleep_forever()' function creates an Ipc_server object which
might not get cleaned up correctly when the thread gets destroyed and
unneeded capability references could remain and drain the capability index
allocator. With this patch a lock gets used on thread exit instead of
calling 'sleep_forever()'.

Fixes #538.
2012-11-29 09:55:09 +01:00
Norman Feske 0dbb5e1696 Propagate 'Range_allocator::alloc_aligned' errors
This patch reflects eventual allocation errors in a more specific way to
the caller of 'alloc_aligned', in particular out-of-metadata and
out-of-memory are considered as different conditions.

Related to issue #526.
2012-11-28 22:51:09 +01:00
Norman Feske 5c8373bec3 Cleanup destruction of RPC entrypoints
This patch introduces clean synchronization between the entrypoint
thread and the caller of the 'Rpc_entrypoint' destructor. The most
important change is the handling of the 'Ipc_server' destruction. This
object is in the local scope of the server's entry function. However,
since the server loop used to be an infinite loop, there was hardly any
chance to destruct the object in a clean way. Hence, the
'Rpc_entrypoint' destructor used to explicitly call '~Ipc_server'.
Unfortunately, this approach led to problems because there are indeed
rare cases where the server thread leaves the scope of the entry
function, namely uncaught exceptions. In such a case, the destructor
would have been called twice.

With the new protocol, we make sure to leave the scope of the entry
function and thereby destroy the 'Ipc_server' object as expected. This
is achieved by propagating the exit condition through a local RPC call
to the entrypoint. This way, the blocking state of the entrypoint
becomes unblocked. Furthermore, '~Rpc_entrypoint' makes use of the new
'join' function to wait for the completion of the server thread.
2012-11-26 20:58:09 +01:00
Sebastian Sumpf b902d5ed72 FOC: Change interrupt mode heuristic
Don't touch interrupts modes for IRQs below 16 if not explicitly requested.

Fixes issue #512
2012-11-23 12:20:28 +01:00
Stefan Kalkowski 53529e0eeb Fiasco.OC: enable i.MX53 platform 2012-11-23 12:20:27 +01:00
Martin Stein 05f5999e71 cpu_session: Access thread state by value 2012-11-23 12:20:22 +01:00
Norman Feske 959df5d46b Generalize handling of PD-session arguments
On Linux, we want to attach additional attributes to processes, i.e.,
the chroot location, the designated UID, and GID. Instead of polluting
the generic code with such Linux-specific platform details, I introduced
the new 'Native_pd_args' type, which can be customized for each
platform. The platform-dependent policy of init is factored out in the
new 'pd_args' library.

The new 'base-linux/run/lx_pd_args.run' script can be used to validate
the propagation of those attributes into core.

Note that this patch does not add the interpretation of the new UID and
PID attributes by core. This will be subject of a follow-up patch.

Related to #510.
2012-11-21 20:04:07 +01:00
Norman Feske bcabbe2c92 Add 'Thread_base::join()'
Using the new 'join()' function, the caller can explicitly block for the
completion of the thread's 'entry()' function. The test case for this
feature can be found at 'os/src/test/thread_join'. For hybrid
Linux/Genode programs, the 'Thread_base::join()' does not map directly
to 'pthread_join'. The latter function gets already called by the
destructor of 'Thread_base'. According to the documentation, subsequent
calls of 'pthread_join' for one thread may result in undefined behaviour.
So we use a 'Genode::Lock' on this platform, which is in line with the
other platforms.

Related to #194, #501
2012-11-19 12:43:34 +01:00
Martin Stein 91c27f3f72 base: Tell a mapping wether it maps IO memory. 2012-11-14 16:36:51 +01:00
Martin Stein 31d57a6257 Nested init on i.MX31 via base_hw. Rework base_hw.
Implies support for the ARMv6 architecture through 'base-hw'.

Get rid of 'base/include/drivers' expect of 'base/include/drivers/uart'.

Merge with the support for trustzone on VEA9X4 that came from
Stefan Kalkowski.

Leave board drivers in 'base/include/platform'.

Rework structure of the other drivers that were moved to
'base_hw/src/core' and those that came with the trustzone support.

Beautify further stuff in 'base_hw'.

Test 'nested_init' with 'hw_imx31' (hardware) and 'hw_panda_a2' (hardware),
'demo' and 'signal' with 'hw_pbxa9' (qemu) and 'hw_vea9x4'
(hardware, no trustzone), and 'vmm' with 'hw_vea9x4'
(hardware, with trustzone).
2012-11-14 16:36:41 +01:00
Stefan Kalkowski 70dfe4fcd7 Fiasco.OC: forward CC, and CXX variables (fix #462)
When building the Fiasco.OC kernel, and L4Linux within the Genode build system,
forward the CC, and CXX variables. It might contain useful tools like ccache,
or distcc to speed up compilation. Moreover, don't delete the MAKEFLAGS when
building Fiasco.OC. It hinders parallel builds.
2012-11-03 09:50:37 +01:00
Christian Prochaska 1389b63050 base-foc: fix capability index leak
Call the destructor of the thread context object on thread destruction to
remove any contained capability references.

Fixes #393.
2012-10-30 12:18:31 +01:00
Christian Prochaska 8b09418e56 base-foc: fix 'Genode::parent_cap()'
Replacing the local name of a capability index object which exists in the
capability map can destroy the AVL tree order of the capability map. With
this patch the outdated object gets removed from the map and a new object
gets inserted afterwards.

Fixes #435.
2012-10-30 12:17:20 +01:00
Stefan Kalkowski dc3d784e6d Introduce platform-specific services for core
By now all services in core where created, and registered in the generic
main routine. Although there exists already a x86-specific service (I/O ports)
there was no possibility to announce core-services for certain platforms only.
This commit introduces a hook function in the 'Platform' class, that enables
registration of platform-specific services. Moreover, the io-port service
is offered on x86 platforms only now.
2012-10-29 10:08:29 +01:00
Alexander Boettcher 83039267fa Cleanup: remove 'first' and 'next' of cpu_session
Fixes #10
2012-10-24 11:34:38 +02:00
Sebastian Sumpf 4a3d852b65 Core: Shared IRQ support for Nova/FOC/OKL4
Implement shared IRQs using 'Irq_proxy' class.

Nova: Added global worker 'Irq_thread' support in core and adapted Irq_session.

FOC: Adapted IRQ session code, x86 has shared IRQ support, ARM uses the old
model. Read and set 'mode' argument (from MADT) in 'Irq_session'.

OKL4: Use generic 'Irq_proxy'

Fixes issue #390
2012-10-11 17:10:16 +02:00
Norman Feske 4a1b545770 Move 'Child' API implementation to library 2012-10-09 13:45:33 +02:00
Alexander Boettcher ea38aad30e Move context area definition to native_type 2012-09-24 09:17:54 +02:00
Stefan Kalkowski 2e1bfe5d9b Fiasco.OC: always use fixed priority scheduler
The alternative weighted scheduler might lead to some threads don't make
any progress anymore (take for example the signal test). So we have to use
the fixed priority scheduler also in the kernel configuration for 64 Bit.
2012-09-19 14:27:42 +02:00
Stefan Kalkowski 361a67d749 Fiasco.OC: fix io-port fault answer in sigma0
In sigma0 normally no answer tag to a request/fault is created. It simply uses
the message tag received with the request. This doesn't work out when I/O ports
are requested. This patch constructs an appropriate answer tag. Moreover,
we have to enable I/O port protection in the kernel configuration.
2012-09-18 16:47:59 +02:00
Stefan Kalkowski 1e87ef627b Fiasco.OC: update to recent version (svn rev. 40) 2012-09-18 10:53:16 +02:00
Stefan Kalkowski c63f3c07de Fiasco.OC: implement thread-affinity function 2012-09-14 12:29:58 +02:00
Norman Feske 83bdfea9b0 Extend Cpu_session with thread-affinity API
This patch introduces the functions 'affinity' and 'num_cpus' to the CPU
session interface. The interface extension will allow the assignment of
individual threads to CPUs. At this point, it is just a stub with no
actual platform support.
2012-09-05 10:25:04 +02:00
Stefan Kalkowski 28614ce518 Fiasco.OC: fix capability ref-counter issue in core
The Cap_mapping abstraction in core shouldn't use a Cap_index directly, but
use Native_capability instead, as it can break reference-counting, as long as
the same Cap_index gets used in a Cap_mapping and a Native_capability. This
commit finally fixes #208.
2012-09-03 11:00:09 +02:00
Stefan Kalkowski a5ea6765d1 Fiasco.OC: several capability ref-counter fixes.
This commit fixes several issues that were triggered e.g. by the
'noux_tool_chain' run-script (fix #208 in part). The following problems
are tackled:
* Don't reference count capability selectors within a task that are actually
  controlled by core (all beneath 0x200000), because it's undecideable which
  "version" of a capability selector we currently use, e.g. a thread gets
  destroyed and a new one gets created immediately some other thread might
  have a Native_capability pointing to the already destroyed thread's gate
  capability-slot, that is now a new valid one (the one of the new thread)
* In core we cannot invalidate and remove a capability from the so called
  Cap_map before each reference to it is destroyed, so don't do this in
  Cap_session_component::free, but only reference-decrement within there,
  the actual removal can only be done in Cap_map::remove. Because core also
  has to invalidate a capability to be removed in all protection-domains
  we have to implement a core specific Cap_map::remove method
* When a capability gets inserted into the Cap_map, and we detect an old
  invalid entry with the dame id in the tree, don't just overmap that
  invalid entry (as there exist remaining references to it), but just remove
  it from the tree and allocate an new entry.
* Use the Cap_session_component interface to free a Pager_object when it
  gets dissolved, as its also used for allocation
2012-09-03 10:59:54 +02:00
Stefan Kalkowski b71c1649d6 Fiasco.OC: check invoked capability (fix #341)
Let the Fiasco.OC base platform succeed the cap_integrity run-script meaning
that it is not feasible anymore to fake a capability by using a valid one
together with a guessed local_name.
2012-08-30 11:15:27 +02:00
Stefan Kalkowski 4753aee540 Fiasco.OC: hold irq-objects in core for resignment 2012-08-07 22:24:46 +02:00
Norman Feske d079ef51ae Adapt GDB monitor and Noux to CPU session changes 2012-08-03 12:06:31 +02:00
Martin Stein 9369057f90 Extend RAM/CPU session for base-hw context-areas. 2012-08-02 16:41:21 +02:00
Stefan Kalkowski e8b1b6f6da Fiasco.OC: fix run-environment for ARM platforms
Eliminate prints to stderr for normal messages, because it leads to exceptional
returns in TCL-scripts e.g. when run-script is triggered by the autopilot even
if the script's return code itself will be zero.
2012-06-27 11:31:43 +02:00
Norman Feske 23704c770f base-foc: Print location of the boot image 2012-06-22 11:50:13 +02:00
Norman Feske 288fd4e56e Add support for allocating DMA memory
This patch extends the RAM session interface with the ability to
allocate DMA buffers. The client specifies the type of RAM dataspace to
allocate via the new 'cached' argument of the 'Ram_session::alloc()'
function. By default, 'cached' is true, which correponds to the common
case and the original behavior. When setting 'cached' to 'false', core
takes the precautions needed to register the memory as uncached in the
page table of each process that has the dataspace attached.

Currently, the support for allocating DMA buffers is implemented for
Fiasco.OC only. On x86 platforms, it is generally not needed. But on
platforms with more relaxed cache coherence (such as ARM), user-level
device drivers should always use uncacheable memory for DMA transactions.
2012-06-20 09:17:48 +02:00
Stefan Kalkowski c02f04da76 Fiasco.OC: raise sigma0's priority to maximum.
When sigma0 runs on a lower priority than the rest of the threads in the
system it might come to the point that while answering a page fault or
I/O memory area request the timeslice of the caller (core-pager) gets
fully consumed. As long as other threads are still executable and don't block
sigma0 won't do progress anymore, because it runs at the lowest priority.
This commit simply sets sigma0's priority to the highest in the system.
2012-06-04 17:10:16 +02:00
Stefan Kalkowski 21ffbc0080 Fiasco.OC/ARM: fix image creation in run-script
When invoking the bootstrap build in the L4RE build-system to create
a single elf-image containing all needed files to boot a scenario, don't
use the 'ENTRY' variable, but 'E' variable instead. Otherwise 'ENTRY'
might get overridden (dependent on the make-version). Moreover, using
'E' seems to be the way L4Re is expecting it has to be invoked.

Fixes #226
2012-06-04 12:05:27 +02:00
Stefan Kalkowski 04969dcf69 Fiasco.OC: Don't map page 0 in core (fix #223)
When core requests all RAM from sigma0 it normally unmaps page 0 so that
null-pointer dereferences are detected by a pagefault. The unmap syscall
in the Fiasco.OC base platform was used insufficiently in this particular
case.
2012-05-30 11:36:34 +02:00
Stefan Kalkowski 54e08cfed5 Fiasco.OC: make capability ref-counter thread-safe
Introduce process global spin-lock for Cap_index's reference-counter
to avoid non-atomic increment/decrement of the counter. Here, we don't
use a static Spinlock object, because it's constructor wouldn't be
initialized before used for the first time.
2012-05-29 13:55:00 +02:00
Stefan Kalkowski 94e14ec20b Fiasco.OC: basic support for pandaboard 2012-05-29 13:55:00 +02:00