2016-04-15 15:19:22 +02:00
|
|
|
/*
|
|
|
|
* \brief Pseudo region map client stub targeting the process-local implementation
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2011-11-21
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2011-2017 Genode Labs GmbH
|
2016-04-15 15:19:22 +02: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.
|
2016-04-15 15:19:22 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Genode includes */
|
|
|
|
#include <region_map/client.h>
|
|
|
|
|
|
|
|
/* base-internal includes */
|
|
|
|
#include <base/internal/local_capability.h>
|
|
|
|
|
|
|
|
using namespace Genode;
|
|
|
|
|
2019-12-06 14:14:49 +01:00
|
|
|
class Capability_invalid : public Genode::Exception {};
|
2016-04-15 15:19:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return pointer to locally implemented region map
|
|
|
|
*
|
|
|
|
* \throw Local_interface::Non_local_capability
|
|
|
|
*/
|
|
|
|
static Region_map *_local(Capability<Region_map> cap)
|
|
|
|
{
|
2017-10-27 14:07:09 +02:00
|
|
|
if (!cap.valid())
|
2019-12-06 14:14:49 +01:00
|
|
|
throw Capability_invalid();
|
2016-04-15 15:19:22 +02:00
|
|
|
return Local_capability<Region_map>::deref(cap);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Region_map_client::Region_map_client(Capability<Region_map> session)
|
|
|
|
: Rpc_client<Region_map>(session) { }
|
|
|
|
|
|
|
|
|
|
|
|
Region_map::Local_addr
|
|
|
|
Region_map_client::attach(Dataspace_capability ds, size_t size,
|
|
|
|
off_t offset, bool use_local_addr,
|
|
|
|
Region_map::Local_addr local_addr,
|
2018-05-08 11:21:10 +02:00
|
|
|
bool executable, bool writeable)
|
2016-04-15 15:19:22 +02:00
|
|
|
{
|
2019-01-30 17:53:16 +01:00
|
|
|
return _local(rpc_cap())->attach(ds, size, offset, use_local_addr,
|
2018-05-08 11:21:10 +02:00
|
|
|
local_addr, executable, writeable);
|
2016-04-15 15:19:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Region_map_client::detach(Local_addr local_addr) {
|
2019-01-30 17:53:16 +01:00
|
|
|
return _local(rpc_cap())->detach(local_addr); }
|
2016-04-15 15:19:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
void Region_map_client::fault_handler(Signal_context_capability /*handler*/)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* On Linux, page faults are never reflected to the user land. They
|
|
|
|
* are always handled by the kernel. If a segmentation fault
|
|
|
|
* occurs, this condition is being reflected as a CPU exception
|
|
|
|
* to the handler registered via 'Cpu_session::exception_handler'.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-30 17:53:16 +01:00
|
|
|
Region_map::State Region_map_client::state() { return _local(rpc_cap())->state(); }
|
2016-04-15 15:19:22 +02:00
|
|
|
|
|
|
|
|
2019-12-06 14:14:49 +01:00
|
|
|
Dataspace_capability Region_map_client::dataspace()
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
return _local(rpc_cap())->dataspace();
|
|
|
|
} catch (Capability_invalid&) { return Dataspace_capability(); }
|
|
|
|
}
|