From ea3adfef9a7060beaae9839202dcc5fbf6cbfc93 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Mon, 6 May 2013 16:29:23 +0200 Subject: [PATCH] Create the context area RM session at startup With this patch, the thread context area RM session gets created at program startup to have the thread context area's virtual address range reserved right from the beginning. Fixes #734. This patch implies that all Genode processes try to create an RM session. So a route to the RM service must be present even for processes that have only a single thread. Hence, the patch contains an update of affected components. --- base/src/platform/_main.cc | 8 ++++++++ base/src/test/rm_fault/main.cc | 9 ++++++--- os/run/ldso.run | 2 +- os/run/tar_rom.run | 1 + os/src/test/failsafe/main.cc | 10 +++++++--- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/base/src/platform/_main.cc b/base/src/platform/_main.cc index d38186c26..45e5f5f4f 100644 --- a/base/src/platform/_main.cc +++ b/base/src/platform/_main.cc @@ -34,6 +34,11 @@ using namespace Genode; extern int main(int argc, char **argv, char **envp); extern void init_exception_handling(); /* implemented in base/cxx */ +namespace Genode { + extern Rm_session *env_context_area_rm_session(); +} + + enum { ATEXIT_SIZE = 256 }; @@ -250,6 +255,9 @@ extern "C" int _main() /* now, it is save to call printf */ + /* create the thread context area RM session */ + env_context_area_rm_session(); + /* call real main function */ int ret = main(genode_argc, genode_argv, genode_envp); diff --git a/base/src/test/rm_fault/main.cc b/base/src/test/rm_fault/main.cc index 70104d15f..ee91ae384 100644 --- a/base/src/test/rm_fault/main.cc +++ b/base/src/test/rm_fault/main.cc @@ -80,6 +80,7 @@ class Test_child : public Child_policy Child _child; Parent_service _log_service; + Parent_service _rm_service; public: @@ -94,7 +95,7 @@ class Test_child : public Child_policy : _entrypoint(cap, STACK_SIZE, "child", false), _child(elf_ds, ram, cpu, rm, &_entrypoint, this), - _log_service("LOG") + _log_service("LOG"), _rm_service("RM") { /* start execution of the new child */ _entrypoint.activate(); @@ -111,8 +112,10 @@ class Test_child : public Child_policy Service *resolve_session_request(const char *service, const char *) { - /* forward log-session request to our parent */ - return !strcmp(service, "LOG") ? &_log_service : 0; + /* forward white-listed session requests to our parent */ + return !strcmp(service, "LOG") ? &_log_service + : !strcmp(service, "RM") ? &_rm_service + : 0; } void filter_session_args(const char *service, diff --git a/os/run/ldso.run b/os/run/ldso.run index 6dbf4b38f..2411bc700 100644 --- a/os/run/ldso.run +++ b/os/run/ldso.run @@ -17,7 +17,7 @@ install_config { - + } diff --git a/os/run/tar_rom.run b/os/run/tar_rom.run index e9071bdb9..1dd655c6e 100644 --- a/os/run/tar_rom.run +++ b/os/run/tar_rom.run @@ -56,6 +56,7 @@ install_config { + diff --git a/os/src/test/failsafe/main.cc b/os/src/test/failsafe/main.cc index f78a466da..787cfc7bb 100644 --- a/os/src/test/failsafe/main.cc +++ b/os/src/test/failsafe/main.cc @@ -75,6 +75,7 @@ class Test_child : public Genode::Child_policy Genode::Rom_connection _elf; Genode::Child _child; Genode::Parent_service _log_service; + Genode::Parent_service _rm_service; public: @@ -89,7 +90,7 @@ class Test_child : public Genode::Child_policy _elf(elf_name), _child(_elf.dataspace(), _resources.ram.cap(), _resources.cpu.cap(), _resources.rm.cap(), &ep, this), - _log_service("LOG") + _log_service("LOG"), _rm_service("RM") { } @@ -101,8 +102,10 @@ class Test_child : public Genode::Child_policy Genode::Service *resolve_session_request(const char *service, const char *) { - /* forward log-session request to our parent */ - return !Genode::strcmp(service, "LOG") ? &_log_service : 0; + /* forward white-listed session requests to our parent */ + return !Genode::strcmp(service, "LOG") ? &_log_service + : !Genode::strcmp(service, "RM") ? &_rm_service + : 0; } void filter_session_args(const char *service, @@ -230,6 +233,7 @@ void failsafe_loader_grand_child_test() "\n" " \n" " \n" + " \n" " \n" " \n" " \n"