2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Core implementation of the ROM session interface
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2006-07-06
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
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
|
|
|
*/
|
|
|
|
|
|
|
|
#include <util/arg_string.h>
|
|
|
|
#include <rom_session_component.h>
|
|
|
|
#include <root/root.h>
|
|
|
|
|
|
|
|
using namespace Genode;
|
|
|
|
|
|
|
|
|
|
|
|
Rom_session_component::Rom_session_component(Rom_fs *rom_fs,
|
|
|
|
Rpc_entrypoint *ds_ep,
|
|
|
|
const char *args)
|
|
|
|
:
|
|
|
|
_rom_module(_find_rom(rom_fs, args)),
|
2016-11-02 13:29:50 +01:00
|
|
|
_ds(_rom_module ? _rom_module->size : 0,
|
|
|
|
_rom_module ? _rom_module->addr : 0, CACHED, false, 0),
|
2011-12-22 16:19:25 +01:00
|
|
|
_ds_ep(ds_ep)
|
|
|
|
{
|
|
|
|
/* ROM module not found */
|
|
|
|
if (!_rom_module)
|
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 22:03:22 +02:00
|
|
|
throw Service_denied();
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
_ds_cap = static_cap_cast<Rom_dataspace>(_ds_ep->manage(&_ds));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Rom_session_component::~Rom_session_component()
|
|
|
|
{
|
|
|
|
_ds_ep->dissolve(&_ds);
|
|
|
|
}
|