Automatically create a topology session when a new component is created.

This commit is contained in:
Michael Mueller
2022-10-13 16:00:18 +02:00
parent f2386c623e
commit 90b921b3cd
2 changed files with 7 additions and 1 deletions

View File

@@ -38,6 +38,7 @@
#include <io_mem_root.h>
#include <irq_root.h>
#include <trace/root.h>
#include <topo_root.h>
#include <platform_services.h>
using namespace Genode;
@@ -267,6 +268,7 @@ int main()
platform().irq_alloc(), sliced_heap);
static Trace::Root trace_root (core_ram_alloc, local_rm, ep, sliced_heap,
Trace::sources(), trace_policies);
static Topo_root topo_root(core_ram_alloc, local_rm, ep, sliced_heap);
static Core_service<Rom_session_component> rom_service (services, rom_root);
static Core_service<Rm_session_component> rm_service (services, rm_root);
@@ -276,6 +278,7 @@ int main()
static Core_service<Io_mem_session_component> io_mem_service (services, io_mem_root);
static Core_service<Irq_session_component> irq_service (services, irq_root);
static Core_service<Trace::Session_component> trace_service (services, trace_root);
static Core_service<Topo_session_component> topo_service(services, topo_root);
/* make platform-specific services known to service pool */
platform_add_local_services(ep, sliced_heap, services, Trace::sources());

View File

@@ -759,7 +759,7 @@ void Child::_try_construct_env_dependent_members()
{
/* check if the environment sessions are complete */
if (!_pd.cap().valid() || !_cpu.cap().valid() || !_log.cap().valid()
|| !_binary.cap().valid())
|| !_binary.cap().valid() || !_topo.cap().valid())
return;
/*
@@ -824,6 +824,7 @@ void Child::initiate_env_sessions()
_cpu .initiate();
_log .initiate();
_binary.initiate();
_topo.initiate();
/*
* Issue environment-session request for obtaining the linker binary. We
@@ -909,6 +910,7 @@ void Child::close_all_sessions()
* Issue close requests to the providers of the environment sessions,
* which may be async services.
*/
_topo.close();
_log.close();
_binary.close();
if (_linker.constructed())
@@ -923,6 +925,7 @@ void Child::close_all_sessions()
_discard_env_session(Env::log());
_discard_env_session(Env::binary());
_discard_env_session(Env::linker());
_discard_env_session(Env::topo());
/*
* Remove dynamically created sessions from the child's ID space.