From 29b8370f73a54957d688c81d5375672b880eea74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Wed, 17 Apr 2013 14:03:41 +0200 Subject: [PATCH] noux: add local cpu and ram service Use a local CPU service to prevent a redirection to noux' parent (in this case init which does not know noux' local capabilities). Fixes #791. --- ports/src/noux/child.h | 12 +++++- ports/src/noux/cpu_session_component.h | 1 + ports/src/noux/local_cpu_service.h | 58 ++++++++++++++++++++++++++ ports/src/noux/local_ram_service.h | 56 +++++++++++++++++++++++++ 4 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 ports/src/noux/local_cpu_service.h create mode 100644 ports/src/noux/local_ram_service.h diff --git a/ports/src/noux/child.h b/ports/src/noux/child.h index 36b7278e3..ad819d9fc 100644 --- a/ports/src/noux/child.h +++ b/ports/src/noux/child.h @@ -33,6 +33,8 @@ #include #include +#include +#include namespace Noux { @@ -176,6 +178,8 @@ namespace Noux { Session_capability const _noux_session_cap; Local_noux_service _local_noux_service; + Local_ram_service _local_ram_service; + Local_cpu_service _local_cpu_service; Local_rm_service _local_rm_service; Service_registry &_parent_services; @@ -272,6 +276,8 @@ namespace Noux { _sysio(_sysio_ds.local_addr()), _noux_session_cap(Session_capability(_entrypoint.manage(this))), _local_noux_service(_noux_session_cap), + _local_ram_service(_entrypoint), + _local_cpu_service(_entrypoint, _resources.cpu.cpu_cap()), _local_rm_service(_entrypoint, _resources.ds_registry), _parent_services(parent_services), _child_policy(name, _binary_ds, _args.cap(), _env.cap(), @@ -279,7 +285,11 @@ namespace Noux { _local_rm_service, _parent_services, *this, *this, _destruct_context_cap, _resources.ram), _child(_binary_ds, _resources.ram.cap(), _resources.cpu.cap(), - _resources.rm.cap(), &_entrypoint, &_child_policy) + _resources.rm.cap(), &_entrypoint, &_child_policy, + /** + * Override the implicit assignment to _parent_service + */ + _local_ram_service, _local_cpu_service, _local_rm_service) { _args.dump(); diff --git a/ports/src/noux/cpu_session_component.h b/ports/src/noux/cpu_session_component.h index 519630d07..a689dfb39 100644 --- a/ports/src/noux/cpu_session_component.h +++ b/ports/src/noux/cpu_session_component.h @@ -65,6 +65,7 @@ namespace Noux { _cpu.start(_main_thread, ip, sp); } + Cpu_session_capability cpu_cap() { return _cpu.cap(); } /*************************** ** Cpu_session interface ** diff --git a/ports/src/noux/local_cpu_service.h b/ports/src/noux/local_cpu_service.h new file mode 100644 index 000000000..62c926c58 --- /dev/null +++ b/ports/src/noux/local_cpu_service.h @@ -0,0 +1,58 @@ +/* + * \brief CPU service provided to Noux processes + * \author Josef Soentgen + * \date 2013-04-16 + */ + +/* + * Copyright (C) 2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _NOUX__LOCAL_CPU_SERVICE_H_ +#define _NOUX__LOCAL_CPU_SERVICE_H_ + +/* Genode includes */ +#include + +/* Noux includes */ +#include + +namespace Noux { + + class Local_cpu_service : public Service + { + private: + + Rpc_entrypoint &_ep; + Cpu_session_capability _cap; + + public: + + Local_cpu_service(Rpc_entrypoint &ep, Cpu_session_capability cap) + : + Service(Cpu_session::service_name()), _ep(ep), + _cap(cap) + { } + + Genode::Session_capability session(const char *args) + { + PDBG("Implement me!"); + return Genode::Session_capability(); + } + + void upgrade(Genode::Session_capability, const char *args) + { + env()->parent()->upgrade(_cap, args); + } + + void close(Genode::Session_capability session) + { + PDBG("Implement me!"); + } + }; +} + +#endif /* _NOUX__LOCAL_CPU_SERVICE_H_ */ diff --git a/ports/src/noux/local_ram_service.h b/ports/src/noux/local_ram_service.h new file mode 100644 index 000000000..64a4f4086 --- /dev/null +++ b/ports/src/noux/local_ram_service.h @@ -0,0 +1,56 @@ +/* + * \brief RAM service provided to Noux processes + * \author Josef Soentgen + * \date 2013-04-16 + */ + +/* + * Copyright (C) 2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _NOUX__LOCAL_RAM_SERVICE_H_ +#define _NOUX__LOCAL_RAM_SERVICE_H_ + +/* Genode includes */ +#include + +/* Noux includes */ +#include + +namespace Noux { + + class Local_ram_service : public Service + { + private: + + Rpc_entrypoint &_ep; + + public: + + Local_ram_service(Rpc_entrypoint &ep) + : + Service(Ram_session::service_name()), _ep(ep) + { } + + Genode::Session_capability session(const char *args) + { + PDBG("Implement me!"); + return Genode::Session_capability(); + } + + void upgrade(Genode::Session_capability, const char *args) + { + PDBG("Implement me!"); + } + + void close(Genode::Session_capability session) + { + PDBG("Implement me!"); + } + }; +} + +#endif /* _NOUX__LOCAL_RAM_SERVICE_H_ */