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.
This commit is contained in:
Christian Prochaska 2013-05-06 16:29:23 +02:00 committed by Norman Feske
parent b8d690b9aa
commit ea3adfef9a
5 changed files with 23 additions and 7 deletions

View File

@ -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);

View File

@ -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,

View File

@ -17,7 +17,7 @@ install_config {
<any-service> <parent/> </any-service>
</default-route>
<start name="test-ldso">
<resource name="RAM" quantum="1M"/>
<resource name="RAM" quantum="2M"/>
</start>
</config>
}

View File

@ -56,6 +56,7 @@ install_config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="RM"/>
<service name="RAM"/>
<service name="LOG"/>
<service name="Timer"/>

View File

@ -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()
"<config>\n"
" <parent-provides>\n"
" <service name=\"ROM\"/>\n"
" <service name=\"RM\"/>\n"
" <service name=\"LOG\"/>\n"
" </parent-provides>\n"
" <default-route>\n"