base: Refine Range_allocator::alloc_aligned

This patch changes the 'alloc_aligned' interface as follows:

- The former 'from' and 'to' arguments are replaced by a single
  'range' argument.

- The distinction of the use cases of regular allocations vs.
  address-constrained allocations is now overed by a dedicated
  overload instead of relying on a default argument.

- The 'align' argument has been changed from 'int' to 'unsigned'
  to be better compatible with 'addr_t' and 'size_t'.

Fixes #4067
This commit is contained in:
Norman Feske
2021-04-06 16:20:01 +02:00
parent 97d44c5a79
commit f925fef17b
14 changed files with 68 additions and 49 deletions

View File

@ -75,7 +75,7 @@ class Genode::Platform : public Platform_generic
bool valid_addr(addr_t ) const override { ASSERT_NEVER_CALLED; }
bool alloc(size_t, void **) override { ASSERT_NEVER_CALLED; }
Alloc_return alloc_aligned(size_t, void **, int, addr_t, addr_t) override
Alloc_return alloc_aligned(size_t, void **, unsigned, Range) override
{ ASSERT_NEVER_CALLED; }
Alloc_return alloc_addr(size_t, addr_t) override
@ -94,10 +94,9 @@ class Genode::Platform : public Platform_generic
return true;
}
Alloc_return alloc_aligned(size_t, void **out_addr, int,
addr_t, addr_t) override
Alloc_return alloc_aligned(size_t, void **out, unsigned, Range) override
{
*out_addr = 0;
*out = 0;
return Alloc_return::OK;
}