mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-24 07:46:42 +00:00
parent
b5c9107465
commit
a2b0553c51
@ -83,13 +83,12 @@ class Bootstrap::Platform
|
||||
void add(Memory_region const &);
|
||||
void remove(Memory_region const &);
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each_free_region(FUNC functor)
|
||||
void for_each_free_region(auto const &fn)
|
||||
{
|
||||
_block_tree().for_each([&] (Block const & b)
|
||||
{
|
||||
if (!b.used())
|
||||
functor(Memory_region(b.addr(), b.size()));
|
||||
fn(Memory_region(b.addr(), b.size()));
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -117,13 +116,13 @@ class Bootstrap::Platform
|
||||
{
|
||||
Elf(addr_t const addr) : Genode::Elf_binary(addr) { }
|
||||
|
||||
template <typename T> void for_each_segment(T functor)
|
||||
void for_each_segment(auto const &fn)
|
||||
{
|
||||
Genode::Elf_segment segment;
|
||||
for (unsigned i = 0; (segment = get_segment(i)).valid(); i++) {
|
||||
if (segment.flags().skip) continue;
|
||||
if (segment.mem_size() == 0) continue;
|
||||
functor(segment);
|
||||
fn(segment);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -72,14 +72,10 @@ class Genode::Multiboot2_info : Mmio<0x8>
|
||||
|
||||
Multiboot2_info(addr_t mbi) : Mmio({(char *)mbi, Mmio::SIZE}) { }
|
||||
|
||||
template <typename FUNC_MEM,
|
||||
typename FUNC_ACPI,
|
||||
typename FUNC_FB,
|
||||
typename FUNC_SYSTAB64>
|
||||
void for_each_tag(FUNC_MEM mem_fn,
|
||||
FUNC_ACPI acpi_fn,
|
||||
FUNC_FB fb_fn,
|
||||
FUNC_SYSTAB64 systab64_fn)
|
||||
void for_each_tag(auto const &mem_fn,
|
||||
auto const &acpi_fn,
|
||||
auto const &fb_fn,
|
||||
auto const &systab64_fn)
|
||||
{
|
||||
addr_t const size = read<Multiboot2_info::Size>();
|
||||
|
||||
|
@ -260,10 +260,9 @@ class Kernel::Cpu_pool
|
||||
*/
|
||||
Cpu & executing_cpu() { return cpu(Cpu::executing_id()); }
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each_cpu(FUNC const &func)
|
||||
void for_each_cpu(auto const &fn)
|
||||
{
|
||||
for (unsigned i = 0; i < _nr_of_cpus; i++) func(cpu(i));
|
||||
for (unsigned i = 0; i < _nr_of_cpus; i++) fn(cpu(i));
|
||||
}
|
||||
|
||||
Inter_processor_work_list & work_list() {
|
||||
|
@ -113,15 +113,15 @@ class Kernel::Ipc_node
|
||||
Thread &helping_destination();
|
||||
|
||||
/**
|
||||
* Call function 'f' of type 'void (Ipc_node *)' for each helper
|
||||
* Call 'fn' of type 'void (Ipc_node *)' for each helper
|
||||
*/
|
||||
template <typename F> void for_each_helper(F f)
|
||||
void for_each_helper(auto const &fn)
|
||||
{
|
||||
_in.queue.for_each([f] (Queue_item &item) {
|
||||
_in.queue.for_each([fn] (Queue_item &item) {
|
||||
Ipc_node &node { item.object() };
|
||||
|
||||
if (node._helping())
|
||||
f(node._thread);
|
||||
fn(node._thread);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -265,9 +265,7 @@ class Kernel::Core_object : public T, Kernel::Core_object_identity<T>
|
||||
/**
|
||||
* Constructor used for objects other than the Core PD
|
||||
*/
|
||||
template <typename... ARGS>
|
||||
Core_object(Pd &core_pd,
|
||||
ARGS &&... args)
|
||||
Core_object(Pd &core_pd, auto &&... args)
|
||||
:
|
||||
T(args...),
|
||||
Core_object_identity<T>(core_pd, *static_cast<T*>(this))
|
||||
@ -276,8 +274,7 @@ class Kernel::Core_object : public T, Kernel::Core_object_identity<T>
|
||||
/**
|
||||
* Constructor used for Core PD object
|
||||
*/
|
||||
template <typename... ARGS>
|
||||
Core_object(ARGS &&... args)
|
||||
Core_object(auto &&... args)
|
||||
:
|
||||
T(args...),
|
||||
Core_object_identity<T>(*static_cast<T*>(this))
|
||||
|
@ -106,13 +106,13 @@ class Kernel::Scheduler
|
||||
|
||||
public:
|
||||
|
||||
template <typename F> void for_each(F const &fn)
|
||||
void for_each(auto const &fn)
|
||||
{
|
||||
for (List_element * le = _list.first(); le; le = le->next())
|
||||
fn(*le->object());
|
||||
}
|
||||
|
||||
template <typename F> void for_each(F const &fn) const
|
||||
void for_each(auto const &fn) const
|
||||
{
|
||||
for (List_element const * le = _list.first(); le;
|
||||
le = le->next()) fn(*le->object());
|
||||
@ -176,10 +176,10 @@ class Kernel::Scheduler
|
||||
Context &_idle;
|
||||
Context *_current { nullptr };
|
||||
|
||||
template <typename F> void _each_prio_until(F f)
|
||||
void _each_prio_until(auto const &fn)
|
||||
{
|
||||
for (unsigned p = Priority::max(); p != Priority::min()-1; p--)
|
||||
if (f(p))
|
||||
if (fn(p))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -307,15 +307,14 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout
|
||||
void _call_exception_state();
|
||||
void _call_single_step();
|
||||
|
||||
template <typename T, typename... ARGS>
|
||||
void _call_new(ARGS &&... args)
|
||||
template <typename T>
|
||||
void _call_new(auto &&... args)
|
||||
{
|
||||
Core::Kernel_object<T> & kobj = *(Core::Kernel_object<T>*)user_arg_1();
|
||||
kobj.construct(_core_pd, args...);
|
||||
user_arg_0(kobj->core_capid());
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void _call_delete()
|
||||
{
|
||||
|
@ -49,8 +49,7 @@ class Core::Kernel_object : public Constructible<Kernel::Core_object<T>>
|
||||
/**
|
||||
* Creates a kernel object via a syscall
|
||||
*/
|
||||
template <typename... ARGS>
|
||||
Kernel_object(Called_from_core, ARGS &&... args)
|
||||
Kernel_object(Called_from_core, auto &&... args)
|
||||
:
|
||||
_cap(Capability_space::import(T::syscall_create(*this, args...)))
|
||||
{ }
|
||||
@ -58,8 +57,7 @@ class Core::Kernel_object : public Constructible<Kernel::Core_object<T>>
|
||||
/**
|
||||
* Creates a kernel object directly
|
||||
*/
|
||||
template <typename... ARGS>
|
||||
Kernel_object(Called_from_kernel, ARGS &&... args)
|
||||
Kernel_object(Called_from_kernel, auto &&... args)
|
||||
:
|
||||
_cap(Capability_space::import(Kernel::cap_id_invalid()))
|
||||
{
|
||||
@ -77,8 +75,7 @@ class Core::Kernel_object : public Constructible<Kernel::Core_object<T>>
|
||||
/**
|
||||
* Create the kernel object explicitely via this function
|
||||
*/
|
||||
template <typename... ARGS>
|
||||
bool create(ARGS &&... args)
|
||||
bool create(auto &&... args)
|
||||
{
|
||||
if (Constructible<Kernel::Core_object<T>>::constructed())
|
||||
return false;
|
||||
|
@ -151,8 +151,7 @@ class Core::Platform : public Platform_generic
|
||||
|
||||
static addr_t core_main_thread_phys_utcb();
|
||||
|
||||
template <typename T>
|
||||
static void apply_with_boot_info(T const &fn)
|
||||
static void apply_with_boot_info(auto const &fn)
|
||||
{
|
||||
fn(_boot_info());
|
||||
}
|
||||
|
@ -109,18 +109,17 @@ void Arm_cpu::switch_to(Arm_cpu::Mmu_context & ctx)
|
||||
}
|
||||
|
||||
|
||||
template <typename FUNC>
|
||||
static inline void cache_maintainance(addr_t const base,
|
||||
size_t const size,
|
||||
size_t const cache_line_size,
|
||||
FUNC & func)
|
||||
auto const &fn)
|
||||
{
|
||||
/* align the start address to catch all related cache lines */
|
||||
addr_t start = base & ~(cache_line_size-1);
|
||||
addr_t const end = base + size;
|
||||
|
||||
/* iterate over all cachelines of the given region and apply the functor */
|
||||
for (; start < end; start += cache_line_size) func(start);
|
||||
for (; start < end; start += cache_line_size) fn(start);
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,11 +19,10 @@
|
||||
using namespace Kernel;
|
||||
|
||||
|
||||
template <typename FN>
|
||||
static void for_cachelines(addr_t base,
|
||||
size_t const size,
|
||||
Kernel::Thread & thread,
|
||||
FN const & fn)
|
||||
Kernel::Thread &thread,
|
||||
auto const &fn)
|
||||
{
|
||||
/**
|
||||
* sanity check that only one small page is affected,
|
||||
|
@ -90,15 +90,14 @@ size_t Cpu::cache_line_size()
|
||||
}
|
||||
|
||||
|
||||
template <typename FUNC>
|
||||
static inline void cache_maintainance(addr_t const base,
|
||||
size_t const size,
|
||||
FUNC & func)
|
||||
auto const &fn)
|
||||
{
|
||||
/* align the start address to catch all related cache lines */
|
||||
addr_t start = (addr_t)base & ~(Cpu::cache_line_size()-1UL);
|
||||
addr_t const end = base + size;
|
||||
for (; start < end; start += Cpu::cache_line_size()) func(start);
|
||||
for (; start < end; start += Cpu::cache_line_size()) fn(start);
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
#include <base/log.h>
|
||||
|
||||
namespace Kernel {
|
||||
template <typename... ARGS>
|
||||
inline void panic(ARGS &&... args)
|
||||
|
||||
inline void panic(auto &&... args)
|
||||
{
|
||||
Genode::error("Kernel panic: ", args...);
|
||||
/* This is CPU local, but should be sufficient for now. */
|
||||
|
@ -61,7 +61,6 @@ namespace Hw {
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <unsigned _PAGE_SIZE_LOG2, unsigned _SIZE_LOG2>
|
||||
struct Pml4e_table_descriptor : Ept_common_descriptor
|
||||
{
|
||||
|
@ -39,8 +39,7 @@ class Genode::Align_at
|
||||
|
||||
public:
|
||||
|
||||
template <typename... ARGS>
|
||||
Align_at(ARGS &&... args)
|
||||
Align_at(auto &&... args)
|
||||
: _obj(*construct_at<T>(_start_addr(), args...)) { }
|
||||
|
||||
~Align_at() { _obj.~T(); }
|
||||
|
@ -18,10 +18,9 @@
|
||||
#include <util/misc_math.h>
|
||||
#include <util/touch.h>
|
||||
|
||||
template <typename FN>
|
||||
static inline void for_each_page(Genode::addr_t addr,
|
||||
Genode::size_t size,
|
||||
FN const & fn)
|
||||
auto const &fn)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
@ -36,10 +35,9 @@ static inline void for_each_page(Genode::addr_t addr,
|
||||
}
|
||||
|
||||
|
||||
template <typename FN>
|
||||
static inline void for_each_cache_line(Genode::addr_t addr,
|
||||
Genode::size_t size,
|
||||
FN const & fn)
|
||||
auto const &fn)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
|
@ -41,12 +41,11 @@ struct Hw::Mmio_space : Hw::Memory_region_array
|
||||
{
|
||||
using Hw::Memory_region_array::Memory_region_array;
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each_mapping(FUNC f) const
|
||||
void for_each_mapping(auto const &fn) const
|
||||
{
|
||||
addr_t virt_base = Mm::core_mmio().base;
|
||||
auto lambda = [&] (unsigned, Memory_region const & r) {
|
||||
f(Mapping { r.base, virt_base, r.size, Genode::PAGE_FLAGS_KERN_IO });
|
||||
fn(Mapping { r.base, virt_base, r.size, Genode::PAGE_FLAGS_KERN_IO });
|
||||
virt_base += r.size + get_page_size();
|
||||
};
|
||||
for_each(lambda);
|
||||
|
@ -19,8 +19,7 @@
|
||||
namespace Hw {
|
||||
namespace Mm {
|
||||
|
||||
template <typename T>
|
||||
Genode::addr_t el2_addr(T t)
|
||||
Genode::addr_t el2_addr(auto t)
|
||||
{
|
||||
static constexpr Genode::addr_t OFF = 0xffffff8000000000UL;
|
||||
return (Genode::addr_t)t - OFF;
|
||||
|
@ -184,8 +184,7 @@ class Sv39::Level_x_translation_table
|
||||
return align_addr<size_t>(region, (unsigned)alignment) / (1UL << alignment); }
|
||||
|
||||
|
||||
template <typename FUNC>
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, FUNC &&func)
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, auto const &fn)
|
||||
{
|
||||
/* sanity check vo bits 38 to 63 must be equal */
|
||||
addr_t sanity = vo >> 38;
|
||||
@ -202,7 +201,7 @@ class Sv39::Level_x_translation_table
|
||||
addr_t end = (vo + BLOCK_SIZE) & BLOCK_MASK;
|
||||
size_t sz = min(size, end-vo);
|
||||
|
||||
func(vo, pa, sz, _entries[i]);
|
||||
fn(vo, pa, sz, _entries[i]);
|
||||
|
||||
/* flush cached table entry address */
|
||||
_translation_added((addr_t)&_entries[i], sz);
|
||||
@ -228,7 +227,7 @@ class Sv39::Level_x_translation_table
|
||||
void operator () (addr_t const vo,
|
||||
addr_t const pa,
|
||||
size_t const size,
|
||||
typename Descriptor::access_t &desc)
|
||||
typename Descriptor::access_t &desc) const
|
||||
{
|
||||
using Td = Table_descriptor;
|
||||
|
||||
@ -280,7 +279,7 @@ class Sv39::Level_x_translation_table
|
||||
void operator () (addr_t const vo,
|
||||
addr_t const /* pa */,
|
||||
size_t const size,
|
||||
typename Descriptor::access_t &desc)
|
||||
typename Descriptor::access_t &desc) const
|
||||
{
|
||||
using Td = Table_descriptor;
|
||||
|
||||
@ -375,7 +374,7 @@ namespace Sv39 {
|
||||
void operator () (addr_t const vo,
|
||||
addr_t const pa,
|
||||
size_t const size,
|
||||
Descriptor::access_t &desc)
|
||||
Descriptor::access_t &desc) const
|
||||
{
|
||||
if ((vo & ~BLOCK_MASK) || (pa & ~BLOCK_MASK) ||
|
||||
size < BLOCK_SIZE) {
|
||||
@ -401,7 +400,7 @@ namespace Sv39 {
|
||||
void operator () (addr_t /* vo */,
|
||||
addr_t /* pa */,
|
||||
size_t /* size */,
|
||||
Descriptor::access_t &desc) {
|
||||
Descriptor::access_t &desc) const {
|
||||
desc = 0; }
|
||||
};
|
||||
}
|
||||
|
@ -23,14 +23,9 @@ namespace Hw {
|
||||
struct Acpi_fadt;
|
||||
struct Acpi_facs;
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each_rsdt_entry(Hw::Acpi_generic &, FUNC);
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each_xsdt_entry(Hw::Acpi_generic &, FUNC);
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each_apic_struct(Acpi_generic &, FUNC);
|
||||
void for_each_rsdt_entry (Hw::Acpi_generic &, auto const &);
|
||||
void for_each_xsdt_entry (Hw::Acpi_generic &, auto const &);
|
||||
void for_each_apic_struct(Acpi_generic &, auto const &);
|
||||
}
|
||||
|
||||
|
||||
@ -378,8 +373,7 @@ struct Hw::Acpi_facs : Genode::Mmio<64>
|
||||
};
|
||||
|
||||
|
||||
template <typename FUNC>
|
||||
void Hw::for_each_rsdt_entry(Hw::Acpi_generic &rsdt, FUNC fn)
|
||||
void Hw::for_each_rsdt_entry(Hw::Acpi_generic &rsdt, auto const &fn)
|
||||
{
|
||||
if (Genode::memcmp(rsdt.signature, "RSDT", 4))
|
||||
return;
|
||||
@ -395,8 +389,7 @@ void Hw::for_each_rsdt_entry(Hw::Acpi_generic &rsdt, FUNC fn)
|
||||
}
|
||||
|
||||
|
||||
template <typename FUNC>
|
||||
void Hw::for_each_xsdt_entry(Hw::Acpi_generic &xsdt, FUNC fn)
|
||||
void Hw::for_each_xsdt_entry(Hw::Acpi_generic &xsdt, auto const &fn)
|
||||
{
|
||||
if (Genode::memcmp(xsdt.signature, "XSDT", 4))
|
||||
return;
|
||||
@ -412,8 +405,7 @@ void Hw::for_each_xsdt_entry(Hw::Acpi_generic &xsdt, FUNC fn)
|
||||
}
|
||||
|
||||
|
||||
template <typename FUNC>
|
||||
void Hw::for_each_apic_struct(Hw::Acpi_generic &apic_madt, FUNC fn)
|
||||
void Hw::for_each_apic_struct(Hw::Acpi_generic &apic_madt, auto const &fn)
|
||||
{
|
||||
if (Genode::memcmp(apic_madt.signature, "APIC", 4))
|
||||
return;
|
||||
|
@ -143,7 +143,7 @@ class Hw::Level_4_translation_table
|
||||
|
||||
void operator () (addr_t const vo, addr_t const pa,
|
||||
size_t const size,
|
||||
Descriptor::access_t &desc)
|
||||
Descriptor::access_t &desc) const
|
||||
{
|
||||
if ((vo & ~PAGE_MASK) || (pa & ~PAGE_MASK) ||
|
||||
size < PAGE_SIZE)
|
||||
@ -165,12 +165,11 @@ class Hw::Level_4_translation_table
|
||||
struct Remove_func
|
||||
{
|
||||
void operator () (addr_t /* vo */, addr_t /* pa */, size_t /* size */,
|
||||
Descriptor::access_t &desc)
|
||||
Descriptor::access_t &desc) const
|
||||
{ desc = 0; }
|
||||
};
|
||||
|
||||
template <typename FUNC>
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, FUNC &&func)
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, auto const &fn)
|
||||
{
|
||||
for (size_t i = vo >> PAGE_SIZE_LOG2; size > 0;
|
||||
i = vo >> PAGE_SIZE_LOG2) {
|
||||
@ -178,7 +177,7 @@ class Hw::Level_4_translation_table
|
||||
addr_t end = (vo + PAGE_SIZE) & PAGE_MASK;
|
||||
size_t sz = Genode::min(size, end-vo);
|
||||
|
||||
func(vo, pa, sz, _entries[i]);
|
||||
fn(vo, pa, sz, _entries[i]);
|
||||
|
||||
/* check whether we wrap */
|
||||
if (end < vo) return;
|
||||
@ -352,7 +351,7 @@ class Hw::Page_directory
|
||||
|
||||
void operator () (addr_t const vo, addr_t const pa,
|
||||
size_t const size,
|
||||
typename Descriptor::access_t &desc)
|
||||
typename Descriptor::access_t &desc) const
|
||||
{
|
||||
using Td = Table_descriptor;
|
||||
using access_t = typename Descriptor::access_t;
|
||||
@ -397,7 +396,7 @@ class Hw::Page_directory
|
||||
|
||||
void operator () (addr_t const vo, addr_t /* pa */,
|
||||
size_t const size,
|
||||
typename Base_descriptor::access_t &desc)
|
||||
typename Base_descriptor::access_t &desc) const
|
||||
{
|
||||
if (Base_descriptor::present(desc)) {
|
||||
if (Base_descriptor::maps_page(desc)) {
|
||||
@ -418,8 +417,7 @@ class Hw::Page_directory
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FUNC>
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, FUNC &&func)
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, auto const &fn)
|
||||
{
|
||||
for (size_t i = vo >> PAGE_SIZE_LOG2; size > 0;
|
||||
i = vo >> PAGE_SIZE_LOG2)
|
||||
@ -428,7 +426,7 @@ class Hw::Page_directory
|
||||
addr_t end = (vo + PAGE_SIZE) & PAGE_MASK;
|
||||
size_t sz = Genode::min(size, end-vo);
|
||||
|
||||
func(vo, pa, sz, _entries[i]);
|
||||
fn(vo, pa, sz, _entries[i]);
|
||||
|
||||
/* check whether we wrap */
|
||||
if (end < vo) return;
|
||||
@ -553,7 +551,7 @@ class Hw::Pml4_table
|
||||
|
||||
void operator () (addr_t const vo, addr_t const pa,
|
||||
size_t const size,
|
||||
Descriptor::access_t &desc)
|
||||
Descriptor::access_t &desc) const
|
||||
{
|
||||
/* we need to use a next level table */
|
||||
if (!Descriptor::present(desc)) {
|
||||
@ -577,7 +575,7 @@ class Hw::Pml4_table
|
||||
|
||||
void operator () (addr_t const vo, addr_t /* pa */,
|
||||
size_t const size,
|
||||
Descriptor::access_t &desc)
|
||||
Descriptor::access_t &desc) const
|
||||
{
|
||||
if (Descriptor::present(desc)) {
|
||||
/* use allocator to retrieve virt address of table */
|
||||
@ -592,8 +590,7 @@ class Hw::Pml4_table
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FUNC>
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, FUNC &&func)
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, auto const &fn)
|
||||
{
|
||||
for (size_t i = (vo & SIZE_MASK) >> PAGE_SIZE_LOG2; size > 0;
|
||||
i = (vo & SIZE_MASK) >> PAGE_SIZE_LOG2) {
|
||||
@ -601,7 +598,7 @@ class Hw::Pml4_table
|
||||
addr_t end = (vo + PAGE_SIZE) & PAGE_MASK;
|
||||
size_t sz = Genode::min(size, end-vo);
|
||||
|
||||
func(vo, pa, sz, _entries[i]);
|
||||
fn(vo, pa, sz, _entries[i]);
|
||||
|
||||
/* check whether we wrap */
|
||||
if (end < vo) return;
|
||||
|
@ -60,10 +60,10 @@ class Scheduler_test::Context : public Kernel::Scheduler::Context
|
||||
|
||||
struct Scheduler_test::Scheduler : Kernel::Scheduler
|
||||
{
|
||||
template <typename F> void _each_prio_until(F f) const
|
||||
void _each_prio_until(auto const &fn) const
|
||||
{
|
||||
for (unsigned p = Priority::max(); p != Priority::min()-1; p--)
|
||||
if (f(p))
|
||||
if (fn(p))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,8 @@ struct Core::Pager_entrypoint
|
||||
{
|
||||
Pager_entrypoint(Rpc_cap_factory &) { }
|
||||
|
||||
template <typename FUNC>
|
||||
auto apply(Pager_capability, FUNC f) -> decltype(f(nullptr)) {
|
||||
return f(nullptr); }
|
||||
auto apply(Pager_capability, auto const &fn) -> decltype(fn(nullptr)) {
|
||||
return fn(nullptr); }
|
||||
|
||||
Pager_capability manage(Pager_object &) { return Pager_capability(); }
|
||||
|
||||
|
@ -89,8 +89,7 @@ class Genode::Capability_space_tpl : Noncopyable
|
||||
*/
|
||||
struct Tree_managed_data : Data, Avl_node<Tree_managed_data>
|
||||
{
|
||||
template <typename... ARGS>
|
||||
Tree_managed_data(ARGS... args) : Data(args...) { }
|
||||
Tree_managed_data(auto &&... args) : Data(args...) { }
|
||||
|
||||
Tree_managed_data() { }
|
||||
|
||||
@ -142,8 +141,7 @@ class Genode::Capability_space_tpl : Noncopyable
|
||||
* The arguments are passed to the constructor of the
|
||||
* 'Native_capability::Data' type.
|
||||
*/
|
||||
template <typename... ARGS>
|
||||
Native_capability::Data &_create_capability_unsynchronized(ARGS &&... args)
|
||||
Native_capability::Data &_create_capability_unsynchronized(auto &&... args)
|
||||
{
|
||||
addr_t const index = _alloc.alloc();
|
||||
|
||||
|
@ -80,8 +80,7 @@ class Genode::Native_thread
|
||||
/*
|
||||
* Execute functor 'fn' in the context of the 'poll' method.
|
||||
*/
|
||||
template <typename FN>
|
||||
void _exec_control(FN const &);
|
||||
void _exec_control(auto const &fn);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -114,8 +114,7 @@ class Genode::Region_map_mmap : public Region_map, public Dataspace
|
||||
Region_map_mmap(bool sub_rm, size_t size = ~0)
|
||||
: _sub_rm(sub_rm), _size(size), _base(0) { }
|
||||
|
||||
template <typename FN>
|
||||
void with_attached_sub_rm_base_ptr(FN const &fn)
|
||||
void with_attached_sub_rm_base_ptr(auto const &fn)
|
||||
{
|
||||
if (_sub_rm && _is_attached())
|
||||
fn((void *)_base);
|
||||
|
@ -228,8 +228,7 @@ namespace Nova {
|
||||
/**
|
||||
* Iterate over all CPUs in a _ever_ _consistent_ order.
|
||||
*/
|
||||
template <typename FUNC>
|
||||
bool for_all_cpus(FUNC const &func) const
|
||||
bool for_all_cpus(auto const &fn) const
|
||||
{
|
||||
for (uint16_t package = 0; package <= 255; package++) {
|
||||
for (uint16_t core = 0; core <= 255; core++) {
|
||||
@ -246,7 +245,7 @@ namespace Nova {
|
||||
cpu->thread == thread))
|
||||
continue;
|
||||
|
||||
bool done = func(*cpu, i);
|
||||
bool done = fn(*cpu, i);
|
||||
if (done)
|
||||
return done;
|
||||
}
|
||||
@ -256,14 +255,13 @@ namespace Nova {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each_enabled_cpu(FUNC const &func) const
|
||||
void for_each_enabled_cpu(auto const &fn) const
|
||||
{
|
||||
for (unsigned i = 0; i < cpu_max(); i++) {
|
||||
Cpu_desc const * cpu = cpu_desc_of_cpu(i);
|
||||
if (!is_cpu_enabled(i)) continue;
|
||||
if (!cpu) return;
|
||||
func(*cpu, i);
|
||||
fn(*cpu, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,12 +219,11 @@ inline void unmap_local(Nova::Utcb &, Genode::addr_t start,
|
||||
}
|
||||
|
||||
|
||||
template <typename FUNC>
|
||||
inline Nova::uint8_t syscall_retry(Core::Pager_object &pager, FUNC func)
|
||||
inline Nova::uint8_t syscall_retry(Core::Pager_object &pager, auto const &fn)
|
||||
{
|
||||
Nova::uint8_t res;
|
||||
do {
|
||||
res = func();
|
||||
res = fn();
|
||||
} while (res == Nova::NOVA_PD_OOM && Nova::NOVA_OK == pager.handle_oom());
|
||||
|
||||
return res;
|
||||
|
@ -131,8 +131,7 @@ class Core::Platform : public Platform_generic
|
||||
*/
|
||||
unsigned core_pd_sel() const { return _core_pd_sel; }
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each_location(FUNC const &fn)
|
||||
void for_each_location(auto const &fn)
|
||||
{
|
||||
for (unsigned x = 0; x < _cpus.width(); x++) {
|
||||
for (unsigned y = 0; y < _cpus.height(); y++) {
|
||||
|
@ -20,12 +20,11 @@
|
||||
|
||||
using namespace Core;
|
||||
|
||||
template <typename FUNC>
|
||||
inline Nova::uint8_t retry_syscall(addr_t pd_sel, FUNC func)
|
||||
inline Nova::uint8_t retry_syscall(addr_t pd_sel, auto const &fn)
|
||||
{
|
||||
Nova::uint8_t res;
|
||||
do {
|
||||
res = func();
|
||||
res = fn();
|
||||
} while (res == Nova::NOVA_PD_OOM &&
|
||||
Nova::NOVA_OK == Pager_object::handle_oom(Pager_object::SRC_CORE_PD,
|
||||
pd_sel,
|
||||
@ -127,8 +126,7 @@ class System_control_impl : public Core::System_control
|
||||
|
||||
System_control_component objects [Core::Platform::MAX_SUPPORTED_CPUS] { };
|
||||
|
||||
template <typename T>
|
||||
auto with_location(auto const &location, T const &fn)
|
||||
auto with_location(auto const &location, auto const &fn)
|
||||
{
|
||||
unsigned const index = platform_specific().pager_index(location);
|
||||
|
||||
@ -138,8 +136,7 @@ class System_control_impl : public Core::System_control
|
||||
return Capability<Pd_session::System_control> { };
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
auto with_location(auto const &location, T const &fn) const
|
||||
auto with_location(auto const &location, auto const &fn) const
|
||||
{
|
||||
unsigned const index = platform_specific().pager_index(location);
|
||||
|
||||
|
@ -66,13 +66,12 @@ static Nova::uint8_t kernel_quota_upgrade(addr_t const pd_target)
|
||||
}
|
||||
|
||||
|
||||
template <typename FUNC>
|
||||
static uint8_t _with_kernel_quota_upgrade(addr_t const pd_target,
|
||||
FUNC const &func)
|
||||
auto const &fn)
|
||||
{
|
||||
uint8_t res;
|
||||
do {
|
||||
res = func();
|
||||
res = fn();
|
||||
} while (res == Nova::NOVA_PD_OOM &&
|
||||
Nova::NOVA_OK == kernel_quota_upgrade(pd_target));
|
||||
return res;
|
||||
|
@ -638,8 +638,7 @@ void Nova_vcpu::with_state(Call_with_state &cw)
|
||||
}
|
||||
|
||||
|
||||
template <typename... ARGS>
|
||||
static void nova_reply(Thread &myself, Nova::Utcb &utcb, ARGS &&... args)
|
||||
static void nova_reply(Thread &myself, Nova::Utcb &utcb, auto &&... args)
|
||||
{
|
||||
Receive_window &rcv_window = myself.native_thread().server_rcv_window;
|
||||
|
||||
@ -649,6 +648,7 @@ static void nova_reply(Thread &myself, Nova::Utcb &utcb, ARGS &&... args)
|
||||
Nova::reply(myself.stack_top(), args...);
|
||||
}
|
||||
|
||||
|
||||
void Nova_vcpu::_exit_entry(addr_t badge)
|
||||
{
|
||||
Thread &myself = *Thread::myself();
|
||||
|
@ -636,8 +636,7 @@ class Greedy : public Genode::Thread {
|
||||
};
|
||||
|
||||
|
||||
template <typename... ARGS>
|
||||
void check(uint8_t res, ARGS &&... args)
|
||||
void check(uint8_t res, auto &&... args)
|
||||
{
|
||||
String<128> msg(args...);
|
||||
|
||||
@ -649,6 +648,7 @@ void check(uint8_t res, ARGS &&... args)
|
||||
log("res=", res, " ", msg);
|
||||
}
|
||||
|
||||
|
||||
struct Main
|
||||
{
|
||||
Genode::Env &env;
|
||||
@ -657,6 +657,7 @@ struct Main
|
||||
Main(Env &env);
|
||||
};
|
||||
|
||||
|
||||
Main::Main(Env &env) : env(env)
|
||||
{
|
||||
log("testing base-nova platform");
|
||||
|
@ -72,7 +72,7 @@ class Core::Initial_untyped_pool
|
||||
/**
|
||||
* Calculate free index after allocation
|
||||
*/
|
||||
addr_t _align_offset(Range &range, unsigned size_log2)
|
||||
addr_t _align_offset(Range const &range, unsigned size_log2)
|
||||
{
|
||||
/*
|
||||
* The seL4 kernel naturally aligns allocations within untuped
|
||||
@ -90,13 +90,12 @@ class Core::Initial_untyped_pool
|
||||
*
|
||||
* The functor is called with 'Range &' as argument.
|
||||
*/
|
||||
template <typename FUNC>
|
||||
void for_each_range(FUNC const &func)
|
||||
void for_each_range(auto const &fn)
|
||||
{
|
||||
seL4_BootInfo const &bi = sel4_boot_info();
|
||||
for (addr_t sel = bi.untyped.start; sel < bi.untyped.end; sel++) {
|
||||
Range range(*this, (unsigned)sel);
|
||||
func(range);
|
||||
fn(range);
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +123,7 @@ class Core::Initial_untyped_pool
|
||||
* Go through the known initial untyped memory ranges to find
|
||||
* a range that is able to host a kernel object of 'size'.
|
||||
*/
|
||||
for_each_range([&] (Range &range) {
|
||||
for_each_range([&] (Range const &range) {
|
||||
/* ignore device memory */
|
||||
if (range.device)
|
||||
return;
|
||||
@ -176,13 +175,12 @@ class Core::Initial_untyped_pool
|
||||
* Convert (remainder) of the initial untyped memory into untyped
|
||||
* objects of size_log2 and up to a maximum as specified by max_memory
|
||||
*/
|
||||
template <typename FUNC>
|
||||
void turn_into_untyped_object(addr_t const node_index,
|
||||
FUNC const & func,
|
||||
auto const &fn,
|
||||
size_t const size_log2 = get_page_size_log2(),
|
||||
addr_t max_memory = 0UL - 0x1000UL)
|
||||
{
|
||||
for_each_range([&] (Range &range) {
|
||||
for_each_range([&] (Range const &range) {
|
||||
|
||||
/*
|
||||
* The kernel limits the maximum number of kernel objects to
|
||||
@ -226,7 +224,7 @@ class Core::Initial_untyped_pool
|
||||
}
|
||||
|
||||
/* invoke callback about the range */
|
||||
bool const used = func(phys_addr, num_pages << size_log2,
|
||||
bool const used = fn(phys_addr, num_pages << size_log2,
|
||||
range.device);
|
||||
|
||||
if (!used)
|
||||
|
@ -186,8 +186,8 @@ class Core::Page_table_registry
|
||||
}
|
||||
}
|
||||
|
||||
template <typename FN, typename T>
|
||||
void _flush_high(FN const &fn, Avl_tree<T> &tree, Allocator &alloc)
|
||||
template <typename T>
|
||||
void _flush_high(auto const &fn, Avl_tree<T> &tree, Allocator &alloc)
|
||||
{
|
||||
for (T *element; (element = tree.first());) {
|
||||
|
||||
@ -248,8 +248,7 @@ class Core::Page_table_registry
|
||||
* The functor is called with the selector of the page table entry
|
||||
* (the copy of the phys frame selector) as argument.
|
||||
*/
|
||||
template <typename FN>
|
||||
void flush_page(addr_t vaddr, FN const &fn)
|
||||
void flush_page(addr_t vaddr, auto const &fn)
|
||||
{
|
||||
Frame * frame = Frame::lookup(_frames, vaddr, LEVEL_0);
|
||||
if (!frame)
|
||||
@ -260,8 +259,7 @@ class Core::Page_table_registry
|
||||
destroy(_alloc_frames, frame);
|
||||
}
|
||||
|
||||
template <typename FN>
|
||||
void flush_pages(FN const &fn)
|
||||
void flush_pages(auto const &fn)
|
||||
{
|
||||
Avl_tree<Frame> tmp;
|
||||
|
||||
@ -282,8 +280,7 @@ class Core::Page_table_registry
|
||||
}
|
||||
}
|
||||
|
||||
template <typename PG, typename LV>
|
||||
void flush_all(PG const &pages, LV const &level)
|
||||
void flush_all(auto const &pages, auto const &level)
|
||||
{
|
||||
flush_pages(pages);
|
||||
_flush_high(level, _level1, _alloc_high);
|
||||
|
@ -169,8 +169,7 @@ class Core::Vm_space
|
||||
return Cap_sel((uint32_t)((_id << 20) | idx));
|
||||
}
|
||||
|
||||
template <typename FN>
|
||||
void _flush(bool const flush_support, FN const &fn)
|
||||
void _flush(bool const flush_support, auto const &fn)
|
||||
{
|
||||
if (!flush_support) {
|
||||
warning("mapping cache full, but can't flush");
|
||||
@ -183,9 +182,8 @@ class Core::Vm_space
|
||||
_page_table_registry.flush_pages(fn);
|
||||
}
|
||||
|
||||
template <typename FN>
|
||||
bool _map_frame(addr_t const from_phys, addr_t const to_dest,
|
||||
Map_attr const attr, bool guest, FN const &fn)
|
||||
Map_attr const attr, bool guest, auto const &fn)
|
||||
{
|
||||
if (_page_table_registry.page_frame_at(to_dest)) {
|
||||
/*
|
||||
|
@ -147,8 +147,7 @@ class Genode::Capability_space_sel4
|
||||
*/
|
||||
struct Tree_managed_data : Data, Avl_node<Tree_managed_data>
|
||||
{
|
||||
template <typename... ARGS>
|
||||
Tree_managed_data(ARGS... args) : Data(args...) { }
|
||||
Tree_managed_data(auto &&... args) : Data(args...) { }
|
||||
|
||||
Tree_managed_data() { }
|
||||
|
||||
@ -210,8 +209,7 @@ class Genode::Capability_space_sel4
|
||||
* The arguments following the selector are passed to the constructor
|
||||
* of the 'Native_capability::Data' type.
|
||||
*/
|
||||
template <typename... ARGS>
|
||||
Native_capability::Data &create_capability(Cap_sel cap_sel, ARGS... args)
|
||||
Native_capability::Data &create_capability(Cap_sel cap_sel, auto &&... args)
|
||||
{
|
||||
addr_t const sel = cap_sel.value();
|
||||
|
||||
|
@ -384,10 +384,9 @@ class Genode::Allocator_avl_tpl : public Allocator_avl_base
|
||||
/**
|
||||
* Construct meta-data object in place
|
||||
*
|
||||
* \param ARGS arguments passed to the meta-data constuctor
|
||||
* \param args arguments passed to the meta-data constuctor
|
||||
*/
|
||||
template <typename... ARGS>
|
||||
void construct_metadata(void *addr, ARGS &&... args)
|
||||
void construct_metadata(void *addr, auto &&... args)
|
||||
{
|
||||
Block * const b = static_cast<Block *>(_find_by_address((addr_t)addr));
|
||||
if (b) construct_at<BMDT>(static_cast<BMDT *>(b), args...);
|
||||
|
@ -28,7 +28,6 @@ namespace Genode {
|
||||
class Thread;
|
||||
class Stack;
|
||||
class Env;
|
||||
template <unsigned> class Thread_deprecated;
|
||||
}
|
||||
|
||||
|
||||
@ -169,11 +168,6 @@ class Genode::Thread
|
||||
*
|
||||
* \noapi
|
||||
*
|
||||
* FIXME: With type = Forked_main_thread the stack allocation
|
||||
* gets skipped but we should at least set Stack::ds_cap in a
|
||||
* way that it references the dataspace of the already attached
|
||||
* stack.
|
||||
*
|
||||
* \deprecated superseded by the 'Thread(Env &...' constructor
|
||||
*/
|
||||
Thread(size_t weight, const char *name, size_t stack_size,
|
||||
|
@ -90,7 +90,7 @@ class Genode::Final_table
|
||||
|
||||
void operator () (addr_t const vo, addr_t const pa,
|
||||
size_t const size,
|
||||
DESCRIPTOR::access_t &desc)
|
||||
DESCRIPTOR::access_t &desc) const
|
||||
{
|
||||
if ((vo & ~PAGE_MASK) || (pa & ~PAGE_MASK) ||
|
||||
size < PAGE_SIZE)
|
||||
@ -119,7 +119,7 @@ class Genode::Final_table
|
||||
Remove_func(bool flush) : flush(flush) { }
|
||||
|
||||
void operator () (addr_t /* vo */, addr_t /* pa */, size_t /* size */,
|
||||
DESCRIPTOR::access_t &desc)
|
||||
DESCRIPTOR::access_t &desc) const
|
||||
{
|
||||
desc = 0;
|
||||
|
||||
@ -128,15 +128,14 @@ class Genode::Final_table
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FUNC>
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, FUNC &&func)
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, auto const &fn)
|
||||
{
|
||||
for (size_t i = vo >> PAGE_SIZE_LOG2; size > 0;
|
||||
i = vo >> PAGE_SIZE_LOG2) {
|
||||
addr_t end = (vo + PAGE_SIZE) & PAGE_MASK;
|
||||
size_t sz = Genode::min(size, end-vo);
|
||||
|
||||
func(vo, pa, sz, _entries[i]);
|
||||
fn(vo, pa, sz, _entries[i]);
|
||||
|
||||
/* check whether we wrap */
|
||||
if (end < vo) return;
|
||||
@ -173,8 +172,7 @@ class Genode::Final_table
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename FN>
|
||||
void for_each_entry(FN && fn)
|
||||
void for_each_entry(auto const &fn)
|
||||
{
|
||||
for (unsigned long i = 0; i < MAX_ENTRIES; i++) {
|
||||
if (Descriptor::present(_entries[i]))
|
||||
@ -257,7 +255,7 @@ class Genode::Page_directory
|
||||
|
||||
void operator () (addr_t const vo, addr_t const pa,
|
||||
size_t const size,
|
||||
typename Descriptor::access_t &desc)
|
||||
typename Descriptor::access_t &desc) const
|
||||
{
|
||||
using Td = Descriptor::Table;
|
||||
using access_t = typename Descriptor::access_t;
|
||||
@ -316,7 +314,7 @@ class Genode::Page_directory
|
||||
|
||||
void operator () (addr_t const vo, addr_t /* pa */,
|
||||
size_t const size,
|
||||
typename Descriptor::access_t &desc)
|
||||
typename Descriptor::access_t &desc) const
|
||||
{
|
||||
if (Descriptor::present(desc)) {
|
||||
if (Descriptor::maps_page(desc)) {
|
||||
@ -348,8 +346,7 @@ class Genode::Page_directory
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FUNC>
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, FUNC &&func)
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, auto const &fn)
|
||||
{
|
||||
for (size_t i = vo >> PAGE_SIZE_LOG2; size > 0;
|
||||
i = vo >> PAGE_SIZE_LOG2)
|
||||
@ -357,7 +354,7 @@ class Genode::Page_directory
|
||||
addr_t end = (vo + PAGE_SIZE) & PAGE_MASK;
|
||||
size_t sz = Genode::min(size, end-vo);
|
||||
|
||||
func(vo, pa, sz, _entries[i]);
|
||||
fn(vo, pa, sz, _entries[i]);
|
||||
|
||||
/* check whether we wrap */
|
||||
if (end < vo) return;
|
||||
@ -392,8 +389,7 @@ class Genode::Page_directory
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename FN>
|
||||
void for_each_entry(FN && fn)
|
||||
void for_each_entry(auto const &fn)
|
||||
{
|
||||
for (unsigned long i = 0; i < MAX_ENTRIES; i++)
|
||||
if (Descriptor::present(_entries[i]))
|
||||
@ -417,9 +413,11 @@ class Genode::Page_directory
|
||||
void insert_translation(addr_t vo, addr_t pa, size_t size,
|
||||
Page_flags const & flags, ALLOCATOR & alloc,
|
||||
bool flush = false,
|
||||
uint32_t supported_sizes = (1U << 30 | 1U << 21 | 1U << 12)) {
|
||||
uint32_t supported_sizes = (1U << 30 | 1U << 21 | 1U << 12))
|
||||
{
|
||||
_range_op(vo, pa, size,
|
||||
Insert_func(flags, alloc, flush, supported_sizes)); }
|
||||
Insert_func(flags, alloc, flush, supported_sizes));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove translations that overlap with a given virtual region
|
||||
@ -472,7 +470,7 @@ class Genode::Pml4_table
|
||||
|
||||
void operator () (addr_t const vo, addr_t const pa,
|
||||
size_t const size,
|
||||
Descriptor::access_t &desc)
|
||||
Descriptor::access_t &desc) const
|
||||
{
|
||||
/* we need to use a next level table */
|
||||
if (!Descriptor::present(desc)) {
|
||||
@ -510,7 +508,7 @@ class Genode::Pml4_table
|
||||
|
||||
void operator () (addr_t const vo, addr_t /* pa */,
|
||||
size_t const size,
|
||||
Descriptor::access_t &desc)
|
||||
Descriptor::access_t &desc) const
|
||||
{
|
||||
if (Descriptor::present(desc)) {
|
||||
/* use allocator to retrieve virt address of table */
|
||||
@ -535,15 +533,14 @@ class Genode::Pml4_table
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FUNC>
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, FUNC &&func)
|
||||
void _range_op(addr_t vo, addr_t pa, size_t size, auto const &fn)
|
||||
{
|
||||
for (size_t i = (vo & SIZE_MASK) >> PAGE_SIZE_LOG2; size > 0;
|
||||
i = (vo & SIZE_MASK) >> PAGE_SIZE_LOG2) {
|
||||
addr_t end = (vo + PAGE_SIZE) & PAGE_MASK;
|
||||
size_t sz = Genode::min(size, end-vo);
|
||||
|
||||
func(vo, pa, sz, _entries[i]);
|
||||
fn(vo, pa, sz, _entries[i]);
|
||||
|
||||
/* check whether we wrap */
|
||||
if (end < vo) return;
|
||||
@ -596,8 +593,7 @@ class Genode::Pml4_table
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename FN>
|
||||
void for_each_entry(FN && fn)
|
||||
void for_each_entry(auto const &fn)
|
||||
{
|
||||
for (unsigned long i = 0; i < MAX_ENTRIES; i++) {
|
||||
if (Descriptor::present(_entries[i]))
|
||||
|
@ -51,12 +51,10 @@ class Core::Synced_range_allocator : public Range_allocator
|
||||
|
||||
using Guard = typename Synced_interface<ALLOC, Mutex>::Guard;
|
||||
|
||||
template <typename... ARGS>
|
||||
Synced_range_allocator(Mutex &mutex, ARGS &&... args)
|
||||
Synced_range_allocator(Mutex &mutex, auto &&... args)
|
||||
: _mutex(mutex), _alloc(args...), _synced_object(_mutex, &_alloc) { }
|
||||
|
||||
template <typename... ARGS>
|
||||
Synced_range_allocator(ARGS &&... args)
|
||||
Synced_range_allocator(auto &&... args)
|
||||
: _alloc(args...), _synced_object(_mutex, &_alloc) { }
|
||||
|
||||
Guard operator () () { return _synced_object(); }
|
||||
|
@ -90,8 +90,7 @@ class Genode::Capability_space_tpl
|
||||
*/
|
||||
struct Tree_managed_data : Data, Avl_node<Tree_managed_data>
|
||||
{
|
||||
template <typename... ARGS>
|
||||
Tree_managed_data(ARGS... args) : Data(args...) { }
|
||||
Tree_managed_data(auto... args) : Data(args...) { }
|
||||
|
||||
Tree_managed_data() { }
|
||||
|
||||
@ -143,8 +142,7 @@ class Genode::Capability_space_tpl
|
||||
* The arguments are passed to the constructor of the
|
||||
* 'Native_capability::Data' type.
|
||||
*/
|
||||
template <typename... ARGS>
|
||||
Native_capability::Data &create_capability(ARGS... args)
|
||||
Native_capability::Data &create_capability(auto... args)
|
||||
{
|
||||
Mutex::Guard guard(_mutex);
|
||||
|
||||
|
@ -32,8 +32,7 @@ static inline char ascii(int digit, int uppercase = 0)
|
||||
/**
|
||||
* Output signed value with the specified base
|
||||
*/
|
||||
template <typename T, typename OUT_CHAR_FN>
|
||||
static inline void out_signed(T value, unsigned base, OUT_CHAR_FN const &out_char)
|
||||
static inline void out_signed(auto value, unsigned base, auto const &out_char_fn)
|
||||
{
|
||||
/**
|
||||
* for base 8, the number of digits is the number of value bytes times 3
|
||||
@ -61,20 +60,19 @@ static inline void out_signed(T value, unsigned base, OUT_CHAR_FN const &out_cha
|
||||
|
||||
/* add sign to buffer for negative values */
|
||||
if (neg)
|
||||
out_char('-');
|
||||
out_char_fn('-');
|
||||
|
||||
/* output buffer in reverse order */
|
||||
for (; i--; )
|
||||
out_char(buf[i]);
|
||||
out_char_fn(buf[i]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output unsigned value with the specified base and padding
|
||||
*/
|
||||
template <typename T, typename OUT_CHAR_FN>
|
||||
static inline void out_unsigned(T value, unsigned base, int pad,
|
||||
OUT_CHAR_FN const &out_char)
|
||||
static inline void out_unsigned(auto value, unsigned base, int pad,
|
||||
auto const &out_char_fn)
|
||||
{
|
||||
/**
|
||||
* for base 8, the number of digits is the number of value bytes times 3
|
||||
@ -97,19 +95,19 @@ static inline void out_unsigned(T value, unsigned base, int pad,
|
||||
|
||||
/* add padding zeros */
|
||||
for (; pad-- > 0; )
|
||||
out_char(ascii(0));
|
||||
out_char_fn(ascii(0));
|
||||
|
||||
/* output buffer in reverse order */
|
||||
for (; i--; )
|
||||
out_char(buf[i]);
|
||||
out_char_fn(buf[i]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output floating point value
|
||||
*/
|
||||
template <typename T, typename OUT_CHAR_FN>
|
||||
static inline void out_float(T value, unsigned base, unsigned length, OUT_CHAR_FN const &out_char)
|
||||
template <typename T>
|
||||
static inline void out_float(T value, unsigned base, unsigned length, auto const &out_char_fn)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
@ -136,10 +134,10 @@ static inline void out_float(T value, unsigned base, unsigned length, OUT_CHAR_F
|
||||
uint64_t integer = (uint64_t)volatile_value;
|
||||
|
||||
if (neg)
|
||||
out_char('-');
|
||||
out_char_fn('-');
|
||||
|
||||
out_unsigned(integer, base, 0, out_char);
|
||||
out_char('.');
|
||||
out_unsigned(integer, base, 0, out_char_fn);
|
||||
out_char_fn('.');
|
||||
|
||||
if (length) {
|
||||
do {
|
||||
@ -147,7 +145,7 @@ static inline void out_float(T value, unsigned base, unsigned length, OUT_CHAR_F
|
||||
volatile_value = (T)(volatile_value * (T)base);
|
||||
|
||||
integer = (uint64_t)volatile_value;
|
||||
out_char(ascii((int)integer));
|
||||
out_char_fn(ascii((int)integer));
|
||||
|
||||
length--;
|
||||
} while (length && (volatile_value > 0.0));
|
||||
|
@ -54,8 +54,8 @@ struct Unmanaged_singleton_constructor
|
||||
/**
|
||||
* Call the constructor of 'T' with arguments 'args' at 'dst'
|
||||
*/
|
||||
template <typename T, typename... ARGS>
|
||||
static void call(char * const dst, ARGS &&... args) { new (dst) T(args...); }
|
||||
template <typename T>
|
||||
static void call(char * const dst, auto &&... args) { new (dst) T(args...); }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -67,8 +67,8 @@ struct Unmanaged_singleton_constructor
|
||||
*
|
||||
* \return object pointer
|
||||
*/
|
||||
template <typename T, int ALIGNMENT = sizeof(Genode::addr_t), typename... ARGS>
|
||||
static inline T * unmanaged_singleton(ARGS &&... args)
|
||||
template <typename T, int ALIGNMENT = sizeof(Genode::addr_t)>
|
||||
static inline T * unmanaged_singleton(auto &&... args)
|
||||
{
|
||||
/*
|
||||
* Each instantiation of the function template with a different type 'T'
|
||||
|
@ -171,8 +171,7 @@ void Allocator_avl_base::_cut_from_block(Block &b, addr_t addr, size_t size, Two
|
||||
}
|
||||
|
||||
|
||||
template <typename FN>
|
||||
bool Allocator_avl_base::_revert_block_ranges(FN const &any_block_fn)
|
||||
bool Allocator_avl_base::_revert_block_ranges(auto const &any_block_fn)
|
||||
{
|
||||
size_t blocks = 0;
|
||||
for (bool loop = true; loop; blocks++) {
|
||||
@ -309,10 +308,9 @@ Allocator_avl_base::Range_result Allocator_avl_base::remove_range(addr_t base, s
|
||||
}
|
||||
|
||||
|
||||
template <typename SEARCH_FN>
|
||||
Allocator::Alloc_result
|
||||
Allocator_avl_base::_allocate(size_t const size, unsigned align, Range range,
|
||||
SEARCH_FN const &search_fn)
|
||||
auto const &search_fn)
|
||||
{
|
||||
return _alloc_two_blocks_metadata().convert<Alloc_result>(
|
||||
|
||||
|
@ -72,8 +72,7 @@ namespace {
|
||||
/**
|
||||
* Call functor 'fn' with root capability for a given service name
|
||||
*/
|
||||
template <typename FUNC>
|
||||
void apply(Service::Name const &name, FUNC const &fn)
|
||||
void apply(Service::Name const &name, auto const &fn)
|
||||
{
|
||||
/*
|
||||
* Protect '_services' but execute 'fn' with the mutex released.
|
||||
|
@ -65,8 +65,7 @@ class Linker::Config : Noncopyable
|
||||
*
|
||||
* The functor 'fn' is called with 'Rom_name', 'Keep' as arguments.
|
||||
*/
|
||||
template <typename FN>
|
||||
void for_each_library(FN const &fn) const
|
||||
void for_each_library(auto const &fn) const
|
||||
{
|
||||
_config.with_optional_sub_node("ld", [&] (Xml_node ld) {
|
||||
|
||||
|
@ -307,8 +307,7 @@ class Linker::Dynamic
|
||||
/**
|
||||
* Call functor for each dependency, passing the path as argument
|
||||
*/
|
||||
template <typename FUNC>
|
||||
void for_each_dependency(FUNC const &fn) const
|
||||
void for_each_dependency(auto const &fn) const
|
||||
{
|
||||
_needed.for_each([&] (Needed &n) {
|
||||
fn(n.path(_strtab)); });
|
||||
|
@ -74,8 +74,7 @@ struct Linker::File
|
||||
|
||||
unsigned elf_phdr_count() const { return phdr.count; }
|
||||
|
||||
template <typename FN>
|
||||
void with_rw_phdr(FN const &fn) const
|
||||
void with_rw_phdr(auto const &fn) const
|
||||
{
|
||||
for (unsigned i = 0; i < phdr.count; i++) {
|
||||
if (is_rw(phdr.phdr[i])) {
|
||||
|
@ -197,18 +197,16 @@ class Linker::Object : private Fifo<Object>::Element,
|
||||
_fifo.remove(obj);
|
||||
}
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each(FUNC const &func)
|
||||
void for_each(auto const &fn)
|
||||
{
|
||||
Mutex::Guard guard(_mutex);
|
||||
_fifo.for_each(func);
|
||||
_fifo.for_each(fn);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FUNC>
|
||||
static void with_object_list(FUNC const func)
|
||||
static void with_object_list(auto const &fn)
|
||||
{
|
||||
func(_object_list());
|
||||
fn(_object_list());
|
||||
}
|
||||
|
||||
virtual ~Object() { }
|
||||
@ -267,11 +265,10 @@ namespace Linker {
|
||||
/**
|
||||
* Apply func to each object
|
||||
*/
|
||||
template <typename FUNC>
|
||||
void for_each_object(FUNC const &func)
|
||||
void for_each_object(auto const &fn)
|
||||
{
|
||||
Object::with_object_list([&] (Object::Object_list &list) {
|
||||
list.for_each(func); });
|
||||
list.for_each(fn); });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,8 +106,7 @@ class Linker::Reloc_non_plt_generic
|
||||
* safely here since all other DSO are loaded, relocated, and constructed at
|
||||
* this point
|
||||
*/
|
||||
template <typename REL>
|
||||
void _copy(REL const *rel, Elf::Addr *addr)
|
||||
void _copy(auto const *rel, Elf::Addr *addr)
|
||||
{
|
||||
if (!_dep.obj().is_binary()) {
|
||||
error("LD: copy relocation in DSO "
|
||||
|
Loading…
Reference in New Issue
Block a user