init: don't call Rom_session::dataspace() twice

In general, requesting a dataspace from a server twice is no good
idea. The server might react in a unrecoverable fashion. E.g. the rom_fs
service always throws away the corresponding dataspace from the first call
of dataspace(), and constructs a new one.
This commit is contained in:
Stefan Kalkowski 2013-10-29 17:09:32 +01:00 committed by Norman Feske
parent a1458307da
commit fde93c3284

View File

@ -463,8 +463,8 @@ namespace Init {
/** /**
* ELF binary * ELF binary
*/ */
Genode::Rom_connection _binary_rom; Genode::Rom_connection _binary_rom;
Genode::Dataspace_capability _binary_rom_ds;
/** /**
* Private child configuration * Private child configuration
*/ */
@ -510,16 +510,17 @@ namespace Init {
_resources(start_node, _name.unique, prio_levels_log2, affinity_space), _resources(start_node, _name.unique, prio_levels_log2, affinity_space),
_entrypoint(cap_session, ENTRYPOINT_STACK_SIZE, _name.unique, false), _entrypoint(cap_session, ENTRYPOINT_STACK_SIZE, _name.unique, false),
_binary_rom(_name.file, _name.unique), _binary_rom(_name.file, _name.unique),
_binary_rom_ds(_binary_rom.dataspace()),
_config(_resources.ram.cap(), start_node), _config(_resources.ram.cap(), start_node),
_server(_resources.ram.cap()), _server(_resources.ram.cap()),
_child(_binary_rom.dataspace(), _resources.ram.cap(), _child(_binary_rom_ds, _resources.ram.cap(),
_resources.cpu.cap(), _resources.rm.cap(), &_entrypoint, this), _resources.cpu.cap(), _resources.rm.cap(), &_entrypoint, this),
_parent_services(parent_services), _parent_services(parent_services),
_child_services(child_services), _child_services(child_services),
_labeling_policy(_name.unique), _labeling_policy(_name.unique),
_priority_policy(_resources.prio_levels_log2, _resources.priority), _priority_policy(_resources.prio_levels_log2, _resources.priority),
_config_policy("config", _config.dataspace(), &_entrypoint), _config_policy("config", _config.dataspace(), &_entrypoint),
_binary_policy("binary", _binary_rom.dataspace(), &_entrypoint), _binary_policy("binary", _binary_rom_ds, &_entrypoint),
_configfile_policy("config", _config.filename()), _configfile_policy("config", _config.filename()),
_pd_args_policy(&_pd_args) _pd_args_policy(&_pd_args)
{ {