2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief PD root interface
|
|
|
|
* \author Christian Helmuth
|
|
|
|
* \date 2006-07-17
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2006-2017 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2011-12-22 16:19:25 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CORE__INCLUDE__PD_ROOT_H_
|
|
|
|
#define _CORE__INCLUDE__PD_ROOT_H_
|
|
|
|
|
|
|
|
/* Genode */
|
|
|
|
#include <root/component.h>
|
|
|
|
|
|
|
|
/* Core */
|
|
|
|
#include <pd_session_component.h>
|
|
|
|
|
|
|
|
namespace Genode {
|
2015-04-09 15:33:20 +02:00
|
|
|
class Pd_root;
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
2015-04-09 15:33:20 +02:00
|
|
|
|
2016-01-14 13:22:00 +01:00
|
|
|
class Genode::Pd_root : public Genode::Root_component<Genode::Pd_session_component>
|
2015-04-09 15:33:20 +02:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
2016-04-15 15:19:22 +02:00
|
|
|
Rpc_entrypoint &_thread_ep;
|
|
|
|
Pager_entrypoint &_pager_ep;
|
|
|
|
Allocator &_md_alloc;
|
2015-04-09 15:33:20 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
Pd_session_component *_create_session(const char *args)
|
|
|
|
{
|
2016-01-14 13:22:00 +01:00
|
|
|
/* XXX use separate entrypoint for PD sessions */
|
2015-04-09 15:33:20 +02:00
|
|
|
return new (md_alloc()) Pd_session_component(_thread_ep,
|
2016-01-14 13:22:00 +01:00
|
|
|
_thread_ep,
|
|
|
|
_thread_ep,
|
2016-04-15 15:19:22 +02:00
|
|
|
_md_alloc,
|
|
|
|
_pager_ep, args);
|
2015-04-09 15:33:20 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 08:50:16 +02:00
|
|
|
void _upgrade_session(Pd_session_component *p, const char *args)
|
|
|
|
{
|
|
|
|
size_t ram_quota =
|
|
|
|
Arg_string::find_arg(args, "ram_quota").ulong_value(0);
|
|
|
|
p->upgrade_ram_quota(ram_quota);
|
|
|
|
}
|
|
|
|
|
2015-04-09 15:33:20 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* \param session_ep entry point for managing pd session objects
|
|
|
|
* \param thread_ep entry point for managing threads
|
|
|
|
* \param md_alloc meta-data allocator to be used by root component
|
|
|
|
*/
|
2016-04-15 15:19:22 +02:00
|
|
|
Pd_root(Rpc_entrypoint *session_ep,
|
|
|
|
Rpc_entrypoint *thread_ep,
|
|
|
|
Pager_entrypoint &pager_ep,
|
|
|
|
Allocator *md_alloc)
|
2015-04-09 15:33:20 +02:00
|
|
|
: Root_component<Pd_session_component>(session_ep, md_alloc),
|
2016-04-15 15:19:22 +02:00
|
|
|
_thread_ep(*thread_ep), _pager_ep(pager_ep), _md_alloc(*md_alloc) { }
|
2015-04-09 15:33:20 +02:00
|
|
|
};
|
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
#endif /* _CORE__INCLUDE__PD_ROOT_H_ */
|