Skip to content

Commit

Permalink
Adaptation to Genode::Allocator::try_alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
nfeske committed Nov 20, 2021
1 parent 27f5192 commit a15bbcc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/app/jdk/lib/jvm/os_genode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4347,12 +4347,11 @@ class Genode::Vm_region_map

addr_t alloc_region(size_t size, int align)
{
addr_t addr = 0;
if (_range.alloc_aligned(size, (void **)&addr,
align > 12 ? align : 12).error())
throw -1;

return addr;
return _range.alloc_aligned(size, align > 12 ? align : 12).convert<addr_t>(
[&] (void *ptr) { return (addr_t)ptr; },
[&] (Range_allocator::Alloc_error) -> addr_t {
error("Vm_region_map::alloc_region failed");
throw -1; });
}

void free_region(addr_t vaddr) { _range.free((void *)vaddr); }
Expand Down

0 comments on commit a15bbcc

Please sign in to comment.