diff --git a/base-linux/include/base/platform_env.h b/base-linux/include/base/platform_env.h index 9e8b4f8ea..2d234b1f0 100644 --- a/base-linux/include/base/platform_env.h +++ b/base-linux/include/base/platform_env.h @@ -361,6 +361,14 @@ namespace Genode { */ ~Platform_env() { parent()->exit(0); } + /** + * Reload parent capability and reinitialize environment resources + */ + void reload_parent_cap(Capability) + { + /* not supported on Linux */ + } + /******************* ** Env interface ** diff --git a/base/include/base/platform_env.h b/base/include/base/platform_env.h index 906644661..5d4674e3f 100644 --- a/base/include/base/platform_env.h +++ b/base/include/base/platform_env.h @@ -154,7 +154,7 @@ namespace Genode { * meaningful capabilities obtained via its updated parent * capability. */ - void reload_parent_cap(); + void reload_parent_cap(Capability); /******************* diff --git a/base/src/base/env/reload_parent_cap.cc b/base/src/base/env/reload_parent_cap.cc index d55d132ba..671a1166f 100644 --- a/base/src/base/env/reload_parent_cap.cc +++ b/base/src/base/env/reload_parent_cap.cc @@ -12,9 +12,10 @@ */ #include +#include -void Genode::Platform_env::reload_parent_cap() +void Genode::Platform_env::reload_parent_cap(Capability parent_cap) { /* * This function is unused during the normal operation of Genode. It is @@ -22,14 +23,23 @@ void Genode::Platform_env::reload_parent_cap() * Noux execution environment. * * The function is called by the freshly created process right after the - * fork happened. During the fork, the Noux environment is expected to have - * updated the '_parent_cap' of the new process. + * fork happened. * * The existing 'Platform_env' object contains capabilities that are * meaningful for the forking process but not the new process. Before the * the environment can be used, it must be reinitialized with the resources * provided by the actual parent. */ + + /* + * Patch new parent capability into the original location as specified by + * the linker script. + */ + *(Capability *)(&_parent_cap) = parent_cap; + + /* + * Re-initialize 'Platform_env' members + */ _parent_client = Parent_client(Genode::parent_cap()); _resources = Resources(_parent_client);