2011-12-22 15:19:25 +00:00
|
|
|
/*
|
2016-04-15 13:19:22 +00:00
|
|
|
* \brief Region-map session interface
|
2011-12-22 15:19:25 +00:00
|
|
|
* \author Norman Feske
|
2016-04-15 13:19:22 +00:00
|
|
|
* \date 2016-04-15
|
2011-12-22 15:19:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 12:23:52 +00:00
|
|
|
* Copyright (C) 2016-2017 Genode Labs GmbH
|
2011-12-22 15:19:25 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 12:23:52 +00:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2011-12-22 15:19:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__RM_SESSION__RM_SESSION_H_
|
|
|
|
#define _INCLUDE__RM_SESSION__RM_SESSION_H_
|
|
|
|
|
2016-04-15 13:19:22 +00:00
|
|
|
#include <region_map/region_map.h>
|
2011-12-22 15:19:25 +00:00
|
|
|
#include <session/session.h>
|
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
namespace Genode { struct Rm_session; }
|
|
|
|
|
|
|
|
|
|
|
|
struct Genode::Rm_session : Session
|
|
|
|
{
|
2017-05-24 12:41:19 +00:00
|
|
|
/**
|
|
|
|
* \noapi
|
|
|
|
*/
|
2015-03-04 20:12:14 +00:00
|
|
|
static const char *service_name() { return "RM"; }
|
|
|
|
|
2017-05-07 20:03:25 +00:00
|
|
|
/*
|
|
|
|
* An RM session consumes a dataspace capability for the session-object
|
|
|
|
* allocation and its session capability.
|
|
|
|
*/
|
|
|
|
enum { CAP_QUOTA = 2 };
|
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
2016-04-15 13:19:22 +00:00
|
|
|
* Create region map
|
2015-03-04 20:12:14 +00:00
|
|
|
*
|
2016-04-15 13:19:22 +00:00
|
|
|
* \param size upper bound of region map
|
|
|
|
* \return region-map capability
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
* \throw Out_of_ram
|
|
|
|
* \throw Out_of_caps
|
2015-03-04 20:12:14 +00:00
|
|
|
*/
|
2016-04-15 13:19:22 +00:00
|
|
|
virtual Capability<Region_map> create(size_t size) = 0;
|
2015-03-04 20:12:14 +00:00
|
|
|
|
|
|
|
/**
|
2016-04-15 13:19:22 +00:00
|
|
|
* Destroy region map
|
2015-03-04 20:12:14 +00:00
|
|
|
*/
|
2016-04-15 13:19:22 +00:00
|
|
|
virtual void destroy(Capability<Region_map>) = 0;
|
2015-03-04 20:12:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
** RPC declaration **
|
|
|
|
*********************/
|
|
|
|
|
2016-04-15 13:19:22 +00:00
|
|
|
GENODE_RPC_THROW(Rpc_create, Capability<Region_map>, create,
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps), size_t);
|
2016-04-15 13:19:22 +00:00
|
|
|
GENODE_RPC(Rpc_destroy, void, destroy, Capability<Region_map>);
|
2015-03-04 20:12:14 +00:00
|
|
|
|
2016-04-15 13:19:22 +00:00
|
|
|
GENODE_RPC_INTERFACE(Rpc_create, Rpc_destroy);
|
2015-03-04 20:12:14 +00:00
|
|
|
};
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#endif /* _INCLUDE__RM_SESSION__RM_SESSION_H_ */
|