mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-23 09:15:36 +00:00
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).
This commit is contained in:
committed by
Christian Helmuth
parent
1f4f119b1e
commit
4d442bca30
@ -127,7 +127,7 @@ void *Lx::ioremap(addr_t phys_addr, unsigned long size,
|
||||
|
||||
Lx_kit::Mapped_io_mem_range *io_mem = nullptr;
|
||||
|
||||
retry<Genode::Region_map::Out_of_metadata>(
|
||||
retry<Genode::Out_of_ram>(
|
||||
[&] () {
|
||||
io_mem = new (&Lx_kit::env().heap())
|
||||
Lx_kit::Mapped_io_mem_range(Lx_kit::env().env(), *_global_rm,
|
||||
|
@ -123,8 +123,12 @@ Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached)
|
||||
obj = new (_global_md_alloc) Ram_object(*_global_ram, cap);
|
||||
} else {
|
||||
Genode::size_t donate = size;
|
||||
cap = retry<Platform::Session::Out_of_metadata>(
|
||||
[&] () { return _global_pci->alloc_dma_buffer(size); },
|
||||
cap = retry<Genode::Out_of_ram>(
|
||||
[&] () {
|
||||
return retry<Genode::Out_of_caps>(
|
||||
[&] () { return _global_pci->alloc_dma_buffer(size); },
|
||||
[&] () { _global_pci->upgrade_caps(2); });
|
||||
},
|
||||
[&] () {
|
||||
_global_pci->upgrade_ram(donate);
|
||||
donate = donate * 2 > size ? 4096 : donate * 2;
|
||||
|
Reference in New Issue
Block a user