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.
This commit is contained in:
Josef Söntgen 2013-04-17 14:03:41 +02:00 committed by Norman Feske
parent 9ec791db9a
commit 29b8370f73
4 changed files with 126 additions and 1 deletions

View File

@ -33,6 +33,8 @@
#include <destruct_queue.h>
#include <destruct_dispatcher.h>
#include <local_cpu_service.h>
#include <local_ram_service.h>
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<Sysio>()),
_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();

View File

@ -65,6 +65,7 @@ namespace Noux {
_cpu.start(_main_thread, ip, sp);
}
Cpu_session_capability cpu_cap() { return _cpu.cap(); }
/***************************
** Cpu_session interface **

View File

@ -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 <base/service.h>
/* Noux includes */
#include <cpu_session_component.h>
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_ */

View File

@ -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 <base/service.h>
/* Noux includes */
#include <ram_session_component.h>
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_ */