From d71f0a960621e6aa302486721ddbfdf1fa9deb9b Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 13 Jun 2016 15:14:32 +0200 Subject: [PATCH] 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 --- .../base-foc/include/base/native_capability.h | 3 +- .../src/include/base/internal/parent_cap.h | 50 +++++++++++++++++++ .../startup/internal/_main_parent_cap.h | 49 ------------------ .../base-hw/include/base/native_capability.h | 10 ++-- .../src/include/base/internal/parent_cap.h | 30 +++++++++++ .../startup/internal/_main_parent_cap.h | 37 -------------- .../src/include/base/internal/platform_env.h | 2 +- repos/base-linux/src/lib/base/env_reinit.cc | 2 +- .../include/base/native_capability.h | 13 ++--- .../internal/parent_cap.h} | 19 +++---- .../include/base/native_capability.h | 10 ++-- .../internal/parent_cap.h} | 21 ++++---- .../base/include/base/native_capability_tpl.h | 5 ++ repos/base/include/deprecated/env.h | 2 +- repos/base/src/core/include/core_env.h | 2 +- repos/base/src/include/base/internal/crt0.h | 5 +- .../src/include/base/internal/parent_cap.h | 19 ++++++- .../src/include/base/internal/platform_env.h | 2 +- .../startup/internal/_main_parent_cap.h | 36 ------------- repos/base/src/lib/base/child_process.cc | 7 +-- repos/base/src/lib/base/env_reinit.cc | 7 +-- repos/base/src/lib/startup/_main.cc | 2 +- .../patches/parent_cap_ld_script.patch | 29 +++++++++++ repos/ports-foc/ports/l4android.hash | 2 +- repos/ports-foc/ports/l4android.port | 2 + repos/ports-foc/ports/l4linux.hash | 2 +- repos/ports-foc/ports/l4linux.port | 2 + repos/ports/src/lib/libc_noux/plugin.cc | 2 +- repos/ports/src/noux/child.h | 3 +- 29 files changed, 185 insertions(+), 190 deletions(-) create mode 100644 repos/base-foc/src/include/base/internal/parent_cap.h delete mode 100644 repos/base-foc/src/include/startup/internal/_main_parent_cap.h create mode 100644 repos/base-hw/src/include/base/internal/parent_cap.h delete mode 100644 repos/base-hw/src/include/startup/internal/_main_parent_cap.h rename repos/base-nova/src/include/{startup/internal/_main_parent_cap.h => base/internal/parent_cap.h} (58%) rename repos/base-sel4/src/include/{startup/internal/_main_parent_cap.h => base/internal/parent_cap.h} (55%) delete mode 100644 repos/base/src/include/startup/internal/_main_parent_cap.h create mode 100644 repos/ports-foc/patches/parent_cap_ld_script.patch diff --git a/repos/base-foc/include/base/native_capability.h b/repos/base-foc/include/base/native_capability.h index 31f4a381d8..cf0c8ecd42 100644 --- a/repos/base-foc/include/base/native_capability.h +++ b/repos/base-foc/include/base/native_capability.h @@ -38,7 +38,6 @@ namespace Genode { struct Raw { - Dst dst; long local_name; }; @@ -107,6 +106,8 @@ namespace Genode { long local_name() const { return _idx ? _idx->id() : 0; } Dst dst() const { return _idx ? Dst(_idx->kcap()) : Dst(); } bool valid() const { return (_idx != 0) && _idx->valid(); } + + Raw raw() const { return { local_name() }; } }; } diff --git a/repos/base-foc/src/include/base/internal/parent_cap.h b/repos/base-foc/src/include/base/internal/parent_cap.h new file mode 100644 index 0000000000..9da1776fcd --- /dev/null +++ b/repos/base-foc/src/include/base/internal/parent_cap.h @@ -0,0 +1,50 @@ +/* + * \brief Interface to obtain the parent capability for the component + * \author Norman Feske + * \date 2013-09-25 + * + * On Fiasco.OC, we transfer merely the 'local_name' part of the capability + * via the '_parent_cap' field of the ELF binary. + */ + +/* + * Copyright (C) 2006-2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ +#define _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ + +/* Genode includes */ +#include +#include +#include + +/* base-internal includes */ +#include + + +namespace Genode { + + static inline Parent_capability parent_cap() + { + unsigned long const local_name = _parent_cap; + + static Cap_index *i = cap_map()->insert(local_name, + Fiasco::PARENT_CAP); + /* + * Update local name after a parent capability got reloaded via + * 'Platform_env::reload_parent_cap()'. + */ + if (i->id() != local_name) { + cap_map()->remove(i); + i = cap_map()->insert(local_name, Fiasco::PARENT_CAP); + } + + return reinterpret_cap_cast(Native_capability(i)); + } +} + +#endif /* _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ */ diff --git a/repos/base-foc/src/include/startup/internal/_main_parent_cap.h b/repos/base-foc/src/include/startup/internal/_main_parent_cap.h deleted file mode 100644 index 85cc532a30..0000000000 --- a/repos/base-foc/src/include/startup/internal/_main_parent_cap.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * \brief Obtain parent capability - * \author Norman Feske - * \date 2010-01-26 - */ - -/* - * Copyright (C) 2010-2013 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#ifndef _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ -#define _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ - -/* Genode includes */ -#include -#include - -/* base-internal includes */ -#include - -namespace Genode { - - /** - * Return constructed parent capability - */ - Parent_capability parent_cap() - { - Native_capability::Raw *raw = (Native_capability::Raw *)&_parent_cap; - - static Cap_index *i = cap_map()->insert(raw->local_name, - Fiasco::PARENT_CAP); - - /* - * Update local name after a parent capability got reloaded via - * 'Platform_env::reload_parent_cap()'. - */ - if (i->id() != raw->local_name) { - cap_map()->remove(i); - i = cap_map()->insert(raw->local_name, Fiasco::PARENT_CAP); - } - - return reinterpret_cap_cast(Native_capability(i)); - } -} - -#endif /* _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ */ diff --git a/repos/base-hw/include/base/native_capability.h b/repos/base-hw/include/base/native_capability.h index 496dc099e8..c21d298c4f 100644 --- a/repos/base-hw/include/base/native_capability.h +++ b/repos/base-hw/include/base/native_capability.h @@ -36,13 +36,7 @@ class Genode::Native_capability public: - struct Raw - { - Dst dst; - - /* obsolete in base-hw, but still used in generic code path */ - addr_t local_name; - }; + struct Raw { }; /** * Create an invalid capability @@ -90,6 +84,8 @@ class Genode::Native_capability _inc(); return *this; } + + Raw raw() const { return Raw(); } }; #endif /* _INCLUDE__BASE__NATIVE_CAPABILITY_H_ */ diff --git a/repos/base-hw/src/include/base/internal/parent_cap.h b/repos/base-hw/src/include/base/internal/parent_cap.h new file mode 100644 index 0000000000..2a4bd881ec --- /dev/null +++ b/repos/base-hw/src/include/base/internal/parent_cap.h @@ -0,0 +1,30 @@ +/* + * \brief Interface to obtain the parent capability for the component + * \author Stefan Kalkowski + * \date 2015-04-27 + */ + +/* + * Copyright (C) 2015-2016 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ +#define _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ + +/* Genode includes */ +#include + +namespace Hw { extern Genode::Untyped_capability _parent_cap; } + +namespace Genode { + + static inline Parent_capability parent_cap() + { + return reinterpret_cap_cast(Hw::_parent_cap); + } +} + +#endif /* _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ */ diff --git a/repos/base-hw/src/include/startup/internal/_main_parent_cap.h b/repos/base-hw/src/include/startup/internal/_main_parent_cap.h deleted file mode 100644 index 995eadb203..0000000000 --- a/repos/base-hw/src/include/startup/internal/_main_parent_cap.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * \brief Obtain parent capability - * \author Stefan Kalkowski - * \date 2015-04-27 - */ - -/* - * Copyright (C) 2015 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#ifndef _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ -#define _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ - -/* Genode includes */ -#include - -/* base-internal includes */ -#include - -namespace Hw { extern Genode::Untyped_capability _parent_cap; } - -namespace Genode { - - /** - * Return constructed parent capability - */ - Parent_capability parent_cap() - { - /* assemble parent capability */ - return reinterpret_cap_cast(Hw::_parent_cap); - } -} - -#endif /* _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ */ diff --git a/repos/base-linux/src/include/base/internal/platform_env.h b/repos/base-linux/src/include/base/internal/platform_env.h index ac2ba13a1e..627a73c6ac 100644 --- a/repos/base-linux/src/include/base/internal/platform_env.h +++ b/repos/base-linux/src/include/base/internal/platform_env.h @@ -90,7 +90,7 @@ class Genode::Platform_env_base : public Env_deprecated Pd_session *pd_session() override { return &_local_pd_session; } Pd_session_capability pd_session_cap() override { return _pd_session_cap; } - void reinit(Native_capability::Dst, long) override; + void reinit(Native_capability::Raw) override; void reinit_main_thread(Capability &) override; }; diff --git a/repos/base-linux/src/lib/base/env_reinit.cc b/repos/base-linux/src/lib/base/env_reinit.cc index 0c7bd54644..eeb703eb2b 100644 --- a/repos/base-linux/src/lib/base/env_reinit.cc +++ b/repos/base-linux/src/lib/base/env_reinit.cc @@ -18,7 +18,7 @@ #include -void Genode::Platform_env_base::reinit(Native_capability::Dst, long) { } +void Genode::Platform_env_base::reinit(Native_capability::Raw) { } void Genode::Platform_env_base::reinit_main_thread(Capability &) { } diff --git a/repos/base-nova/include/base/native_capability.h b/repos/base-nova/include/base/native_capability.h index 996cfeb05b..1821854017 100644 --- a/repos/base-nova/include/base/native_capability.h +++ b/repos/base-nova/include/base/native_capability.h @@ -30,16 +30,7 @@ namespace Genode { typedef Nova::Obj_crd Dst; - struct Raw - { - Dst dst; - - /* - * It is obsolete and unused in NOVA, however still used by - * generic base part - */ - addr_t local_name; - }; + struct Raw { }; private: @@ -169,6 +160,8 @@ namespace Genode { { return Native_capability(); } + + Raw raw() const { return Raw(); } }; } diff --git a/repos/base-nova/src/include/startup/internal/_main_parent_cap.h b/repos/base-nova/src/include/base/internal/parent_cap.h similarity index 58% rename from repos/base-nova/src/include/startup/internal/_main_parent_cap.h rename to repos/base-nova/src/include/base/internal/parent_cap.h index d6414f6106..8629eaceb6 100644 --- a/repos/base-nova/src/include/startup/internal/_main_parent_cap.h +++ b/repos/base-nova/src/include/base/internal/parent_cap.h @@ -1,5 +1,5 @@ /* - * \brief Obtain parent capability + * \brief Interface to obtain the parent capability for the component * \author Norman Feske * \author Alexander Boettcher * \date 2010-01-26 @@ -9,32 +9,29 @@ */ /* - * Copyright (C) 2010-2013 Genode Labs GmbH + * Copyright (C) 2010-2016 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ -#ifndef _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ -#define _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ +#ifndef _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ +#define _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ /* Genode includes */ -#include +#include /* NOVA includes */ #include + namespace Genode { - /** - * Return constructed parent capability - */ - Parent_capability parent_cap() + static inline Parent_capability parent_cap() { - /* assemble parent capability */ return reinterpret_cap_cast( Native_capability(Nova::PT_SEL_PARENT)); } } -#endif /* _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ */ +#endif /* _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ */ diff --git a/repos/base-sel4/include/base/native_capability.h b/repos/base-sel4/include/base/native_capability.h index 1e37b67902..3b27cb70f6 100644 --- a/repos/base-sel4/include/base/native_capability.h +++ b/repos/base-sel4/include/base/native_capability.h @@ -23,12 +23,10 @@ namespace Genode { public: /* - * XXX remove dependency in 'process.cc' and 'core_env.h' from - * 'Raw', 'Dst', and the 'dst' member. + * Platform-specific raw information of the capability that is + * transferred as-is when the capability is delegated. */ - typedef int Dst; - struct Raw { Dst dst = 0; long local_name = 0; }; - Dst dst() const { return 0; } + struct Raw { long v[4]; }; /** * Forward declaration of the platform-specific internal capability @@ -96,6 +94,8 @@ namespace Genode { long local_name() const; bool valid() const; + + Raw raw() const { return { { 0, 0, 0, 0 } }; } }; } diff --git a/repos/base-sel4/src/include/startup/internal/_main_parent_cap.h b/repos/base-sel4/src/include/base/internal/parent_cap.h similarity index 55% rename from repos/base-sel4/src/include/startup/internal/_main_parent_cap.h rename to repos/base-sel4/src/include/base/internal/parent_cap.h index 83b2ccee89..54e1b8ee35 100644 --- a/repos/base-sel4/src/include/startup/internal/_main_parent_cap.h +++ b/repos/base-sel4/src/include/base/internal/parent_cap.h @@ -1,31 +1,32 @@ /* - * \brief Obtain parent capability + * \brief Interface to obtain the parent capability for the component * \author Norman Feske * \date 2015-05-12 + * + * On seL4, no information is propagated via the '_parent_cap' field of the + * ELF image. */ /* - * Copyright (C) 2015 Genode Labs GmbH + * Copyright (C) 2015-2016 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ -#ifndef _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ -#define _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ +#ifndef _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ +#define _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ /* Genode includes */ -#include +#include /* base-internal includes */ #include + namespace Genode { - /** - * Return constructed parent capability - */ - Parent_capability parent_cap() + static inline Parent_capability parent_cap() { Capability_space::Ipc_cap_data const ipc_cap_data(Rpc_obj_key(), INITIAL_SEL_PARENT); @@ -36,4 +37,4 @@ namespace Genode { } } -#endif /* _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ */ +#endif /* _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ */ diff --git a/repos/base/include/base/native_capability_tpl.h b/repos/base/include/base/native_capability_tpl.h index 145fb876ef..1fe7081dc0 100644 --- a/repos/base/include/base/native_capability_tpl.h +++ b/repos/base/include/base/native_capability_tpl.h @@ -113,6 +113,11 @@ class Genode::Native_capability_tpl * Return capability destination */ Dst dst() const { return _dst; } + + /** + * Return raw data representation of the capability + */ + Raw raw() const { return { _dst, _local_name }; } }; #endif /* _INCLUDE__BASE__NATIVE_CAPABILITY_TPL_H_ */ diff --git a/repos/base/include/deprecated/env.h b/repos/base/include/deprecated/env.h index cd042a13e0..d6fd7ee4c3 100644 --- a/repos/base/include/deprecated/env.h +++ b/repos/base/include/deprecated/env.h @@ -106,7 +106,7 @@ struct Genode::Env_deprecated * * \noapi */ - virtual void reinit(Native_capability::Dst, long) = 0; + virtual void reinit(Native_capability::Raw) = 0; /** * Reinitialize main-thread object diff --git a/repos/base/src/core/include/core_env.h b/repos/base/src/core/include/core_env.h index 62ae304c70..2862787111 100644 --- a/repos/base/src/core/include/core_env.h +++ b/repos/base/src/core/include/core_env.h @@ -199,7 +199,7 @@ namespace Genode { return Pd_session_capability(); } - void reinit(Capability::Dst, long) override { } + void reinit(Capability::Raw) override { } void reinit_main_thread(Capability &) override { } }; diff --git a/repos/base/src/include/base/internal/crt0.h b/repos/base/src/include/base/internal/crt0.h index c90bd55cd1..b9f4bb2eec 100644 --- a/repos/base/src/include/base/internal/crt0.h +++ b/repos/base/src/include/base/internal/crt0.h @@ -37,8 +37,9 @@ extern unsigned _stack_high; /* upper bound of intial stack */ ***************************************************/ /* - * The protection domain creator initializes the information about - * the parent capability prior the execution of the main thread. + * The protection domain creator initializes the information about the parent + * capability prior the execution of the main thread. It corresponds to the + * '_parent_cap' symbol defined in 'src/ld/genode.ld'. */ extern unsigned long _parent_cap; diff --git a/repos/base/src/include/base/internal/parent_cap.h b/repos/base/src/include/base/internal/parent_cap.h index 3daec053c6..5ff2ceb54d 100644 --- a/repos/base/src/include/base/internal/parent_cap.h +++ b/repos/base/src/include/base/internal/parent_cap.h @@ -2,6 +2,9 @@ * \brief Interface to obtain the parent capability for the component * \author Norman Feske * \date 2013-09-25 + * + * This implementation is used on platforms that rely on global IDs (thread + * IDs, global unique object IDs) as capability representation. */ /* @@ -14,8 +17,22 @@ #ifndef _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ #define _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ +/* Genode includes */ #include +#include -namespace Genode { Parent_capability parent_cap(); } +/* base-internal includes */ +#include + + +namespace Genode { + + static inline Parent_capability parent_cap() + { + Parent_capability cap; + memcpy(&cap, (void *)&_parent_cap, sizeof(cap)); + return Parent_capability(cap); + } +} #endif /* _INCLUDE__BASE__INTERNAL__PARENT_CAP_H_ */ diff --git a/repos/base/src/include/base/internal/platform_env.h b/repos/base/src/include/base/internal/platform_env.h index 722696c58e..d256f39b62 100644 --- a/repos/base/src/include/base/internal/platform_env.h +++ b/repos/base/src/include/base/internal/platform_env.h @@ -108,7 +108,7 @@ class Genode::Platform_env : public Env_deprecated, /* * Support functions for implementing fork on Noux. */ - void reinit(Native_capability::Dst, long) override; + void reinit(Native_capability::Raw) override; void reinit_main_thread(Capability &) override; diff --git a/repos/base/src/include/startup/internal/_main_parent_cap.h b/repos/base/src/include/startup/internal/_main_parent_cap.h deleted file mode 100644 index 16c12e2341..0000000000 --- a/repos/base/src/include/startup/internal/_main_parent_cap.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * \brief Obtain parent capability - * \author Norman Feske - * \date 2010-01-26 - * - * This implementation is used on platforms that rely on global IDs (thread - * IDs, global unique object IDs) as capability representation. - */ - -/* - * Copyright (C) 2010-2013 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#ifndef _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ -#define _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ - -/* base-internal includes */ -#include - -namespace Genode { - - /** - * Return constructed parent capability - */ - Parent_capability parent_cap() - { - Parent_capability cap; - memcpy(&cap, (void *)&_parent_cap, sizeof(cap)); - return Parent_capability(cap); - } -} - -#endif /* _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ */ diff --git a/repos/base/src/lib/base/child_process.cc b/repos/base/src/lib/base/child_process.cc index dbe3b9b113..05254c38cd 100644 --- a/repos/base/src/lib/base/child_process.cc +++ b/repos/base/src/lib/base/child_process.cc @@ -19,6 +19,7 @@ /* base-internal includes */ #include +#include 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; } diff --git a/repos/base/src/lib/base/env_reinit.cc b/repos/base/src/lib/base/env_reinit.cc index 7bca94e849..6020311da6 100644 --- a/repos/base/src/lib/base/env_reinit.cc +++ b/repos/base/src/lib/base/env_reinit.cc @@ -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 diff --git a/repos/base/src/lib/startup/_main.cc b/repos/base/src/lib/startup/_main.cc index 3d20955241..40f5f341d5 100644 --- a/repos/base/src/lib/startup/_main.cc +++ b/repos/base/src/lib/startup/_main.cc @@ -26,7 +26,7 @@ #include /* platform-specific local helper functions */ -#include +#include #include diff --git a/repos/ports-foc/patches/parent_cap_ld_script.patch b/repos/ports-foc/patches/parent_cap_ld_script.patch new file mode 100644 index 0000000000..c54599cc27 --- /dev/null +++ b/repos/ports-foc/patches/parent_cap_ld_script.patch @@ -0,0 +1,29 @@ ++++ arch/l4/kernel/arch-arm/vmlinux.lds.S +@@ -108,6 +108,12 @@ SECTIONS + LONG(0xffffffff); + _parent_cap_local_name = .; + LONG(0xffffffff); ++ LONG(0xffffffff); ++ LONG(0xffffffff); ++ LONG(0xffffffff); ++ LONG(0xffffffff); ++ LONG(0xffffffff); ++ LONG(0xffffffff); + } : rw + + . = ALIGN(4096); ++++ arch/l4/kernel/arch-x86/vmlinux.lds.S +@@ -101,6 +101,13 @@ SECTIONS + LONG(0xffffffff); + _parent_cap_local_name = .; + LONG(0xffffffff); ++ LONG(0xffffffff); ++ LONG(0xffffffff); ++ LONG(0xffffffff); ++ LONG(0xffffffff); ++ LONG(0xffffffff); ++ LONG(0xffffffff); ++ LONG(0xffffffff); + + /* + * Platform-specific entry for Fiasco.OC. diff --git a/repos/ports-foc/ports/l4android.hash b/repos/ports-foc/ports/l4android.hash index 5ba50c9755..0558d7d884 100644 --- a/repos/ports-foc/ports/l4android.hash +++ b/repos/ports-foc/ports/l4android.hash @@ -1 +1 @@ -07d72c264878024efa078d14241f1648172a39de +1e6243ccb8f368ed15b7f42c339434e46d0062a9 diff --git a/repos/ports-foc/ports/l4android.port b/repos/ports-foc/ports/l4android.port index f7b45d6bbb..d622724d3d 100644 --- a/repos/ports-foc/ports/l4android.port +++ b/repos/ports-foc/ports/l4android.port @@ -4,6 +4,8 @@ DOWNLOADS := l4android.git URL(l4android) := https://github.com/skalk/l4linux.git REV(l4android) := cea6e7ab97a5ad421e53d456dd940893d5a14866 DIR(l4android) := src/l4android +PATCHES := patches/parent_cap_ld_script.patch +PATCH_OPT := -p0 -d src/l4android sym_link := src/l4android/arch/l4/drivers default: $(sym_link) diff --git a/repos/ports-foc/ports/l4linux.hash b/repos/ports-foc/ports/l4linux.hash index b8080eaaae..db36d01742 100644 --- a/repos/ports-foc/ports/l4linux.hash +++ b/repos/ports-foc/ports/l4linux.hash @@ -1 +1 @@ -64de371ac6ca2e4c117e0d3eb827aa97216d30e7 +153fac6366d79b8380ccc97a3a7ed099cedb51b2 diff --git a/repos/ports-foc/ports/l4linux.port b/repos/ports-foc/ports/l4linux.port index c3dd7f15c3..3cb0d4809d 100644 --- a/repos/ports-foc/ports/l4linux.port +++ b/repos/ports-foc/ports/l4linux.port @@ -4,6 +4,8 @@ DOWNLOADS := l4linux.git URL(l4linux) := https://github.com/skalk/l4linux.git REV(l4linux) := 25aa4a5f25c920e18aa18899e45c71974058d813 DIR(l4linux) := src/l4linux +PATCHES := patches/parent_cap_ld_script.patch +PATCH_OPT := -p0 -d src/l4linux sym_link := src/l4linux/arch/l4/drivers default: $(sym_link) diff --git a/repos/ports/src/lib/libc_noux/plugin.cc b/repos/ports/src/lib/libc_noux/plugin.cc index 35acd3bb22..a941e7c63b 100644 --- a/repos/ports/src/lib/libc_noux/plugin.cc +++ b/repos/ports/src/lib/libc_noux/plugin.cc @@ -523,7 +523,7 @@ extern "C" void fork_trampoline() { /* reinitialize environment */ using namespace Genode; - env()->reinit(new_parent.dst, new_parent.local_name); + env()->reinit(new_parent); /* reinitialize standard-output connection */ stdout_reconnect(); diff --git a/repos/ports/src/noux/child.h b/repos/ports/src/noux/child.h index bc88dd3952..ca7f25fa53 100644 --- a/repos/ports/src/noux/child.h +++ b/repos/ports/src/noux/child.h @@ -453,8 +453,7 @@ namespace Noux { void start_forked_main_thread(addr_t ip, addr_t sp, addr_t parent_cap_addr) { /* poke parent_cap_addr into child's address space */ - Capability const &cap = _child.parent_cap(); - Capability::Raw raw = { cap.dst(), cap.local_name() }; + Capability::Raw const raw = _child.parent_cap().raw(); _pd.poke(parent_cap_addr, &raw, sizeof(raw));