mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
Consolidate RM service into PD session
This patch integrates three region maps into each PD session to reduce the session overhead and to simplify the PD creation procedure. Please refer to the issue cited below for an elaborative discussion. Note the API change: With this patch, the semantics of core's RM service have changed. Now, the service is merely a tool for creating and destroying managed dataspaces, which are rarely needed. Regular components no longer need a RM session. For this reason, the corresponding argument for the 'Process' and 'Child' constructors has been removed. The former interface of the 'Rm_session' is not named 'Region_map'. As a minor refinement, the 'Fault_type' enum values are now part of the 'Region_map::State' struct. Issue #1938
This commit is contained in:
committed by
Christian Helmuth
parent
e20bbe7002
commit
511acad507
@@ -25,6 +25,7 @@
|
||||
#include <base/lock.h>
|
||||
#include <cap_session/connection.h>
|
||||
#include <timer_session/timer_session.h>
|
||||
#include <pd_session/client.h>
|
||||
|
||||
#include <init/child.h>
|
||||
|
||||
@@ -156,7 +157,6 @@ class Launchpad_child : public Genode::List<Launchpad_child>::Element
|
||||
Genode::Rom_session_capability _rom;
|
||||
Genode::Ram_session_capability _ram;
|
||||
Genode::Cpu_session_capability _cpu;
|
||||
Genode::Rm_session_capability _rm;
|
||||
Genode::Server _server;
|
||||
|
||||
/*
|
||||
@@ -177,7 +177,6 @@ class Launchpad_child : public Genode::List<Launchpad_child>::Element
|
||||
Genode::Pd_session_capability pd,
|
||||
Genode::Ram_session_capability ram,
|
||||
Genode::Cpu_session_capability cpu,
|
||||
Genode::Rm_session_capability rm,
|
||||
Genode::Rom_session_capability rom,
|
||||
Genode::Cap_session *cap_session,
|
||||
Genode::Service_registry *parent_services,
|
||||
@@ -186,17 +185,16 @@ class Launchpad_child : public Genode::List<Launchpad_child>::Element
|
||||
Launchpad *launchpad)
|
||||
:
|
||||
_launchpad(launchpad),
|
||||
_rom(rom), _ram(ram), _cpu(cpu), _rm(rm), _server(_ram),
|
||||
_rom(rom), _ram(ram), _cpu(cpu), _server(_ram),
|
||||
_entrypoint(cap_session, ENTRYPOINT_STACK_SIZE, name, false),
|
||||
_policy(name, &_server, parent_services, child_services,
|
||||
config_ds, elf_ds, &_entrypoint),
|
||||
_child(elf_ds, pd, ram, cpu, rm, &_entrypoint, &_policy) {
|
||||
_child(elf_ds, pd, ram, cpu, &_entrypoint, &_policy) {
|
||||
_entrypoint.activate(); }
|
||||
|
||||
Genode::Rom_session_capability rom_session_cap() { return _rom; }
|
||||
Genode::Ram_session_capability ram_session_cap() { return _ram; }
|
||||
Genode::Cpu_session_capability cpu_session_cap() { return _cpu; }
|
||||
Genode::Rm_session_capability rm_session_cap() { return _rm; }
|
||||
|
||||
const char *name() const { return _policy.name(); }
|
||||
|
||||
|
||||
@@ -251,16 +251,6 @@ Launchpad_child *Launchpad::start_child(const char *filename,
|
||||
return 0;
|
||||
}
|
||||
|
||||
Rm_connection rm;
|
||||
rm.on_destruction(Rm_connection::KEEP_OPEN);
|
||||
if (!rm.cap().valid()) {
|
||||
PWRN("Failed to create RM session");
|
||||
env()->parent()->close(ram.cap());
|
||||
env()->parent()->close(cpu.cap());
|
||||
env()->parent()->close(rom_cap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Pd_connection pd;
|
||||
pd.on_destruction(Pd_connection::KEEP_OPEN);
|
||||
if (!pd.cap().valid()) {
|
||||
@@ -268,14 +258,13 @@ Launchpad_child *Launchpad::start_child(const char *filename,
|
||||
env()->parent()->close(ram.cap());
|
||||
env()->parent()->close(cpu.cap());
|
||||
env()->parent()->close(rom_cap);
|
||||
env()->parent()->close(rm.cap());
|
||||
return 0;
|
||||
}
|
||||
|
||||
try {
|
||||
Launchpad_child *c = new (&_sliced_heap)
|
||||
Launchpad_child(unique_name, file_cap, pd.cap(), ram.cap(),
|
||||
cpu.cap(), rm.cap(), rom_cap,
|
||||
cpu.cap(), rom_cap,
|
||||
&_cap_session, &_parent_services, &_child_services,
|
||||
config_ds, this);
|
||||
|
||||
@@ -291,7 +280,6 @@ Launchpad_child *Launchpad::start_child(const char *filename,
|
||||
PWRN("Failed to create child - unknown reason");
|
||||
}
|
||||
|
||||
env()->parent()->close(rm.cap());
|
||||
env()->parent()->close(ram.cap());
|
||||
env()->parent()->close(cpu.cap());
|
||||
env()->parent()->close(rom_cap);
|
||||
@@ -453,7 +441,6 @@ void Launchpad::exit_child(Launchpad_child *child,
|
||||
Lock::Guard lock_guard(_children_lock);
|
||||
_children.remove(child);
|
||||
|
||||
Rm_session_capability rm_session_cap = child->rm_session_cap();
|
||||
Ram_session_capability ram_session_cap = child->ram_session_cap();
|
||||
Cpu_session_capability cpu_session_cap = child->cpu_session_cap();
|
||||
Rom_session_capability rom_session_cap = child->rom_session_cap();
|
||||
@@ -461,7 +448,6 @@ void Launchpad::exit_child(Launchpad_child *child,
|
||||
const Genode::Server *server = child->server();
|
||||
destruct_child(&_sliced_heap, child, timer, session_close_timeout_ms);
|
||||
|
||||
env()->parent()->close(rm_session_cap);
|
||||
env()->parent()->close(cpu_session_cap);
|
||||
env()->parent()->close(rom_session_cap);
|
||||
env()->parent()->close(ram_session_cap);
|
||||
|
||||
Reference in New Issue
Block a user