mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-23 09:15:36 +00:00
Remove exceptions from Pd_session interface
This patch replaces exceptions of the PD session RPC interface with result types. The change of the quota-transfer RPC functions required the adaptation of base/quota_transfer.h and base/child.h. The 'alloc_signal_source' method has been renamed to 'signal_source' to avoid an exceedingly long name of the corresponding result type. The Pd_session::map function takes a 'Virt_range' instead of basic-type arguments. The 'Signal_source_capability' alias for 'Capability<Signal_source>' has been removed. Issue #5245
This commit is contained in:
@ -23,7 +23,6 @@
|
||||
/* core includes */
|
||||
#include <platform.h>
|
||||
#include <signal_source_component.h>
|
||||
#include <signal_source/capability.h>
|
||||
#include <signal_context_slab.h>
|
||||
|
||||
namespace Core { class Signal_broker; }
|
||||
@ -38,7 +37,7 @@ class Core::Signal_broker
|
||||
Object_pool<Signal_context_component> _obj_pool { };
|
||||
Rpc_entrypoint &_context_ep;
|
||||
Signal_source_component _source;
|
||||
Signal_source_capability _source_cap;
|
||||
Capability<Signal_source> _source_cap;
|
||||
Signal_context_slab _context_slab { _md_alloc };
|
||||
|
||||
public:
|
||||
@ -66,15 +65,15 @@ class Core::Signal_broker
|
||||
free_context(reinterpret_cap_cast<Signal_context>(r->cap()));
|
||||
}
|
||||
|
||||
Signal_source_capability alloc_signal_source() { return _source_cap; }
|
||||
Capability<Signal_source> alloc_signal_source() { return _source_cap; }
|
||||
|
||||
void free_signal_source(Signal_source_capability) { }
|
||||
void free_signal_source(Capability<Signal_source>) { }
|
||||
|
||||
/*
|
||||
* \throw Allocator::Out_of_memory
|
||||
*/
|
||||
Signal_context_capability
|
||||
alloc_context(Signal_source_capability, unsigned long imprint)
|
||||
alloc_context(Capability<Signal_source>, unsigned long imprint)
|
||||
{
|
||||
/*
|
||||
* XXX For now, we ignore the signal-source argument as we
|
||||
|
@ -43,7 +43,7 @@ bool Pd_session_component::assign_pci(addr_t pci_config_memory, uint16_t bdf)
|
||||
}
|
||||
|
||||
|
||||
void Pd_session_component::map(addr_t virt, addr_t size)
|
||||
Pd_session::Map_result Pd_session_component::map(Pd_session::Virt_range const virt_range)
|
||||
{
|
||||
Platform_pd &target_pd = *_pd;
|
||||
Nova::Utcb &utcb = *reinterpret_cast<Nova::Utcb *>(Thread::myself()->utcb());
|
||||
@ -74,6 +74,8 @@ void Pd_session_component::map(addr_t virt, addr_t size)
|
||||
}
|
||||
};
|
||||
|
||||
addr_t virt = virt_range.start;
|
||||
size_t size = virt_range.num_bytes;
|
||||
try {
|
||||
while (size) {
|
||||
|
||||
@ -98,9 +100,13 @@ void Pd_session_component::map(addr_t virt, addr_t size)
|
||||
[&] (Region_map_component &, Fault const &) { /* don't reflect */ }
|
||||
);
|
||||
}
|
||||
} catch (...) {
|
||||
}
|
||||
catch (Out_of_ram) { return Map_result::OUT_OF_RAM; }
|
||||
catch (Out_of_caps) { return Map_result::OUT_OF_CAPS; }
|
||||
catch (...) {
|
||||
error(__func__, " failed ", Hex(virt), "+", Hex(size));
|
||||
}
|
||||
return Map_result::OK;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user