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
This commit is contained in:
Norman Feske
2016-06-13 15:14:32 +02:00
parent f7bdd383e2
commit d71f0a9606
29 changed files with 185 additions and 190 deletions

View File

@ -19,6 +19,7 @@
/* base-internal includes */
#include <base/internal/elf.h>
#include <base/internal/parent_cap.h>
using namespace Genode;
@ -123,11 +124,7 @@ Child::Process::Loaded_executable::Loaded_executable(Dataspace_capability elf_ds
* data segment
*/
if (!parent_info) {
Native_capability::Raw *raw = (Native_capability::Raw *)ptr;
raw->dst = parent_cap.dst();
raw->local_name = parent_cap.local_name();
*(Untyped_capability::Raw *)ptr = parent_cap.raw();
parent_info = true;
}

View File

@ -27,8 +27,7 @@ void reinit_main_thread();
namespace Genode { extern bool inhibit_tracing; }
void Genode::Platform_env::reinit(Native_capability::Dst dst,
long local_name)
void Genode::Platform_env::reinit(Native_capability::Raw raw)
{
/*
* This function is unused during the normal operation of Genode. It is
@ -54,9 +53,7 @@ void Genode::Platform_env::reinit(Native_capability::Dst dst,
* Patch new parent capability into the original location as specified by
* the linker script.
*/
Native_capability::Raw *raw = (Native_capability::Raw *)(&_parent_cap);
raw->dst = dst;
raw->local_name = local_name;
*(Native_capability::Raw *)(&_parent_cap) = raw;
/*
* Re-initialize 'Platform_env' members

View File

@ -26,7 +26,7 @@
#include <base/component.h>
/* platform-specific local helper functions */
#include <startup/internal/_main_parent_cap.h>
#include <base/internal/parent_cap.h>
#include <base/internal/crt0.h>