From eba9c15746df281d65e3ac82671e49aa216f8357 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 21 Dec 2017 15:42:15 +0100 Subject: [PATCH] Follow practices suggested by "Effective C++" The patch adjust the code of the base, base-, and os repository. To adapt existing components to fix violations of the best practices suggested by "Effective C++" as reported by the -Weffc++ compiler argument. The changes follow the patterns outlined below: * A class with virtual functions can no longer publicly inherit base classed without a vtable. The inherited object may either be moved to a member variable, or inherited privately. The latter would be used for classes that inherit 'List::Element' or 'Avl_node'. In order to enable the 'List' and 'Avl_tree' to access the meta data, the 'List' must become a friend. * Instead of adding a virtual destructor to abstract base classes, we inherit the new 'Interface' class, which contains a virtual destructor. This way, single-line abstract base classes can stay as compact as they are now. The 'Interface' utility resides in base/include/util/interface.h. * With the new warnings enabled, all member variables must be explicitly initialized. Basic types may be initialized with '='. All other types are initialized with braces '{ ... }' or as class initializers. If basic types and non-basic types appear in a row, it is nice to only use the brace syntax (also for basic types) and align the braces. * If a class contains pointers as members, it must now also provide a copy constructor and assignment operator. In the most cases, one would make them private, effectively disallowing the objects to be copied. Unfortunately, this warning cannot be fixed be inheriting our existing 'Noncopyable' class (the compiler fails to detect that the inheriting class cannot be copied and still gives the error). For now, we have to manually add declarations for both the copy constructor and assignment operator as private class members. Those declarations should be prepended with a comment like this: /* * Noncopyable */ Thread(Thread const &); Thread &operator = (Thread const &); In the future, we should revisit these places and try to replace the pointers with references. In the presence of at least one reference member, the compiler would no longer implicitly generate a copy constructor. So we could remove the manual declaration. Issue #465 --- .../base-fiasco/src/core/include/ipc_pager.h | 12 +- .../base-fiasco/src/core/include/map_local.h | 2 +- repos/base-fiasco/src/core/include/platform.h | 32 +++-- .../src/core/include/platform_pd.h | 16 ++- .../src/core/include/platform_thread.h | 14 ++- .../src/core/include/rpc_cap_factory.h | 2 +- repos/base-fiasco/src/core/include/util.h | 2 +- .../src/core/io_mem_session_support.cc | 2 +- .../src/core/irq_session_component.cc | 2 +- repos/base-fiasco/src/core/pager_object.cc | 4 +- repos/base-fiasco/src/core/platform_pd.cc | 3 +- repos/base-fiasco/src/core/platform_thread.cc | 2 +- .../src/core/ram_dataspace_support.cc | 4 +- .../base-foc/include/foc/native_capability.h | 76 +++++------ repos/base-foc/include/foc/native_thread.h | 2 +- repos/base-foc/include/foc/receive_window.h | 15 +++ repos/base-foc/include/foc/thread_state.h | 2 +- .../base-foc/src/core/include/cap_id_alloc.h | 3 +- repos/base-foc/src/core/include/cap_index.h | 6 + .../src/core/include/cpu_session_irqs.h | 6 + repos/base-foc/src/core/include/ipc_pager.h | 18 +-- repos/base-foc/src/core/include/irq_object.h | 8 +- repos/base-foc/src/core/include/platform.h | 32 +++-- repos/base-foc/src/core/include/platform_pd.h | 10 +- .../src/core/include/platform_thread.h | 16 ++- .../src/core/include/rpc_cap_factory.h | 2 +- repos/base-foc/src/core/include/util.h | 2 +- .../src/core/io_mem_session_support.cc | 2 +- repos/base-foc/src/core/ipc_pager.cc | 6 +- .../src/core/irq_session_component.cc | 6 +- repos/base-foc/src/core/platform.cc | 2 +- .../src/core/ram_dataspace_support.cc | 4 +- .../src/include/base/internal/cap_alloc.h | 10 +- .../src/include/base/internal/cap_map.h | 4 +- .../include/base/internal/capability_data.h | 5 +- repos/base-foc/src/lib/base/ipc.cc | 16 +-- .../src/lib/base/signal_source_client.cc | 8 +- .../include/spec/riscv/cpu/cpu_state.h | 36 +++++- .../base-hw/include/spec/x86_64/muen/sinfo.h | 6 +- repos/base-hw/src/bootstrap/platform.h | 18 +-- .../src/bootstrap/spec/arm/cortex_a9_mmu.cc | 2 +- .../src/bootstrap/spec/imx53_qsb/platform.cc | 2 +- .../src/bootstrap/spec/panda/platform.cc | 3 +- .../src/bootstrap/spec/pbxa9/platform.cc | 3 +- .../base-hw/src/bootstrap/spec/riscv/board.h | 3 +- .../src/bootstrap/spec/riscv/platform.cc | 2 +- repos/base-hw/src/bootstrap/spec/rpi/board.h | 3 +- .../src/bootstrap/spec/zynq_qemu/platform.cc | 2 +- repos/base-hw/src/core/core_region_map.cc | 2 +- repos/base-hw/src/core/cpu_thread_allocator.h | 12 +- .../src/core/io_mem_session_support.cc | 5 +- .../base-hw/src/core/irq_session_component.h | 25 ++-- repos/base-hw/src/core/kernel/cpu.cc | 6 +- repos/base-hw/src/core/kernel/cpu.h | 41 +++++- repos/base-hw/src/core/kernel/cpu_context.h | 23 +++- repos/base-hw/src/core/kernel/cpu_scheduler.h | 14 +-- repos/base-hw/src/core/kernel/double_list.h | 4 +- repos/base-hw/src/core/kernel/ipc_node.h | 14 ++- repos/base-hw/src/core/kernel/irq.h | 5 +- repos/base-hw/src/core/kernel/kernel.cc | 2 +- repos/base-hw/src/core/kernel/object.h | 22 +++- repos/base-hw/src/core/kernel/pd.h | 12 +- .../base-hw/src/core/kernel/signal_receiver.h | 24 +++- repos/base-hw/src/core/kernel/thread.h | 10 +- repos/base-hw/src/core/kernel/timer.h | 11 +- repos/base-hw/src/core/kernel/vm.h | 8 +- repos/base-hw/src/core/native_pd_component.cc | 9 +- repos/base-hw/src/core/object.h | 2 +- repos/base-hw/src/core/pager.h | 20 +-- repos/base-hw/src/core/platform.cc | 2 +- repos/base-hw/src/core/platform.h | 10 +- repos/base-hw/src/core/platform_pd.cc | 2 +- repos/base-hw/src/core/platform_pd.h | 38 ++++-- repos/base-hw/src/core/platform_thread.h | 22 ++-- .../base-hw/src/core/ram_dataspace_support.cc | 4 +- repos/base-hw/src/core/rpc_cap_factory.h | 6 +- repos/base-hw/src/core/signal_broker.h | 6 +- .../src/core/signal_source_component.h | 17 ++- repos/base-hw/src/core/spec/arm/fpu.h | 21 +++- .../src/core/spec/arm/platform_support.cc | 5 +- .../core/spec/arm_v7/trustzone/kernel/vm.cc | 2 +- .../arm_v7/trustzone/vm_session_component.h | 21 ++-- .../spec/arm_v7/virtualization/kernel/vm.cc | 5 +- .../virtualization/vm_session_component.h | 15 ++- repos/base-hw/src/core/spec/cortex_a9/cpu.h | 2 +- repos/base-hw/src/core/spec/riscv/cpu.cc | 2 +- repos/base-hw/src/core/spec/riscv/cpu.h | 4 +- .../base-hw/src/core/spec/riscv/kernel/cpu.cc | 2 +- repos/base-hw/src/core/spec/riscv/pic.h | 4 +- .../src/core/spec/riscv/platform_support.cc | 6 +- .../src/core/spec/riscv/translation_table.h | 7 +- repos/base-hw/src/core/spec/rpi/pic.h | 2 +- repos/base-hw/src/core/spec/x86_64/cpu.h | 7 +- .../src/core/spec/x86_64/muen/kernel/vm.cc | 2 +- repos/base-hw/src/core/spec/x86_64/muen/pic.h | 4 +- .../spec/x86_64/muen/vm_session_component.h | 11 +- repos/base-hw/src/core/spec/x86_64/pic.h | 4 +- .../src/core/spec/x86_64/platform_support.cc | 3 +- repos/base-hw/src/core/util.h | 2 +- .../src/include/base/internal/lock_helper.h | 2 +- .../src/include/base/internal/native_utcb.h | 67 ++++++---- repos/base-hw/src/lib/base/ipc.cc | 2 +- repos/base-hw/src/lib/hw/boot_info.h | 2 +- .../base-hw/src/lib/hw/page_table_allocator.h | 4 +- repos/base-hw/src/lib/hw/spec/arm/lpae.h | 14 +-- .../base-hw/src/lib/hw/spec/arm/page_table.h | 2 +- .../src/lib/hw/spec/riscv/page_table.h | 12 +- .../src/lib/hw/spec/x86_64/page_table.h | 7 +- repos/base-hw/src/lib/muen/sinfo.cc | 24 ++-- repos/base-hw/src/test/cpu_quota/main.cc | 12 +- repos/base-hw/src/test/cpu_quota/sync/main.cc | 2 +- repos/base-hw/src/test/cpu_scheduler/test.cc | 2 +- repos/base-hw/src/test/double_list/test.cc | 6 +- .../src/core/include/core_region_map.h | 2 +- .../src/core/include/dataspace_component.h | 23 ++-- .../src/core/include/irq_session_component.h | 18 +-- repos/base-linux/src/core/include/pager.h | 7 +- repos/base-linux/src/core/include/platform.h | 4 +- .../src/core/include/platform_thread.h | 20 +-- .../src/core/include/region_map_component.h | 15 ++- .../src/core/include/rpc_cap_factory.h | 2 +- .../src/core/include/server_socket_pair.h | 3 +- .../src/core/io_mem_session_component.cc | 6 +- .../src/core/native_pd_component.cc | 5 +- repos/base-linux/src/core/platform.cc | 4 +- repos/base-linux/src/core/platform_thread.cc | 1 - .../src/core/ram_dataspace_support.cc | 2 +- .../src/core/rom_session_component.cc | 2 +- repos/base-linux/src/core/stack_area.cc | 8 +- .../src/include/base/internal/local_parent.h | 2 +- .../src/include/base/internal/lock_helper.h | 5 +- .../src/include/base/internal/native_thread.h | 2 +- .../include/base/internal/region_map_mmap.h | 4 +- .../include/base/internal/region_registry.h | 10 +- .../internal/socket_descriptor_registry.h | 2 +- .../base-linux/src/lib/base/child_process.cc | 2 +- repos/base-linux/src/lib/base/ipc.cc | 8 +- repos/base-linux/src/lib/base/thread_linux.cc | 2 +- .../base-linux/src/lib/lx_hybrid/lx_hybrid.cc | 40 +++--- .../src/test/lx_hybrid_pthread_ipc/main.cc | 2 + repos/base-nova/include/nova/cap_map.h | 16 +-- .../base-nova/include/nova/capability_space.h | 2 +- repos/base-nova/include/nova/native_thread.h | 14 +-- repos/base-nova/include/nova/receive_window.h | 2 +- .../base-nova/include/nova/syscall-generic.h | 3 +- repos/base-nova/src/core/core_region_map.cc | 4 +- repos/base-nova/src/core/include/ipc_pager.h | 2 +- repos/base-nova/src/core/include/irq_object.h | 12 +- repos/base-nova/src/core/include/nova_util.h | 2 +- repos/base-nova/src/core/include/pager.h | 16 ++- repos/base-nova/src/core/include/platform.h | 16 +-- .../base-nova/src/core/include/platform_pd.h | 8 +- .../src/core/include/platform_thread.h | 8 +- .../src/core/include/rpc_cap_factory.h | 4 +- .../src/core/include/signal_broker.h | 4 +- .../core/include/signal_source_component.h | 2 +- repos/base-nova/src/core/include/util.h | 4 +- .../src/core/io_mem_session_support.cc | 5 +- .../src/core/irq_session_component.cc | 6 +- .../base-nova/src/core/native_pd_component.cc | 5 +- repos/base-nova/src/core/pager.cc | 15 +-- repos/base-nova/src/core/platform.cc | 19 +-- repos/base-nova/src/core/platform_pd.cc | 5 +- repos/base-nova/src/core/platform_thread.cc | 4 +- .../src/core/ram_dataspace_support.cc | 2 +- .../src/include/base/internal/lock_helper.h | 2 +- .../src/include/base/internal/native_utcb.h | 4 + .../src/include/base/internal/spin_lock.h | 3 +- .../src/include/signal_source/client.h | 2 +- repos/base-nova/src/kernel/nova/target.mk | 1 + repos/base-nova/src/lib/base/sleep.cc | 3 +- repos/base-nova/src/test/platform/ipc.cc | 4 +- repos/base-nova/src/test/platform/main.cc | 4 +- repos/base-nova/src/test/platform/server.h | 2 +- repos/base-okl4/lib/mk/kernel-okl4.inc | 2 +- repos/base-okl4/src/core/core_log_out.cc | 5 +- repos/base-okl4/src/core/core_region_map.cc | 2 +- repos/base-okl4/src/core/include/ipc_pager.h | 25 ++-- repos/base-okl4/src/core/include/map_local.h | 8 +- repos/base-okl4/src/core/include/platform.h | 30 +++-- .../base-okl4/src/core/include/platform_pd.h | 18 ++- .../src/core/include/platform_thread.h | 6 + .../src/core/include/rpc_cap_factory.h | 2 +- repos/base-okl4/src/core/include/util.h | 13 +- .../src/core/io_mem_session_support.cc | 6 +- .../src/core/irq_session_component.cc | 12 +- repos/base-okl4/src/core/pager.cc | 13 +- repos/base-okl4/src/core/pager_object.cc | 7 +- repos/base-okl4/src/core/platform.cc | 11 +- repos/base-okl4/src/core/platform_pd.cc | 13 +- repos/base-okl4/src/core/platform_thread.cc | 12 +- .../src/core/ram_dataspace_support.cc | 10 +- .../src/core/spec/x86/platform_thread_x86.cc | 6 +- .../src/include/base/internal/lock_helper.h | 7 +- .../src/include/base/internal/native_thread.h | 6 +- .../src/include/base/internal/okl4.h | 35 ++++++ .../include/base/internal/raw_write_string.h | 4 +- .../include/base/internal/rpc_destination.h | 6 +- repos/base-okl4/src/lib/base/ipc.cc | 8 +- .../src/lib/base/thread_bootstrap.cc | 7 +- .../src/core/include/platform.h | 29 +++-- .../src/core/include/platform_pd.h | 20 +-- .../src/core/include/platform_thread.h | 30 +++-- .../src/core/include/rpc_cap_factory.h | 2 +- repos/base-pistachio/src/core/include/util.h | 8 +- .../src/core/io_mem_session_support.cc | 2 +- .../src/core/irq_session_component.cc | 2 +- repos/base-pistachio/src/core/pager.cc | 4 +- repos/base-pistachio/src/core/platform.cc | 2 +- repos/base-pistachio/src/core/platform_pd.cc | 13 +- repos/base-sel4/src/core/core_region_map.cc | 6 +- .../src/core/include/cap_sel_alloc.h | 2 +- repos/base-sel4/src/core/include/ipc_pager.h | 34 ++--- repos/base-sel4/src/core/include/irq_object.h | 2 +- .../src/core/include/page_table_registry.h | 18 +-- repos/base-sel4/src/core/include/pager.h | 12 +- repos/base-sel4/src/core/include/platform.h | 30 +++-- .../base-sel4/src/core/include/platform_pd.h | 6 +- .../src/core/include/platform_thread.h | 10 +- .../src/core/include/rpc_cap_factory.h | 2 +- repos/base-sel4/src/core/include/util.h | 4 +- repos/base-sel4/src/core/include/vm_space.h | 6 +- .../src/core/io_mem_session_support.cc | 6 +- .../src/core/irq_session_component.cc | 2 +- repos/base-sel4/src/core/pager.cc | 4 +- repos/base-sel4/src/core/platform.cc | 11 +- repos/base-sel4/src/core/platform_pd.cc | 6 +- repos/base-sel4/src/core/platform_thread.cc | 14 +-- .../base-sel4/src/core/spec/arm/fault_info.h | 2 +- repos/base-sel4/src/core/spec/arm/platform.cc | 2 +- repos/base-sel4/src/core/spec/arm/thread.cc | 2 +- .../base-sel4/src/core/spec/x86/fault_info.h | 2 +- repos/base-sel4/src/core/spec/x86/vm_space.cc | 2 +- repos/base-sel4/src/core/stack_area.cc | 6 +- .../base/internal/capability_space_sel4.h | 4 +- .../src/include/base/internal/lock_helper.h | 2 +- .../src/include/base/internal/native_utcb.h | 11 +- .../src/include/signal_source/client.h | 15 +-- .../src/include/signal_source/rpc_object.h | 2 +- .../src/lib/base/capability_space.cc | 2 +- repos/base-sel4/src/lib/base/ipc.cc | 7 +- .../src/lib/base/thread_bootstrap.cc | 4 +- repos/base/include/base/affinity.h | 4 +- repos/base/include/base/allocator.h | 3 +- repos/base/include/base/allocator_avl.h | 33 +++-- repos/base/include/base/allocator_guard.h | 6 + repos/base/include/base/attached_dataspace.h | 6 + .../include/base/attached_io_mem_dataspace.h | 6 + .../include/base/attached_ram_dataspace.h | 16 ++- .../include/base/attached_rom_dataspace.h | 2 +- repos/base/include/base/cancelable_lock.h | 9 +- repos/base/include/base/child.h | 28 ++--- repos/base/include/base/connection.h | 6 +- repos/base/include/base/entrypoint.h | 32 ++--- repos/base/include/base/env.h | 2 +- repos/base/include/base/heap.h | 54 +++++--- repos/base/include/base/id_space.h | 12 +- repos/base/include/base/ipc.h | 6 + repos/base/include/base/ipc_msgbuf.h | 10 +- repos/base/include/base/local_connection.h | 4 +- repos/base/include/base/log.h | 8 +- repos/base/include/base/object_pool.h | 11 +- repos/base/include/base/output.h | 3 +- repos/base/include/base/quota_guard.h | 2 +- repos/base/include/base/quota_transfer.h | 4 +- repos/base/include/base/ram_allocator.h | 2 +- repos/base/include/base/registry.h | 20 ++- repos/base/include/base/rpc.h | 2 +- repos/base/include/base/rpc_args.h | 3 +- repos/base/include/base/rpc_client.h | 35 +++++- repos/base/include/base/rpc_server.h | 28 ++--- repos/base/include/base/semaphore.h | 4 +- repos/base/include/base/service.h | 6 +- repos/base/include/base/session_object.h | 16 ++- repos/base/include/base/session_state.h | 21 ++-- repos/base/include/base/shared_object.h | 14 ++- repos/base/include/base/signal.h | 106 +++++++++------- repos/base/include/base/slab.h | 6 + repos/base/include/base/snprintf.h | 10 +- repos/base/include/base/synced_allocator.h | 2 +- repos/base/include/base/synced_interface.h | 5 + repos/base/include/base/thread.h | 10 +- repos/base/include/base/trace/logger.h | 25 ++-- repos/base/include/base/trace/types.h | 14 +-- repos/base/include/base/weak_ptr.h | 39 +++--- repos/base/include/cpu_session/cpu_session.h | 2 +- repos/base/include/cpu_thread/cpu_thread.h | 2 +- repos/base/include/dataspace/dataspace.h | 2 +- repos/base/include/deprecated/env.h | 2 +- repos/base/include/drivers/uart/x86_pc.h | 2 +- .../base/include/io_mem_session/connection.h | 2 +- repos/base/include/irq_session/connection.h | 2 +- repos/base/include/parent/parent.h | 4 +- repos/base/include/pd_session/pd_session.h | 2 +- repos/base/include/region_map/client.h | 2 +- repos/base/include/region_map/region_map.h | 2 +- repos/base/include/rom_session/connection.h | 2 +- repos/base/include/root/component.h | 8 +- repos/base/include/spec/arm/cpu/cpu_state.h | 17 +-- repos/base/include/trace_session/client.h | 38 +++--- repos/base/include/util/avl_tree.h | 2 +- repos/base/include/util/bit_allocator.h | 9 +- repos/base/include/util/flex_iterator.h | 14 +-- repos/base/include/util/interface.h | 22 ++++ repos/base/include/util/reconstructible.h | 2 +- repos/base/include/util/register_set.h | 3 +- repos/base/include/util/string.h | 46 ++++--- repos/base/include/util/xml_node.h | 26 ++-- repos/base/lib/symbols/ld | 20 +-- repos/base/src/core/core_mem_alloc.cc | 4 +- repos/base/src/core/core_region_map.cc | 5 +- repos/base/src/core/default_log.cc | 2 +- repos/base/src/core/include/account.h | 12 +- repos/base/src/core/include/address_space.h | 8 +- .../src/core/include/constrained_core_ram.h | 2 +- repos/base/src/core/include/core_mem_alloc.h | 25 ++-- repos/base/src/core/include/core_service.h | 7 +- repos/base/src/core/include/cpu_root.h | 6 + .../src/core/include/cpu_session_component.h | 45 ++++--- .../src/core/include/cpu_thread_component.h | 15 ++- .../src/core/include/dataspace_component.h | 52 ++++---- repos/base/src/core/include/io_mem_root.h | 6 + .../core/include/io_mem_session_component.h | 22 ++-- repos/base/src/core/include/io_port_root.h | 6 + .../core/include/io_port_session_component.h | 9 +- repos/base/src/core/include/irq_args.h | 10 +- repos/base/src/core/include/irq_object.h | 2 +- repos/base/src/core/include/irq_root.h | 6 + .../src/core/include/irq_session_component.h | 12 +- repos/base/src/core/include/pager.h | 10 +- repos/base/src/core/include/pd_root.h | 4 +- .../src/core/include/pd_session_component.h | 22 ++-- .../src/core/include/ram_dataspace_factory.h | 2 +- .../src/core/include/region_map_component.h | 71 ++++++++--- .../src/core/include/rm_session_component.h | 4 +- repos/base/src/core/include/rom_root.h | 6 + .../src/core/include/rom_session_component.h | 14 ++- .../src/core/include/signal_delivery_proxy.h | 8 +- .../core/include/signal_source_component.h | 37 ++++-- .../src/core/include/synced_ram_allocator.h | 2 +- .../src/core/include/synced_range_allocator.h | 2 +- .../src/core/include/trace/control_area.h | 6 + .../src/core/include/trace/policy_registry.h | 6 +- .../core/include/trace/session_component.h | 46 ++++--- .../src/core/include/trace/source_registry.h | 16 ++- .../src/core/include/trace/subject_registry.h | 33 ++--- repos/base/src/core/main.cc | 4 +- repos/base/src/core/pd_session_component.cc | 12 +- repos/base/src/core/ram_dataspace_factory.cc | 24 ++-- repos/base/src/core/region_map_component.cc | 14 +-- repos/base/src/core/rpc_cap_factory_l4.cc | 4 +- repos/base/src/core/stack_area.cc | 6 +- .../base/internal/attached_stack_area.h | 2 +- .../include/base/internal/capability_data.h | 4 +- .../base/internal/capability_space_tpl.h | 6 +- repos/base/src/include/base/internal/elf.h | 46 +++---- .../base/internal/expanding_parent_client.h | 11 +- .../src/include/base/internal/ipc_server.h | 2 +- repos/base/src/include/base/internal/stack.h | 4 +- .../include/base/internal/stack_allocator.h | 4 +- repos/base/src/lib/base/child_process.cc | 2 +- repos/base/src/lib/base/component.cc | 8 +- repos/base/src/lib/base/entrypoint.cc | 2 +- repos/base/src/lib/base/log_console.cc | 13 +- repos/base/src/lib/base/root_proxy.cc | 8 +- repos/base/src/lib/base/rpc_cap_alloc.cc | 2 +- repos/base/src/lib/base/signal.cc | 8 +- repos/base/src/lib/base/signal_common.cc | 5 +- repos/base/src/lib/base/sliced_heap.cc | 4 +- repos/base/src/lib/base/stack_allocator.cc | 2 +- repos/base/src/lib/base/trace.cc | 11 +- repos/base/src/lib/cxx/exception.cc | 5 +- repos/base/src/lib/cxx/misc.cc | 2 +- repos/base/src/lib/ldso/include/debug.h | 6 +- repos/base/src/lib/ldso/include/dynamic.h | 8 +- repos/base/src/lib/ldso/include/file.h | 14 +-- repos/base/src/lib/ldso/include/linker.h | 27 ++-- repos/base/src/lib/ldso/main.cc | 24 ++-- .../src/lib/ldso/spec/x86_32/relocation.h | 2 +- .../base/src/lib/ldso/startup/unwind_exidx.cc | 2 +- repos/base/src/test/fpu/main.cc | 2 +- repos/base/src/test/mp_server/main.cc | 2 +- repos/base/src/test/new_delete/main.cc | 10 +- repos/base/src/test/reconstructible/main.cc | 4 +- repos/base/src/test/rm_fault/main.cc | 8 +- repos/base/src/test/slab/main.cc | 8 ++ repos/base/src/test/synced_interface/main.cc | 6 +- repos/base/src/test/thread/main.cc | 41 +++--- repos/base/src/test/weak_ptr/main.cc | 6 +- repos/dde_linux/src/lib/usb/raw/raw.cc | 8 +- .../dde_linux/src/server/usb_terminal/main.cc | 10 +- repos/demo/include/launchpad/launchpad.h | 34 ++--- repos/demo/include/scout/element.h | 20 ++- repos/demo/include/scout/event.h | 8 +- repos/demo/include/scout/fader.h | 6 +- repos/demo/include/scout/graphics_backend.h | 2 + .../scout/nitpicker_graphics_backend.h | 11 +- repos/demo/include/scout/parent_element.h | 12 +- repos/demo/include/scout/platform.h | 6 + repos/demo/include/scout/texture_allocator.h | 2 +- repos/demo/include/scout/tick.h | 14 ++- repos/demo/include/scout/user_state.h | 10 +- repos/demo/include/scout/window.h | 42 ++++--- repos/demo/include/scout_gfx/icon_painter.h | 8 +- .../include/scout_gfx/sky_texture_painter.h | 4 + repos/demo/src/app/launchpad/child_entry.h | 12 +- repos/demo/src/app/launchpad/launch_entry.h | 2 +- .../demo/src/app/launchpad/launchpad_window.h | 32 +++-- repos/demo/src/app/launchpad/loadbar.h | 31 +++-- repos/demo/src/app/launchpad/section.h | 17 ++- repos/demo/src/app/launchpad/status_entry.h | 2 +- repos/demo/src/app/scout/browser.h | 21 ++-- repos/demo/src/app/scout/browser_window.cc | 31 +++-- repos/demo/src/app/scout/browser_window.h | 14 +-- repos/demo/src/app/scout/elements.cc | 11 +- repos/demo/src/app/scout/elements.h | 119 +++++++++++------- repos/demo/src/app/scout/fade_icon.h | 7 +- repos/demo/src/app/scout/history.h | 3 +- repos/demo/src/app/scout/launcher.cc | 2 +- repos/demo/src/app/scout/main.cc | 6 +- repos/demo/src/app/scout/navbar.cc | 15 ++- repos/demo/src/app/scout/png_image.cc | 12 +- repos/demo/src/app/scout/scrollbar.cc | 56 ++++----- repos/demo/src/app/scout/scrollbar.h | 24 ++-- repos/demo/src/app/scout/sky_texture.h | 2 +- repos/demo/src/app/scout/titlebar.h | 12 +- repos/demo/src/app/scout/widgets.cc | 1 - repos/demo/src/app/scout/widgets.h | 14 ++- repos/demo/src/lib/launchpad/launchpad.cc | 2 +- repos/demo/src/lib/libpng/main.cc | 5 +- .../liquid_framebuffer/framebuffer_window.h | 18 ++- .../src/server/liquid_framebuffer/main.cc | 2 +- .../src/server/liquid_framebuffer/services.cc | 21 +++- repos/demo/src/server/nitlog/main.cc | 36 +++--- repos/gems/include/gems/nitpicker_buffer.h | 32 ++--- repos/gems/src/app/backdrop/main.cc | 20 +-- repos/gems/src/app/menu_view/button_widget.h | 13 +- repos/gems/src/app/menu_view/main.cc | 8 +- .../gems/src/app/menu_view/scratch_surface.h | 12 +- repos/gems/src/app/themed_decorator/theme.cc | 12 +- repos/gems/src/app/themed_decorator/theme.h | 6 +- .../src/app/themed_decorator/tint_painter.h | 6 +- repos/gems/src/app/themed_decorator/window.h | 27 ++-- repos/libports/include/libc/component.h | 6 +- .../os/include/audio_in_session/connection.h | 2 +- .../audio_out_session/audio_out_session.h | 8 +- repos/os/include/audio_out_session/client.h | 8 +- .../os/include/audio_out_session/connection.h | 2 +- .../os/include/audio_out_session/rpc_object.h | 4 +- repos/os/include/block/component.h | 6 +- repos/os/include/block/driver.h | 44 ++++--- repos/os/include/block_session/connection.h | 5 +- repos/os/include/cli_monitor/child.h | 2 +- repos/os/include/cli_monitor/ram.h | 3 +- repos/os/include/file_system/listener.h | 2 +- repos/os/include/file_system/node.h | 2 +- repos/os/include/file_system/open_node.h | 2 +- .../include/file_system_session/connection.h | 10 +- repos/os/include/gpio/component.h | 2 +- repos/os/include/gpio/driver.h | 2 +- repos/os/include/gpu_session/connection.h | 4 +- repos/os/include/input/component.h | 7 +- repos/os/include/input/event_queue.h | 4 +- repos/os/include/input_session/connection.h | 2 +- repos/os/include/mixer/channel.h | 12 +- repos/os/include/net/arp.h | 9 +- repos/os/include/net/dhcp.h | 8 +- repos/os/include/net/ethernet.h | 15 +-- repos/os/include/net/ipv4.h | 9 +- repos/os/include/net/tcp.h | 5 +- repos/os/include/net/udp.h | 7 +- repos/os/include/nic/component.h | 2 +- repos/os/include/nic/stat.h | 8 +- repos/os/include/nic_session/connection.h | 8 +- repos/os/include/nitpicker_gfx/text_painter.h | 2 +- .../nitpicker_session/nitpicker_session.h | 5 +- repos/os/include/os/alarm.h | 26 ++-- .../os/include/os/child_policy_dynamic_rom.h | 10 +- repos/os/include/os/dynamic_rom_session.h | 8 +- repos/os/include/os/handle_registry.h | 2 +- repos/os/include/os/packet_allocator.h | 23 ++-- repos/os/include/os/packet_stream.h | 51 ++++++-- repos/os/include/os/pixel_rgba.h | 2 +- repos/os/include/os/reporter.h | 4 +- repos/os/include/os/ring_buffer.h | 16 +-- repos/os/include/os/session_requester.h | 2 +- repos/os/include/os/signal_rpc_dispatcher.h | 2 - repos/os/include/os/static_root.h | 2 +- repos/os/include/os/surface.h | 19 ++- repos/os/include/os/timed_semaphore.h | 33 ++--- .../packet_stream_rx/packet_stream_rx.h | 2 +- .../packet_stream_tx/packet_stream_tx.h | 2 +- repos/os/include/platform_device/device.h | 3 +- repos/os/include/ram_fs/chunk.h | 6 + repos/os/include/regulator/driver.h | 4 +- .../os/include/regulator_session/connection.h | 6 +- repos/os/include/report_rom/rom_module.h | 37 ++++-- repos/os/include/report_rom/rom_registry.h | 4 +- repos/os/include/report_rom/rom_service.h | 4 +- repos/os/include/report_session/connection.h | 4 +- .../spec/imx53/platform_session/client.h | 2 +- .../spec/rpi/platform/property_message.h | 2 +- .../x86/platform_device/platform_device.h | 4 +- repos/os/include/terminal_session/client.h | 2 +- repos/os/include/timer/timeout.h | 40 +++--- repos/os/include/timer_session/connection.h | 16 ++- repos/os/include/usb/types.h | 85 +++++++------ repos/os/include/usb/usb.h | 33 +++-- repos/os/include/usb_session/usb_session.h | 8 +- repos/os/include/vfs/dir_file_system.h | 21 +++- repos/os/include/vfs/directory_service.h | 10 +- repos/os/include/vfs/file_io_service.h | 31 ++--- repos/os/include/vfs/file_system.h | 40 +++--- repos/os/include/vfs/file_system_factory.h | 4 +- repos/os/include/vfs/single_file_system.h | 15 ++- repos/os/include/vfs/types.h | 1 + repos/os/include/vfs/vfs_handle.h | 32 +++-- repos/os/src/app/cli_monitor/child.h | 6 +- repos/os/src/app/cli_monitor/line_editor.h | 32 +++-- repos/os/src/app/cli_monitor/main.cc | 6 +- repos/os/src/app/cli_monitor/start_command.h | 2 +- repos/os/src/app/cli_monitor/status_command.h | 2 +- repos/os/src/app/dummy/main.cc | 14 +-- repos/os/src/app/global_keys_handler/main.cc | 12 +- repos/os/src/app/pointer/main.cc | 14 ++- repos/os/src/app/pointer/rom_registry.h | 8 +- repos/os/src/app/rom_logger/main.cc | 4 +- repos/os/src/app/rom_to_file/main.cc | 4 +- repos/os/src/app/sequence/main.cc | 4 +- repos/os/src/app/status_bar/main.cc | 9 +- repos/os/src/app/top/main.cc | 6 +- .../os/src/app/trace_subject_reporter/main.cc | 7 +- repos/os/src/app/usb_report_filter/main.cc | 8 +- repos/os/src/drivers/acpi/acpi.cc | 34 +++-- repos/os/src/drivers/acpi/memory.h | 2 +- repos/os/src/drivers/ahci/ahci.cc | 8 ++ repos/os/src/drivers/ahci/ahci.h | 15 ++- repos/os/src/drivers/ahci/ata_driver.h | 24 ++-- repos/os/src/drivers/ahci/atapi_driver.h | 2 +- repos/os/src/drivers/ahci/main.cc | 4 +- .../os/src/drivers/ahci/spec/x86/platform.cc | 12 +- repos/os/src/drivers/audio/spec/linux/main.cc | 4 +- .../drivers/framebuffer/boot/framebuffer.cc | 2 +- .../framebuffer/boot/include/framebuffer.h | 11 +- .../framebuffer/spec/exynos5/target.mk | 2 + .../src/drivers/framebuffer/spec/imx53/ipu.h | 113 +++++++++-------- .../drivers/framebuffer/spec/imx53/main.cc | 6 + .../drivers/framebuffer/spec/omap4/main.cc | 10 +- .../drivers/framebuffer/spec/omap4/target.mk | 1 + .../drivers/framebuffer/spec/pl11x/main.cc | 10 +- .../src/drivers/framebuffer/spec/rpi/main.cc | 6 +- .../drivers/framebuffer/spec/sdl/fb_sdl.cc | 6 + .../src/drivers/framebuffer/spec/sdl/input.h | 3 +- .../os/src/drivers/gpio/spec/exynos4/driver.h | 6 +- repos/os/src/drivers/gpio/spec/imx53/driver.h | 11 +- repos/os/src/drivers/gpio/spec/omap4/driver.h | 2 +- .../drivers/gpu/intel/context_descriptor.h | 2 +- repos/os/src/drivers/gpu/intel/ggtt.h | 13 +- repos/os/src/drivers/gpu/intel/main.cc | 55 +++++--- repos/os/src/drivers/gpu/intel/ppgtt.h | 24 ++-- .../src/drivers/gpu/intel/ppgtt_allocator.h | 8 +- repos/os/src/drivers/gpu/intel/utils.h | 28 ++++- repos/os/src/drivers/input/dummy/main.cc | 2 +- .../drivers/input/spec/imx53/irq_handler.h | 2 +- .../os/src/drivers/input/spec/ps2/led_state.h | 2 +- .../src/drivers/input/spec/ps2/pbxa9/pl050.h | 12 +- .../src/drivers/input/spec/ps2/ps2_keyboard.h | 38 +++--- .../drivers/input/spec/ps2/serial_interface.h | 23 ++-- .../os/src/drivers/input/spec/ps2/x86/i8042.h | 8 +- .../drivers/nic/spec/gem/buffer_descriptor.h | 11 +- repos/os/src/drivers/nic/spec/gem/phyio.h | 2 +- repos/os/src/drivers/nic/spec/linux/main.cc | 2 +- repos/os/src/drivers/nic/spec/pbxa9/lan9118.h | 8 +- .../src/drivers/platform/spec/arndale/cmu.h | 4 +- .../src/drivers/platform/spec/arndale/main.cc | 5 +- .../src/drivers/platform/spec/arndale/pmu.h | 6 +- .../src/drivers/platform/spec/imx53/main.cc | 4 +- .../src/drivers/platform/spec/odroid_x2/cmu.h | 9 +- .../drivers/platform/spec/odroid_x2/main.cc | 4 +- .../src/drivers/platform/spec/odroid_x2/pmu.h | 6 +- .../os/src/drivers/platform/spec/rpi/main.cc | 2 +- repos/os/src/drivers/platform/spec/x86/irq.cc | 6 +- repos/os/src/drivers/platform/spec/x86/irq.h | 21 ++-- .../src/drivers/platform/spec/x86/irq_proxy.h | 32 +++-- .../os/src/drivers/platform/spec/x86/main.cc | 10 +- .../platform/spec/x86/pci_config_access.h | 2 +- .../platform/spec/x86/pci_device_component.h | 29 +++-- .../platform/spec/x86/pci_device_config.h | 14 ++- .../platform/spec/x86/pci_session_component.h | 19 +-- repos/os/src/drivers/rtc/spec/x86/linux.cc | 2 +- repos/os/src/drivers/rtc/spec/x86/main.cc | 2 +- repos/os/src/drivers/sd_card/adma2.h | 18 ++- repos/os/src/drivers/sd_card/sd_card.h | 3 +- .../drivers/sd_card/spec/exynos5/driver.cc | 2 +- .../src/drivers/sd_card/spec/exynos5/driver.h | 10 +- .../os/src/drivers/sd_card/spec/imx/driver.h | 16 +-- .../src/drivers/sd_card/spec/imx6/driver.cc | 4 +- .../src/drivers/sd_card/spec/omap4/driver.h | 4 +- .../src/drivers/sd_card/spec/pbxa9/driver.h | 6 + repos/os/src/drivers/timer/epit/time_source.h | 2 +- repos/os/src/drivers/timer/hw/time_source.cc | 3 +- .../drivers/timer/include/session_component.h | 8 +- .../timer/include/signalled_time_source.h | 8 ++ .../timer/include/threaded_time_source.h | 12 +- .../src/drivers/timer/periodic/time_source.h | 2 +- repos/os/src/drivers/uart/kdb/uart_driver.h | 4 +- .../drivers/uart/spec/arndale/uart_driver.h | 6 +- .../src/drivers/uart/spec/panda/uart_driver.h | 6 +- .../src/drivers/uart/spec/pbxa9/uart_driver.h | 10 +- repos/os/src/drivers/uart/uart_component.h | 2 +- repos/os/src/drivers/uart/uart_driver_base.h | 2 +- repos/os/src/drivers/usb_block/main.cc | 40 +++--- repos/os/src/init/buffered_xml.h | 6 + repos/os/src/init/child.cc | 6 +- repos/os/src/init/child.h | 14 +-- repos/os/src/init/child_registry.h | 2 +- repos/os/src/init/main.cc | 8 +- repos/os/src/init/report.h | 2 +- repos/os/src/init/server.cc | 3 +- repos/os/src/init/server.h | 10 +- repos/os/src/init/service.h | 6 +- repos/os/src/init/state_reporter.h | 12 +- repos/os/src/lib/net/ipv4.cc | 2 +- repos/os/src/lib/net/mac_address.cc | 2 +- repos/os/src/lib/vfs/block_file_system.h | 34 +++-- repos/os/src/lib/vfs/file_system_factory.cc | 6 +- repos/os/src/lib/vfs/fs_file_system.h | 37 ++++-- repos/os/src/lib/vfs/inline_file_system.h | 14 ++- repos/os/src/lib/vfs/log_file_system.h | 7 +- repos/os/src/lib/vfs/null_file_system.h | 13 +- repos/os/src/lib/vfs/ram_file_system.h | 36 +++--- repos/os/src/lib/vfs/rom_file_system.h | 4 +- repos/os/src/lib/vfs/rtc_file_system.h | 3 +- repos/os/src/lib/vfs/symlink_file_system.h | 7 +- repos/os/src/lib/vfs/tar_file_system.h | 28 +++-- repos/os/src/lib/vfs/terminal_file_system.h | 20 ++- repos/os/src/lib/vfs/zero_file_system.h | 14 +-- repos/os/src/server/blk_cache/chunk.h | 16 +++ repos/os/src/server/blk_cache/target.mk | 2 + repos/os/src/server/chroot/component.cc | 4 +- repos/os/src/server/clipboard/main.cc | 4 +- repos/os/src/server/dynamic_rom/main.cc | 4 +- repos/os/src/server/fs_report/main.cc | 10 +- repos/os/src/server/fs_rom/main.cc | 16 ++- .../server/input_filter/accelerate_source.h | 2 +- .../src/server/input_filter/chargen_source.h | 12 +- repos/os/src/server/input_filter/connection.h | 4 +- .../server/input_filter/include_accessor.h | 4 +- repos/os/src/server/input_filter/main.cc | 13 +- repos/os/src/server/input_filter/source.h | 4 +- .../src/server/input_filter/timer_accessor.h | 2 +- repos/os/src/server/input_merger/main.cc | 2 +- repos/os/src/server/iso9660/iso9660.cc | 2 +- repos/os/src/server/iso9660/main.cc | 16 ++- repos/os/src/server/loader/child.h | 4 +- repos/os/src/server/loader/input.h | 8 +- repos/os/src/server/loader/main.cc | 22 ++-- repos/os/src/server/loader/nitpicker.h | 14 +-- .../server/loader/ram_session_client_guard.h | 2 +- repos/os/src/server/loader/rom.h | 24 ++-- repos/os/src/server/log_terminal/main.cc | 10 +- repos/os/src/server/lx_block/main.cc | 4 +- repos/os/src/server/lx_fs/directory.h | 8 +- repos/os/src/server/lx_fs/file.h | 2 +- repos/os/src/server/lx_fs/main.cc | 4 +- repos/os/src/server/lx_fs/node.h | 4 +- repos/os/src/server/lx_fs/open_node.h | 2 +- repos/os/src/server/mixer/mixer.cc | 16 ++- repos/os/src/server/nic_bridge/component.cc | 19 +-- repos/os/src/server/nic_bridge/component.h | 6 +- repos/os/src/server/nic_bridge/main.cc | 2 +- repos/os/src/server/nic_bridge/nic.cc | 19 +-- repos/os/src/server/nic_bridge/nic.h | 6 +- .../src/server/nic_bridge/packet_handler.cc | 3 +- .../os/src/server/nic_bridge/packet_handler.h | 4 +- repos/os/src/server/nic_bridge/vlan.h | 6 +- repos/os/src/server/nic_dump/component.h | 8 +- repos/os/src/server/nic_dump/interface.cc | 27 ++-- repos/os/src/server/nic_dump/interface.h | 4 +- repos/os/src/server/nic_dump/uplink.cc | 4 +- .../server/nic_router/bit_allocator_dynamic.h | 6 + repos/os/src/server/nic_router/component.h | 8 +- .../os/src/server/nic_router/configuration.h | 4 +- repos/os/src/server/nic_router/dhcp_client.cc | 17 +-- repos/os/src/server/nic_router/dhcp_client.h | 2 +- repos/os/src/server/nic_router/domain.h | 34 ++--- repos/os/src/server/nic_router/interface.cc | 56 +++++---- repos/os/src/server/nic_router/interface.h | 21 ++-- .../server/nic_router/ipv4_address_prefix.cc | 2 +- .../server/nic_router/ipv4_address_prefix.h | 2 +- repos/os/src/server/nic_router/ipv4_config.h | 4 +- repos/os/src/server/nic_router/permit_rule.cc | 4 +- repos/os/src/server/nic_router/permit_rule.h | 22 +++- .../os/src/server/nic_router/port_allocator.h | 2 +- .../os/src/server/nic_router/transport_rule.h | 8 +- repos/os/src/server/nic_router/uplink.cc | 4 +- repos/os/src/server/nit_fb/main.cc | 14 ++- repos/os/src/server/nitpicker/background.h | 2 +- repos/os/src/server/nitpicker/buffer.h | 2 +- repos/os/src/server/nitpicker/canvas.h | 2 +- .../os/src/server/nitpicker/domain_registry.h | 2 +- repos/os/src/server/nitpicker/focus.h | 2 +- .../server/nitpicker/framebuffer_session.h | 12 +- repos/os/src/server/nitpicker/input_session.h | 2 +- repos/os/src/server/nitpicker/main.cc | 14 +-- .../src/server/nitpicker/session_component.h | 24 ++-- repos/os/src/server/nitpicker/user_state.h | 10 +- .../os/src/server/nitpicker/view_component.h | 41 +++--- repos/os/src/server/nitpicker/view_owner.h | 8 +- repos/os/src/server/nitpicker/view_stack.cc | 2 +- repos/os/src/server/nitpicker/view_stack.h | 4 +- repos/os/src/server/part_blk/component.h | 16 ++- repos/os/src/server/part_blk/driver.h | 14 +-- .../os/src/server/part_blk/partition_table.h | 2 +- repos/os/src/server/ram_blk/main.cc | 6 + repos/os/src/server/ram_fs/directory.h | 8 +- repos/os/src/server/ram_fs/main.cc | 2 +- repos/os/src/server/ram_fs/node.h | 25 ++-- repos/os/src/server/report_rom/rom_registry.h | 4 +- repos/os/src/server/rom_blk/main.cc | 3 +- .../server/rom_filter/input_rom_registry.h | 5 +- repos/os/src/server/rom_filter/main.cc | 19 +-- repos/os/src/server/tar_rom/main.cc | 12 ++ .../server/terminal_crosslink/terminal_root.h | 2 +- .../terminal_session_component.h | 4 +- repos/os/src/server/trace_fs/target.mk | 2 + .../src/server/tz_vmm/include/block_driver.h | 8 +- repos/os/src/server/tz_vmm/include/vm_base.h | 7 +- repos/os/src/server/vfs/main.cc | 16 ++- repos/os/src/server/vfs/node.h | 63 ++++++---- repos/os/src/server/vmm/main.cc | 8 +- repos/os/src/server/vmm/target.mk | 2 + repos/os/src/test/audio_out/main.cc | 6 + repos/os/src/test/audio_out_click/main.cc | 35 +++--- repos/os/src/test/blk/bench/main.cc | 10 +- repos/os/src/test/blk/cli/main.cc | 22 ++-- repos/os/src/test/blk/srv/main.cc | 49 +++++--- repos/os/src/test/bomb/main.cc | 6 +- repos/os/src/test/clipboard/main.cc | 8 +- .../os/src/test/dynamic_config/server/main.cc | 2 +- repos/os/src/test/fault_detection/main.cc | 12 +- repos/os/src/test/fb_bench/main.cc | 16 ++- repos/os/src/test/framebuffer/main.cc | 4 +- repos/os/src/test/fs_report/main.cc | 10 +- repos/os/src/test/gpio_drv/target.mk | 2 + repos/os/src/test/gpio_signal/main.cc | 4 +- repos/os/src/test/init/main.cc | 4 +- repos/os/src/test/input_filter/main.cc | 4 +- repos/os/src/test/loader/main.cc | 4 +- repos/os/src/test/nic_loopback/main.cc | 6 +- repos/os/src/test/nitpicker/test.cc | 6 +- repos/os/src/test/ram_fs_chunk/main.cc | 2 +- repos/os/src/test/report_rom/main.cc | 4 +- repos/os/src/test/resource_yield/main.cc | 4 +- repos/os/src/test/rom_blk/main.cc | 2 +- repos/os/src/test/sd_card_bench/main.cc | 12 +- repos/os/src/test/signal/main.cc | 79 ++++++------ repos/os/src/test/terminal_crosslink/main.cc | 4 +- repos/os/src/test/timed_semaphore/main.cc | 4 +- repos/os/src/test/timeout/main.cc | 14 ++- repos/os/src/test/timer/main.cc | 6 +- repos/os/src/test/trace/main.cc | 23 ++-- repos/ports/src/virtualbox/network.cpp | 2 +- 763 files changed, 4936 insertions(+), 3288 deletions(-) create mode 100644 repos/base-okl4/src/include/base/internal/okl4.h create mode 100644 repos/base/include/util/interface.h diff --git a/repos/base-fiasco/src/core/include/ipc_pager.h b/repos/base-fiasco/src/core/include/ipc_pager.h index 0dd2bd50b..083c6c09a 100644 --- a/repos/base-fiasco/src/core/include/ipc_pager.h +++ b/repos/base-fiasco/src/core/include/ipc_pager.h @@ -47,8 +47,8 @@ namespace Genode { * Constructor */ Mapping(addr_t dst_addr, addr_t src_addr, - Cache_attribute cacheability, bool io_mem, - unsigned l2size, bool rw, bool executable) + Cache_attribute cacheability, bool, + unsigned l2size, bool rw, bool) : _dst_addr(dst_addr), _fpage(Fiasco::l4_fpage(src_addr, l2size, rw, false)) @@ -93,10 +93,10 @@ namespace Genode { { private: - Fiasco::l4_threadid_t _last; /* origin of last fault message */ - addr_t _pf_addr; /* page-fault address */ - addr_t _pf_ip; /* instruction pointer of faulter */ - Mapping _reply_mapping; /* page-fault answer */ + Fiasco::l4_threadid_t _last { }; /* origin of last fault message */ + addr_t _pf_addr { 0 }; /* page-fault address */ + addr_t _pf_ip { 0 }; /* instruction pointer of faulter */ + Mapping _reply_mapping { }; /* page-fault answer */ public: diff --git a/repos/base-fiasco/src/core/include/map_local.h b/repos/base-fiasco/src/core/include/map_local.h index 3a6ce219c..c905eacfd 100644 --- a/repos/base-fiasco/src/core/include/map_local.h +++ b/repos/base-fiasco/src/core/include/map_local.h @@ -78,7 +78,7 @@ namespace Genode { * \param virt core-local address * \param num_pages number of pages to unmap */ - inline void unmap_local(addr_t virt, size_t num_pages) + inline void unmap_local(addr_t, size_t) { error("unmap_local() called - not implemented yet"); } diff --git a/repos/base-fiasco/src/core/include/platform.h b/repos/base-fiasco/src/core/include/platform.h index 669060296..58d28e9f5 100644 --- a/repos/base-fiasco/src/core/include/platform.h +++ b/repos/base-fiasco/src/core/include/platform.h @@ -31,23 +31,29 @@ namespace Genode { { private: + /* + * Noncopyable + */ + Platform(Platform const &); + Platform &operator = (Platform const &); + /* * Shortcut for the type of allocator instances for physical resources */ typedef Synced_range_allocator Phys_allocator; - char _core_label[1]; /* to satisfy _core_pd */ - Platform_pd *_core_pd; /* core protection domain object */ - Phys_allocator _ram_alloc; /* RAM allocator */ - Phys_allocator _io_mem_alloc; /* MMIO allocator */ - Phys_allocator _io_port_alloc; /* I/O port allocator */ - Phys_allocator _irq_alloc; /* IRQ allocator */ - Phys_allocator _region_alloc; /* virtual memory allocator for core */ - Rom_fs _rom_fs; /* ROM file system */ - Rom_module _kip_rom; /* ROM module for Fiasco KIP */ + char _core_label[1]; /* to satisfy _core_pd */ + Platform_pd *_core_pd = nullptr; /* core protection domain object */ + Phys_allocator _ram_alloc; /* RAM allocator */ + Phys_allocator _io_mem_alloc; /* MMIO allocator */ + Phys_allocator _io_port_alloc; /* I/O port allocator */ + Phys_allocator _irq_alloc; /* IRQ allocator */ + Phys_allocator _region_alloc; /* virtual memory allocator for core */ + Rom_fs _rom_fs { }; /* ROM file system */ + Rom_module _kip_rom; /* ROM module for Fiasco KIP */ - addr_t _vm_start; /* begin of virtual memory */ - size_t _vm_size; /* size of virtual memory */ + addr_t _vm_start = 0; /* begin of virtual memory */ + size_t _vm_size = 0; /* size of virtual memory */ /* * We do not export any boot module loaded before FIRST_ROM. @@ -101,7 +107,7 @@ namespace Genode { */ Sigma0(); - int pager(Ipc_pager &ps) { /* never called */ return -1; } + int pager(Ipc_pager &) { /* never called */ return -1; } }; /** @@ -119,7 +125,7 @@ namespace Genode { */ Core_pager(Platform_pd *core_pd); - int pager(Ipc_pager &ps) { /* never called */ return -1; } + int pager(Ipc_pager &) { /* never called */ return -1; } }; /** diff --git a/repos/base-fiasco/src/core/include/platform_pd.h b/repos/base-fiasco/src/core/include/platform_pd.h index ed6af56a6..a899dfda7 100644 --- a/repos/base-fiasco/src/core/include/platform_pd.h +++ b/repos/base-fiasco/src/core/include/platform_pd.h @@ -32,6 +32,12 @@ namespace Genode { { private: + /* + * Noncopyable + */ + Platform_pd(Platform_pd const &); + Platform_pd &operator = (Platform_pd const &); + enum { VERSION_BITS = 10, PD_FIRST = 0x10, @@ -41,10 +47,10 @@ namespace Genode { THREAD_MAX = (1 << 7), }; - unsigned _pd_id; /* plain pd number */ - unsigned _version; /* version number */ + unsigned _pd_id = 0; + unsigned _version = 0; - Fiasco::l4_taskid_t _l4_task_id; /* L4 task ID */ + Fiasco::l4_taskid_t _l4_task_id { }; /* L4 task ID */ /********************************************** @@ -154,7 +160,7 @@ namespace Genode { /** * Register quota donation at allocator guard */ - void upgrade_ram_quota(size_t ram_quota) { } + void upgrade_ram_quota(size_t) { } /** * Initialize L4 task facility @@ -178,7 +184,7 @@ namespace Genode { /** * Assign parent interface to protection domain */ - void assign_parent(Native_capability parent) { } + void assign_parent(Native_capability) { } int pd_id() const { return _pd_id; } diff --git a/repos/base-fiasco/src/core/include/platform_thread.h b/repos/base-fiasco/src/core/include/platform_thread.h index 1b17c7009..c7dc8f033 100644 --- a/repos/base-fiasco/src/core/include/platform_thread.h +++ b/repos/base-fiasco/src/core/include/platform_thread.h @@ -30,18 +30,24 @@ namespace Fiasco { namespace Genode { class Platform_pd; - class Platform_thread + class Platform_thread : Interface { private: + /* + * Noncopyable + */ + Platform_thread(Platform_thread const &); + Platform_thread &operator = (Platform_thread const &); + int _thread_id; /* plain thread number */ Fiasco::l4_threadid_t _l4_thread_id; /* L4 thread ID */ char _name[32]; /* thread name that will be registered at the kernel debugger */ - Platform_pd *_platform_pd; /* protection domain thread + Platform_pd *_platform_pd = nullptr; /* protection domain thread is bound to */ - Pager_object *_pager; + Pager_object *_pager; public: @@ -152,7 +158,7 @@ namespace Genode { /** * Set CPU quota of the thread to 'quota' */ - void quota(size_t const quota) { /* not supported*/ } + void quota(size_t) { /* not supported*/ } /** * Return execution time consumed by the thread diff --git a/repos/base-fiasco/src/core/include/rpc_cap_factory.h b/repos/base-fiasco/src/core/include/rpc_cap_factory.h index 9b0200c56..9b6000c00 100644 --- a/repos/base-fiasco/src/core/include/rpc_cap_factory.h +++ b/repos/base-fiasco/src/core/include/rpc_cap_factory.h @@ -29,7 +29,7 @@ class Genode::Rpc_cap_factory public: - Rpc_cap_factory(Allocator &md_alloc) { } + Rpc_cap_factory(Allocator &) { } Native_capability alloc(Native_capability ep); diff --git a/repos/base-fiasco/src/core/include/util.h b/repos/base-fiasco/src/core/include/util.h index c3237d0e0..0e7f34e70 100644 --- a/repos/base-fiasco/src/core/include/util.h +++ b/repos/base-fiasco/src/core/include/util.h @@ -97,7 +97,7 @@ namespace Genode { constexpr size_t get_super_page_size() { return L4_SUPERPAGESIZE; } constexpr size_t get_super_page_size_log2() { return L4_LOG2_SUPERPAGESIZE; } - inline addr_t map_src_addr(addr_t core_local_addr, addr_t phys_addr) { + inline addr_t map_src_addr(addr_t core_local_addr, addr_t) { return core_local_addr; } inline size_t constrain_map_size_log2(size_t size_log2) { return size_log2; } diff --git a/repos/base-fiasco/src/core/io_mem_session_support.cc b/repos/base-fiasco/src/core/io_mem_session_support.cc index 88e423e57..123b1e8cf 100644 --- a/repos/base-fiasco/src/core/io_mem_session_support.cc +++ b/repos/base-fiasco/src/core/io_mem_session_support.cc @@ -25,7 +25,7 @@ namespace Fiasco { using namespace Genode; -void Io_mem_session_component::_unmap_local(addr_t base, size_t size) +void Io_mem_session_component::_unmap_local(addr_t base, size_t) { platform()->region_alloc()->free(reinterpret_cast(base)); } diff --git a/repos/base-fiasco/src/core/irq_session_component.cc b/repos/base-fiasco/src/core/irq_session_component.cc index c0fde4637..fc7cb10bb 100644 --- a/repos/base-fiasco/src/core/irq_session_component.cc +++ b/repos/base-fiasco/src/core/irq_session_component.cc @@ -162,5 +162,5 @@ void Irq_session_component::sigh(Genode::Signal_context_capability cap) Genode::Irq_session::Info Irq_session_component::info() { /* no MSI support */ - return { .type = Genode::Irq_session::Info::Type::INVALID }; + return { .type = Info::Type::INVALID, .address = 0, .value = 0 }; } diff --git a/repos/base-fiasco/src/core/pager_object.cc b/repos/base-fiasco/src/core/pager_object.cc index 37a05db2c..c798c4240 100644 --- a/repos/base-fiasco/src/core/pager_object.cc +++ b/repos/base-fiasco/src/core/pager_object.cc @@ -33,10 +33,10 @@ void Pager_object::wake_up() /* kernel-defined message header */ struct { - l4_fpage_t rcv_fpage; /* unused */ + l4_fpage_t rcv_fpage { }; /* unused */ l4_msgdope_t size_dope = L4_IPC_DOPE(0, 0); l4_msgdope_t send_dope = L4_IPC_DOPE(0, 0); - } rcv_header; + } rcv_header { }; l4_msgdope_t ipc_result; l4_umword_t dummy = 0; diff --git a/repos/base-fiasco/src/core/platform_pd.cc b/repos/base-fiasco/src/core/platform_pd.cc index 788a954ed..a972c68ec 100644 --- a/repos/base-fiasco/src/core/platform_pd.cc +++ b/repos/base-fiasco/src/core/platform_pd.cc @@ -246,8 +246,7 @@ void Platform_pd::flush(addr_t, size_t size, Core_local_addr core_local_base) L4_FP_FLUSH_PAGE); } -Platform_pd::Platform_pd(Allocator * md_alloc, char const *, - signed pd_id, bool create) +Platform_pd::Platform_pd(Allocator *, char const *, signed pd_id, bool create) { /* check correct init */ if (!_init) diff --git a/repos/base-fiasco/src/core/platform_thread.cc b/repos/base-fiasco/src/core/platform_thread.cc index 9bd451d1c..c42241630 100644 --- a/repos/base-fiasco/src/core/platform_thread.cc +++ b/repos/base-fiasco/src/core/platform_thread.cc @@ -109,7 +109,7 @@ void Platform_thread::unbind() } -void Platform_thread::state(Thread_state s) +void Platform_thread::state(Thread_state) { warning(__func__, " not implemented"); throw Cpu_thread::State_access_failed(); diff --git a/repos/base-fiasco/src/core/ram_dataspace_support.cc b/repos/base-fiasco/src/core/ram_dataspace_support.cc index 489f72fe4..b1e0ebb19 100644 --- a/repos/base-fiasco/src/core/ram_dataspace_support.cc +++ b/repos/base-fiasco/src/core/ram_dataspace_support.cc @@ -18,8 +18,8 @@ using namespace Genode; -void Ram_dataspace_factory::_export_ram_ds(Dataspace_component *ds) { } -void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component *ds) { } +void Ram_dataspace_factory::_export_ram_ds(Dataspace_component *) { } +void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component *) { } void Ram_dataspace_factory::_clear_ds(Dataspace_component *ds) { diff --git a/repos/base-foc/include/foc/native_capability.h b/repos/base-foc/include/foc/native_capability.h index d07994f84..a50787ce5 100644 --- a/repos/base-foc/include/foc/native_capability.h +++ b/repos/base-foc/include/foc/native_capability.h @@ -20,49 +20,55 @@ namespace Fiasco { #include #include - enum Cap_selectors { + /********************************************* + ** Capability selectors controlled by core ** + *********************************************/ - /********************************************* - ** Capability selectors controlled by core ** - *********************************************/ + /* use the same task cap selector like L4Re for compatibility in L4Linux */ + static constexpr l4_cap_idx_t TASK_CAP = L4_BASE_TASK_CAP; - TASK_CAP = L4_BASE_TASK_CAP, /* use the same task cap selector - like L4Re for compatibility in - L4Linux */ - DEBUG_CAP = L4_BASE_DEBUGGER_CAP, + static constexpr l4_cap_idx_t DEBUG_CAP = L4_BASE_DEBUGGER_CAP; - /* - * To not clash with other L4Re cap selector constants (e.g.: L4Linux) - * leave the following selectors (2-8) empty - */ + /* + * To not clash with other L4Re cap selector constants (e.g.: L4Linux) + * leave the following selectors (2-8) empty + */ - PARENT_CAP = 0xbUL << L4_CAP_SHIFT, /* cap to parent session */ + /* cap to parent session */ + static constexpr l4_cap_idx_t PARENT_CAP = 0xbUL << L4_CAP_SHIFT; - /* - * Each thread has a designated slot in the core controlled cap - * selector area, where its ipc gate capability (for server threads), - * its irq capability (for locks), and the capability to its pager - * gate are stored - */ - THREAD_AREA_BASE = 0xcUL << L4_CAP_SHIFT, /* offset to thread area */ - THREAD_AREA_SLOT = 0x3UL << L4_CAP_SHIFT, /* size of one thread slot */ - THREAD_GATE_CAP = 0, /* offset to the ipc gate - cap selector in the slot */ - THREAD_PAGER_CAP = 0x1UL << L4_CAP_SHIFT, /* offset to the pager - cap selector in the slot */ - THREAD_IRQ_CAP = 0x2UL << L4_CAP_SHIFT, /* offset to the irq cap - selector in the slot */ - MAIN_THREAD_CAP = THREAD_AREA_BASE + THREAD_GATE_CAP, /* shortcut to the - main thread's - gate cap */ + /* + * Each thread has a designated slot in the core controlled cap + * selector area, where its ipc gate capability (for server threads), + * its irq capability (for locks), and the capability to its pager + * gate are stored + */ + + /* offset to thread area */ + static constexpr l4_cap_idx_t THREAD_AREA_BASE = 0xcUL << L4_CAP_SHIFT; + + /* size of one thread slot */ + static constexpr l4_cap_idx_t THREAD_AREA_SLOT = 0x3UL << L4_CAP_SHIFT; + + /* offset to the ipc gate cap selector in the slot */ + static constexpr l4_cap_idx_t THREAD_GATE_CAP = 0; + + /* offset to the pager cap selector in the slot */ + static constexpr l4_cap_idx_t THREAD_PAGER_CAP = 0x1UL << L4_CAP_SHIFT; + + /* offset to the irq cap selector in the slot */ + static constexpr l4_cap_idx_t THREAD_IRQ_CAP = 0x2UL << L4_CAP_SHIFT; + + /* shortcut to the main thread's gate cap */ + static constexpr l4_cap_idx_t MAIN_THREAD_CAP = THREAD_AREA_BASE + + THREAD_GATE_CAP; - /********************************************************* - ** Capability seclectors controlled by the task itself ** - *********************************************************/ + /********************************************************* + ** Capability seclectors controlled by the task itself ** + *********************************************************/ - USER_BASE_CAP = 0x200UL << L4_CAP_SHIFT, - }; + static constexpr l4_cap_idx_t USER_BASE_CAP = 0x200UL << L4_CAP_SHIFT; struct Capability { diff --git a/repos/base-foc/include/foc/native_thread.h b/repos/base-foc/include/foc/native_thread.h index c3a0c9e20..ab26ccde0 100644 --- a/repos/base-foc/include/foc/native_thread.h +++ b/repos/base-foc/include/foc/native_thread.h @@ -34,7 +34,7 @@ struct Genode::Native_thread Fiasco::l4_cap_idx_t kcap = 0; /* receive window for capability selectors received at the server side */ - Receive_window rcv_window; + Receive_window rcv_window { }; Native_thread() { } explicit Native_thread(Fiasco::l4_cap_idx_t kcap) : kcap(kcap) { } diff --git a/repos/base-foc/include/foc/receive_window.h b/repos/base-foc/include/foc/receive_window.h index 97f114b78..372dac05f 100644 --- a/repos/base-foc/include/foc/receive_window.h +++ b/repos/base-foc/include/foc/receive_window.h @@ -38,6 +38,21 @@ class Genode::Receive_window ~Receive_window(); + /* + * Needed for 'Ipc_pager::set_reply_dst' + */ + Receive_window &operator = (Receive_window const &other) + { + _rcv_idx_base = other._rcv_idx_base; + return *this; + } + + /** + * Copy constructor + */ + Receive_window(Receive_window const &other) + : _rcv_idx_base(other._rcv_idx_base) { } + void init(); /** diff --git a/repos/base-foc/include/foc/thread_state.h b/repos/base-foc/include/foc/thread_state.h index 0b779f8b8..f42a02b73 100644 --- a/repos/base-foc/include/foc/thread_state.h +++ b/repos/base-foc/include/foc/thread_state.h @@ -36,7 +36,7 @@ struct Genode::Foc_thread_state : Thread_state unsigned exceptions; /* counts exceptions raised by the thread */ bool paused; /* indicates whether thread is stopped */ bool in_exception; /* true if thread is in exception */ - Lock lock; + Lock lock { }; /** * Constructor diff --git a/repos/base-foc/src/core/include/cap_id_alloc.h b/repos/base-foc/src/core/include/cap_id_alloc.h index a23557c06..f4c42e6f4 100644 --- a/repos/base-foc/src/core/include/cap_id_alloc.h +++ b/repos/base-foc/src/core/include/cap_id_alloc.h @@ -34,7 +34,8 @@ namespace Genode { }; Synced_range_allocator _id_alloc; - Lock _lock; + + Lock _lock { }; public: diff --git a/repos/base-foc/src/core/include/cap_index.h b/repos/base-foc/src/core/include/cap_index.h index ac2061ae9..ffed43463 100644 --- a/repos/base-foc/src/core/include/cap_index.h +++ b/repos/base-foc/src/core/include/cap_index.h @@ -34,6 +34,12 @@ class Genode::Core_cap_index : public Native_capability::Data Platform_thread const *_pt; Native_thread _gate; + /* + * Noncopyable + */ + Core_cap_index(Core_cap_index const &); + Core_cap_index &operator = (Core_cap_index const &); + public: Core_cap_index(Pd_session_component *session = 0, diff --git a/repos/base-foc/src/core/include/cpu_session_irqs.h b/repos/base-foc/src/core/include/cpu_session_irqs.h index 30f2910bf..a6e39068f 100644 --- a/repos/base-foc/src/core/include/cpu_session_irqs.h +++ b/repos/base-foc/src/core/include/cpu_session_irqs.h @@ -29,6 +29,12 @@ class Genode::Cpu_session_irqs : public Avl_node { private: + /* + * Noncopyable + */ + Cpu_session_irqs(Cpu_session_irqs const &); + Cpu_session_irqs &operator = (Cpu_session_irqs const &); + enum { IRQ_MAX = 20 }; Cpu_session_component* _owner; diff --git a/repos/base-foc/src/core/include/ipc_pager.h b/repos/base-foc/src/core/include/ipc_pager.h index ac29553c4..4da549889 100644 --- a/repos/base-foc/src/core/include/ipc_pager.h +++ b/repos/base-foc/src/core/include/ipc_pager.h @@ -43,7 +43,7 @@ class Genode::Mapping private: addr_t _dst_addr; - Fiasco::l4_fpage_t _fpage; + Fiasco::l4_fpage_t _fpage { }; Cache_attribute _cacheability; bool _iomem; @@ -96,14 +96,14 @@ class Genode::Ipc_pager : public Native_capability private: - Native_thread _last; /* origin of last fault */ - addr_t _pf_addr; /* page-fault address */ - addr_t _pf_ip; /* ip of faulter */ - Mapping _reply_mapping; /* page-fault answer */ - unsigned long _badge; /* badge of faulting thread */ - Fiasco::l4_msgtag_t _tag; /* receive message tag */ - Fiasco::l4_exc_regs_t _regs; /* exception registers */ - Msg_type _type; + Native_thread _last { }; /* origin of last fault */ + addr_t _pf_addr { 0 }; /* page-fault address */ + addr_t _pf_ip { 0 }; /* ip of faulter */ + Mapping _reply_mapping { }; /* page-fault answer */ + unsigned long _badge; /* badge of faulting thread */ + Fiasco::l4_msgtag_t _tag { }; /* receive message tag */ + Fiasco::l4_exc_regs_t _regs { }; /* exception registers */ + Msg_type _type { PAGEFAULT }; void _parse_msg_type(void); void _parse_exception(void); diff --git a/repos/base-foc/src/core/include/irq_object.h b/repos/base-foc/src/core/include/irq_object.h index 29b2d8fa3..7c0d29e4c 100644 --- a/repos/base-foc/src/core/include/irq_object.h +++ b/repos/base-foc/src/core/include/irq_object.h @@ -27,6 +27,12 @@ class Genode::Irq_object { private: + /* + * Noncopyable + */ + Irq_object(Irq_object const &); + Irq_object &operator = (Irq_object const &); + Cap_index *_cap; Irq_session::Trigger _trigger; /* interrupt trigger */ Irq_session::Polarity _polarity; /* interrupt polarity */ @@ -35,7 +41,7 @@ class Genode::Irq_object Genode::addr_t _msi_addr; Genode::addr_t _msi_data; - Signal_context_capability _sig_cap; + Signal_context_capability _sig_cap { }; Fiasco::l4_cap_idx_t _capability() const { return _cap->kcap(); } diff --git a/repos/base-foc/src/core/include/platform.h b/repos/base-foc/src/core/include/platform.h index 525b18385..0cd4e96fc 100644 --- a/repos/base-foc/src/core/include/platform.h +++ b/repos/base-foc/src/core/include/platform.h @@ -34,6 +34,12 @@ namespace Genode { { private: + /* + * Noncopyable + */ + Platform(Platform const &); + Platform &operator = (Platform const &); + /** * Pager object representing the pager of core namely sigma0 */ @@ -44,7 +50,7 @@ namespace Genode { */ Sigma0(Cap_index*); - int pager(Ipc_pager &ps) { /* never called */ return -1; } + int pager(Ipc_pager &) { /* never called */ return -1; } }; /* @@ -52,19 +58,19 @@ namespace Genode { */ typedef Synced_range_allocator Phys_allocator; - Platform_pd *_core_pd; /* core protection domain object */ - Phys_allocator _ram_alloc; /* RAM allocator */ - Phys_allocator _io_mem_alloc; /* MMIO allocator */ - Phys_allocator _io_port_alloc; /* I/O port allocator */ - Phys_allocator _irq_alloc; /* IRQ allocator */ - Phys_allocator _region_alloc; /* virtual memory allocator for core */ - Cap_id_allocator _cap_id_alloc; /* capability id allocator */ - Rom_fs _rom_fs; /* ROM file system */ - Rom_module _kip_rom; /* ROM module for Fiasco KIP */ + Platform_pd *_core_pd = nullptr; /* core protection domain object */ + Phys_allocator _ram_alloc; /* RAM allocator */ + Phys_allocator _io_mem_alloc; /* MMIO allocator */ + Phys_allocator _io_port_alloc; /* I/O port allocator */ + Phys_allocator _irq_alloc; /* IRQ allocator */ + Phys_allocator _region_alloc; /* virtual memory allocator for core */ + Cap_id_allocator _cap_id_alloc; /* capability id allocator */ + Rom_fs _rom_fs { }; /* ROM file system */ + Rom_module _kip_rom; /* ROM module for Fiasco KIP */ Sigma0 _sigma0; - addr_t _vm_start; /* begin of virtual memory */ - size_t _vm_size; /* size of virtual memory */ + addr_t _vm_start = 0; /* begin of virtual memory */ + size_t _vm_size = 0; /* size of virtual memory */ /* @@ -119,7 +125,7 @@ namespace Genode { */ Core_pager(Platform_pd *core_pd, Sigma0*); - int pager(Ipc_pager &ps) { /* never called */ return -1; } + int pager(Ipc_pager &) { /* never called */ return -1; } }; /** diff --git a/repos/base-foc/src/core/include/platform_pd.h b/repos/base-foc/src/core/include/platform_pd.h index a4f936072..67754eb08 100644 --- a/repos/base-foc/src/core/include/platform_pd.h +++ b/repos/base-foc/src/core/include/platform_pd.h @@ -44,6 +44,12 @@ namespace Genode { { private: + /* + * Noncopyable + */ + Platform_pd(Platform_pd const &); + Platform_pd &operator = (Platform_pd const &); + enum { THREAD_MAX = (1 << 7), UTCB_AREA_SIZE = (THREAD_MAX * Fiasco::L4_UTCB_OFFSET), @@ -56,8 +62,8 @@ namespace Genode { } Cap_mapping _task; - Cap_mapping _parent; - Cap_mapping _debug; + Cap_mapping _parent { }; + Cap_mapping _debug { }; Platform_thread *_threads[THREAD_MAX]; public: diff --git a/repos/base-foc/src/core/include/platform_thread.h b/repos/base-foc/src/core/include/platform_thread.h index bed777cc3..790c0c113 100644 --- a/repos/base-foc/src/core/include/platform_thread.h +++ b/repos/base-foc/src/core/include/platform_thread.h @@ -27,10 +27,16 @@ namespace Genode { class Platform_pd; - class Platform_thread + class Platform_thread : Interface { private: + /* + * Noncopyable + */ + Platform_thread(Platform_thread const &); + Platform_thread &operator = (Platform_thread const &); + enum State { DEAD, RUNNING }; friend class Platform_pd; @@ -38,8 +44,8 @@ namespace Genode { State _state; bool _core_thread; Cap_mapping _thread; - Cap_mapping _gate; - Cap_mapping _pager; + Cap_mapping _gate { }; + Cap_mapping _pager { }; Cap_mapping _irq; addr_t _utcb; char _name[32]; /* thread name that will be @@ -50,7 +56,7 @@ namespace Genode { Pager_object *_pager_obj; unsigned _prio; - Affinity::Location _location; + Affinity::Location _location { }; void _create_thread(void); void _finalize_construction(const char *name); @@ -168,7 +174,7 @@ namespace Genode { /** * Set CPU quota of the thread to 'quota' */ - void quota(size_t const quota) { /* not supported*/ } + void quota(size_t const) { /* not supported*/ } /** * Return execution time consumed by the thread diff --git a/repos/base-foc/src/core/include/rpc_cap_factory.h b/repos/base-foc/src/core/include/rpc_cap_factory.h index 41df0c1ce..3299b7cd6 100644 --- a/repos/base-foc/src/core/include/rpc_cap_factory.h +++ b/repos/base-foc/src/core/include/rpc_cap_factory.h @@ -35,7 +35,7 @@ class Genode::Rpc_cap_factory Entry(Native_capability cap) : Object_pool::Entry(cap) {} }; - Object_pool _pool; + Object_pool _pool { }; /* * Dimension '_entry_slab' such that slab blocks (including the diff --git a/repos/base-foc/src/core/include/util.h b/repos/base-foc/src/core/include/util.h index 95dc98e43..b9c1d2c42 100644 --- a/repos/base-foc/src/core/include/util.h +++ b/repos/base-foc/src/core/include/util.h @@ -71,7 +71,7 @@ namespace Genode { constexpr size_t get_super_page_size() { return L4_SUPERPAGESIZE; } constexpr size_t get_super_page_size_log2() { return L4_LOG2_SUPERPAGESIZE; } - inline addr_t map_src_addr(addr_t core_local_addr, addr_t phys_addr) { + inline addr_t map_src_addr(addr_t core_local_addr, addr_t) { return core_local_addr; } inline size_t constrain_map_size_log2(size_t size_log2) { return size_log2; } diff --git a/repos/base-foc/src/core/io_mem_session_support.cc b/repos/base-foc/src/core/io_mem_session_support.cc index a56a832ac..81658a841 100644 --- a/repos/base-foc/src/core/io_mem_session_support.cc +++ b/repos/base-foc/src/core/io_mem_session_support.cc @@ -21,7 +21,7 @@ using namespace Genode; -void Io_mem_session_component::_unmap_local(addr_t base, size_t size) +void Io_mem_session_component::_unmap_local(addr_t base, size_t) { platform()->region_alloc()->free(reinterpret_cast(base)); } diff --git a/repos/base-foc/src/core/ipc_pager.cc b/repos/base-foc/src/core/ipc_pager.cc index 52a161130..7642da27a 100644 --- a/repos/base-foc/src/core/ipc_pager.cc +++ b/repos/base-foc/src/core/ipc_pager.cc @@ -124,7 +124,8 @@ void Ipc_pager::reply_and_wait_for_fault() void Ipc_pager::acknowledge_wakeup() { - l4_cap_idx_t dst = Fiasco::Capability::valid(_last.kcap) ? _last.kcap : L4_SYSF_REPLY; + l4_cap_idx_t dst = Fiasco::Capability::valid(_last.kcap) + ? _last.kcap : (l4_cap_idx_t)L4_SYSF_REPLY; /* answer wakeup call from one of core's region-manager sessions */ l4_ipc_send(dst, l4_utcb(), l4_msgtag(0, 0, 0, 0), L4_IPC_SEND_TIMEOUT_0); @@ -134,7 +135,8 @@ void Ipc_pager::acknowledge_wakeup() void Ipc_pager::acknowledge_exception() { memcpy(l4_utcb_exc(), &_regs, sizeof(l4_exc_regs_t)); - l4_cap_idx_t dst = Fiasco::Capability::valid(_last.kcap) ? _last.kcap : L4_SYSF_REPLY; + l4_cap_idx_t dst = Fiasco::Capability::valid(_last.kcap) + ? _last.kcap : (l4_cap_idx_t)L4_SYSF_REPLY; Fiasco::l4_msgtag_t const msg_tag = l4_ipc_send(dst, l4_utcb(), l4_msgtag(0, L4_UTCB_EXCEPTION_REGS_SIZE, 0, 0), diff --git a/repos/base-foc/src/core/irq_session_component.cc b/repos/base-foc/src/core/irq_session_component.cc index 2694e944a..b292be251 100644 --- a/repos/base-foc/src/core/irq_session_component.cc +++ b/repos/base-foc/src/core/irq_session_component.cc @@ -71,7 +71,7 @@ static class Msi_allocator : public Genode::Bit_array Msi_allocator() { using namespace Fiasco; - l4_icu_info_t info { .features = 0 }; + l4_icu_info_t info { .features = 0, .nr_irqs = 0, .nr_msis = 0 }; l4_msgtag_t res = l4_icu_info(Fiasco::L4_BASE_ICU_CAP, &info); if (l4_error(res) || !(info.features & L4_ICU_FLAG_MSI)) @@ -182,7 +182,7 @@ Genode::Irq_object::~Irq_object() Irq_session_component::Irq_session_component(Range_allocator *irq_alloc, const char *args) : _irq_number(Arg_string::find_arg(args, "irq_number").long_value(-1)), - _irq_alloc(irq_alloc) + _irq_alloc(irq_alloc), _irq_object() { long msi = Arg_string::find_arg(args, "device_config_phys").long_value(0); if (msi) { @@ -230,7 +230,7 @@ void Irq_session_component::sigh(Genode::Signal_context_capability cap) Genode::Irq_session::Info Irq_session_component::info() { if (!_irq_object.msi_address()) - return { .type = Genode::Irq_session::Info::Type::INVALID }; + return { .type = Info::Type::INVALID, .address = 0, .value = 0 }; return { .type = Genode::Irq_session::Info::Type::MSI, diff --git a/repos/base-foc/src/core/platform.cc b/repos/base-foc/src/core/platform.cc index ee1c5c14b..c9d3d3f6b 100644 --- a/repos/base-foc/src/core/platform.cc +++ b/repos/base-foc/src/core/platform.cc @@ -334,7 +334,7 @@ void Platform::_setup_irq_alloc() { using namespace Fiasco; - l4_icu_info_t info { .features = 0 }; + l4_icu_info_t info { .features = 0, .nr_irqs = 0, .nr_msis = 0 }; l4_msgtag_t res = l4_icu_info(Fiasco::L4_BASE_ICU_CAP, &info); if (l4_error(res)) panic("could not determine number of IRQs"); diff --git a/repos/base-foc/src/core/ram_dataspace_support.cc b/repos/base-foc/src/core/ram_dataspace_support.cc index 5e3dd97ef..179366012 100644 --- a/repos/base-foc/src/core/ram_dataspace_support.cc +++ b/repos/base-foc/src/core/ram_dataspace_support.cc @@ -21,8 +21,8 @@ namespace Fiasco { using namespace Genode; -void Ram_dataspace_factory::_export_ram_ds(Dataspace_component *ds) { } -void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component *ds) { } +void Ram_dataspace_factory::_export_ram_ds(Dataspace_component *) { } +void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component *) { } void Ram_dataspace_factory::_clear_ds(Dataspace_component *ds) diff --git a/repos/base-foc/src/include/base/internal/cap_alloc.h b/repos/base-foc/src/include/base/internal/cap_alloc.h index b5e597770..52b36e154 100644 --- a/repos/base-foc/src/include/base/internal/cap_alloc.h +++ b/repos/base-foc/src/include/base/internal/cap_alloc.h @@ -41,8 +41,14 @@ namespace Genode { { private: - Spin_lock _lock; /* used very early in initialization, - where normal lock isn't feasible */ + /* + * Noncopyable + */ + Cap_index_allocator_tpl(Cap_index_allocator_tpl const &); + Cap_index_allocator_tpl &operator = (Cap_index_allocator_tpl const &); + + Spin_lock _lock { }; /* used very early in initialization, + where normal lock isn't feasible */ enum { /* everything below START_IDX is managed by core */ diff --git a/repos/base-foc/src/include/base/internal/cap_map.h b/repos/base-foc/src/include/base/internal/cap_map.h index 96855bf07..f76ef283d 100644 --- a/repos/base-foc/src/include/base/internal/cap_map.h +++ b/repos/base-foc/src/include/base/internal/cap_map.h @@ -174,8 +174,8 @@ namespace Genode { { private: - Avl_tree _tree; - Spin_lock _lock; + Avl_tree _tree { }; + Spin_lock _lock { }; public: diff --git a/repos/base-foc/src/include/base/internal/capability_data.h b/repos/base-foc/src/include/base/internal/capability_data.h index 79a2e757b..3357a910b 100644 --- a/repos/base-foc/src/include/base/internal/capability_data.h +++ b/repos/base-foc/src/include/base/internal/capability_data.h @@ -30,7 +30,8 @@ class Genode::Native_capability::Data : public Avl_node, Noncopyable { private: - enum { INVALID_ID = -1, UNUSED = 0 }; + constexpr static uint16_t INVALID_ID = ~0; + constexpr static uint16_t UNUSED = 0; uint8_t _ref_cnt; /* reference counter */ uint16_t _id; /* global capability id */ @@ -47,7 +48,7 @@ class Genode::Native_capability::Data : public Avl_node, Noncopyable uint8_t dec(); addr_t kcap() const; - void* operator new (__SIZE_TYPE__ size, Data* idx) { return idx; } + void* operator new (__SIZE_TYPE__, Data* idx) { return idx; } void operator delete (void* idx) { memset(idx, 0, sizeof(Data)); } diff --git a/repos/base-foc/src/lib/base/ipc.cc b/repos/base-foc/src/lib/base/ipc.cc index 5f240e1d8..b2171ab5b 100644 --- a/repos/base-foc/src/lib/base/ipc.cc +++ b/repos/base-foc/src/lib/base/ipc.cc @@ -61,7 +61,7 @@ static inline bool ipc_error(l4_msgtag_t tag, bool print) } -enum { INVALID_BADGE = ~0UL }; +static constexpr unsigned long INVALID_BADGE = ~0UL; /** @@ -86,7 +86,7 @@ static unsigned long extract_msg_from_utcb(l4_msgtag_t tag, { unsigned num_msg_words = l4_msgtag_words(tag); - l4_mword_t const *msg_words = (l4_mword_t const *)l4_utcb_mr(); + l4_umword_t const *msg_words = (l4_umword_t const *)l4_utcb_mr(); /* each message has at least the protocol word and the capability count */ if (num_msg_words < 2) @@ -96,7 +96,7 @@ static unsigned long extract_msg_from_utcb(l4_msgtag_t tag, unsigned long const protocol_word = *msg_words++; /* read number of capability arguments from second message word */ - unsigned long const num_caps = min(*msg_words, Msgbuf_base::MAX_CAPS_PER_MSG); + size_t const num_caps = min(*msg_words, Msgbuf_base::MAX_CAPS_PER_MSG); msg_words++; num_msg_words -= 2; @@ -259,7 +259,7 @@ static l4_msgtag_t copy_msgbuf_to_utcb(Msgbuf_base &snd_msg, Rpc_exception_code Genode::ipc_call(Native_capability dst, Msgbuf_base &snd_msg, Msgbuf_base &rcv_msg, - size_t rcv_caps) + size_t) { Receive_window rcv_window; rcv_window.init(); @@ -269,7 +269,7 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst, l4_msgtag_t const call_tag = copy_msgbuf_to_utcb(snd_msg, dst.local_name()); addr_t rcv_cap_sel = rcv_window.rcv_cap_sel_base(); - for (int i = 0; i < Msgbuf_base::MAX_CAPS_PER_MSG; i++) { + for (size_t i = 0; i < Msgbuf_base::MAX_CAPS_PER_MSG; i++) { l4_utcb_br()->br[i] = rcv_cap_sel | L4_RCV_ITEM_SINGLE_CAP; rcv_cap_sel += L4_CAP_SIZE; } @@ -300,7 +300,7 @@ static bool badge_matches_label(unsigned long badge, unsigned long label) } -void Genode::ipc_reply(Native_capability caller, Rpc_exception_code exc, +void Genode::ipc_reply(Native_capability, Rpc_exception_code exc, Msgbuf_base &snd_msg) { l4_msgtag_t tag = copy_msgbuf_to_utcb(snd_msg, exc.value); @@ -311,7 +311,7 @@ void Genode::ipc_reply(Native_capability caller, Rpc_exception_code exc, } -Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller, +Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &, Rpc_exception_code exc, Msgbuf_base &reply_msg, Msgbuf_base &request_msg) @@ -324,7 +324,7 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller, /* prepare receive window in UTCB */ addr_t rcv_cap_sel = rcv_window.rcv_cap_sel_base(); - for (int i = 0; i < Msgbuf_base::MAX_CAPS_PER_MSG; i++) { + for (size_t i = 0; i < Msgbuf_base::MAX_CAPS_PER_MSG; i++) { l4_utcb_br()->br[i] = rcv_cap_sel | L4_RCV_ITEM_SINGLE_CAP; rcv_cap_sel += L4_CAP_SIZE; } diff --git a/repos/base-foc/src/lib/base/signal_source_client.cc b/repos/base-foc/src/lib/base/signal_source_client.cc index e91e700b6..7387762a1 100644 --- a/repos/base-foc/src/lib/base/signal_source_client.cc +++ b/repos/base-foc/src/lib/base/signal_source_client.cc @@ -34,12 +34,12 @@ using namespace Genode; Signal_source_client::Signal_source_client(Capability cap) : - Rpc_client(static_cap_cast(cap)) -{ - using namespace Fiasco; + Rpc_client(static_cap_cast(cap)), /* request mapping of semaphore capability selector */ - _sem = call(); + _sem(call()) +{ + using namespace Fiasco; Foc_native_cpu_client cpu_client(env_deprecated()->cpu_session()->native_cpu()); Native_capability thread_cap = cpu_client.native_cap(Thread::myself()->cap()); diff --git a/repos/base-hw/include/spec/riscv/cpu/cpu_state.h b/repos/base-hw/include/spec/riscv/cpu/cpu_state.h index 9a461fbfe..76d1cab6d 100644 --- a/repos/base-hw/include/spec/riscv/cpu/cpu_state.h +++ b/repos/base-hw/include/spec/riscv/cpu/cpu_state.h @@ -38,9 +38,39 @@ struct Genode::Cpu_state IRQ_FLAG = 1UL << 63, }; - addr_t ip, cpu_exception, ra, sp, gp, tp, t0, t1, t2, s0, s1, a0, a1, a2, - a3, a4, a5, a6, a7, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, t3, - t4, t5, t6; + addr_t ip = 0; + addr_t cpu_exception = 0; + addr_t ra = 0; + addr_t sp = 0; + addr_t gp = 0; + addr_t tp = 0; + addr_t t0 = 0; + addr_t t1 = 0; + addr_t t2 = 0; + addr_t s0 = 0; + addr_t s1 = 0; + addr_t a0 = 0; + addr_t a1 = 0; + addr_t a2 = 0; + addr_t a3 = 0; + addr_t a4 = 0; + addr_t a5 = 0; + addr_t a6 = 0; + addr_t a7 = 0; + addr_t s2 = 0; + addr_t s3 = 0; + addr_t s4 = 0; + addr_t s5 = 0; + addr_t s6 = 0; + addr_t s7 = 0; + addr_t s8 = 0; + addr_t s9 = 0; + addr_t s10 = 0; + addr_t s11 = 0; + addr_t t3 = 0; + addr_t t4 = 0; + addr_t t5 = 0; + addr_t t6 = 0; bool is_irq() { return cpu_exception & IRQ_FLAG; } unsigned irq() { return cpu_exception ^ IRQ_FLAG; } diff --git a/repos/base-hw/include/spec/x86_64/muen/sinfo.h b/repos/base-hw/include/spec/x86_64/muen/sinfo.h index 6815966fa..b83705adc 100644 --- a/repos/base-hw/include/spec/x86_64/muen/sinfo.h +++ b/repos/base-hw/include/spec/x86_64/muen/sinfo.h @@ -92,7 +92,7 @@ class Genode::Sinfo * * The function returns NULL if the subject name cannot be retrieved. */ - const char * const get_subject_name(void); + const char * get_subject_name(void); /* * Return information for a channel given by name. @@ -180,8 +180,8 @@ class Genode::Sinfo private: - subject_info_type * sinfo; - scheduling_info_type * sched_info; + subject_info_type * sinfo = nullptr; + scheduling_info_type * sched_info = nullptr; char subject_name[MAX_NAME_LENGTH + 1]; bool subject_name_set = false; diff --git a/repos/base-hw/src/bootstrap/platform.h b/repos/base-hw/src/bootstrap/platform.h index 379cc8f08..7b1047c83 100644 --- a/repos/base-hw/src/bootstrap/platform.h +++ b/repos/base-hw/src/bootstrap/platform.h @@ -42,11 +42,11 @@ class Bootstrap::Platform struct Board { - Memory_region_array early_ram_regions; - Memory_region_array late_ram_regions; + Memory_region_array early_ram_regions { }; + Memory_region_array late_ram_regions { }; Mmio_space const core_mmio; - Hw::Acpi_rsdp acpi_rsdp; - Hw::Framebuffer framebuffer; + Hw::Acpi_rsdp acpi_rsdp { }; + Hw::Framebuffer framebuffer { }; Board(); }; @@ -97,7 +97,7 @@ class Bootstrap::Platform void * const array_base; Table & table; Table_array & array; - Boot_info::Mapping_pool mappings; + Boot_info::Mapping_pool mappings { }; Pd(Ram_allocator & alloc); @@ -121,10 +121,10 @@ class Bootstrap::Platform } }; - Board board; - Bootstrap::Cpu cpu; - Bootstrap::Pic pic; - Ram_allocator ram_alloc; + Board board { }; + Bootstrap::Cpu cpu { }; + Bootstrap::Pic pic { }; + Ram_allocator ram_alloc { }; Memory_region const bootstrap_region; Genode::Constructible core_pd; addr_t core_elf_addr; diff --git a/repos/base-hw/src/bootstrap/spec/arm/cortex_a9_mmu.cc b/repos/base-hw/src/bootstrap/spec/arm/cortex_a9_mmu.cc index 24c2b3943..14ccb0340 100644 --- a/repos/base-hw/src/bootstrap/spec/arm/cortex_a9_mmu.cc +++ b/repos/base-hw/src/bootstrap/spec/arm/cortex_a9_mmu.cc @@ -29,7 +29,7 @@ class Cpu_counter { private: - Hw::Spin_lock _lock; + Hw::Spin_lock _lock { }; volatile int _value = 0; public: diff --git a/repos/base-hw/src/bootstrap/spec/imx53_qsb/platform.cc b/repos/base-hw/src/bootstrap/spec/imx53_qsb/platform.cc index 84aad353a..0390d312b 100644 --- a/repos/base-hw/src/bootstrap/spec/imx53_qsb/platform.cc +++ b/repos/base-hw/src/bootstrap/spec/imx53_qsb/platform.cc @@ -16,7 +16,7 @@ using namespace Board; -bool Board::secure_irq(unsigned i) { return true; } +bool Board::secure_irq(unsigned) { return true; } Bootstrap::Platform::Board::Board() diff --git a/repos/base-hw/src/bootstrap/spec/panda/platform.cc b/repos/base-hw/src/bootstrap/spec/panda/platform.cc index be386ff47..d307acfc4 100644 --- a/repos/base-hw/src/bootstrap/spec/panda/platform.cc +++ b/repos/base-hw/src/bootstrap/spec/panda/platform.cc @@ -25,8 +25,7 @@ Bootstrap::Platform::Board::Board() PL310_MMIO_SIZE }) { } -bool Bootstrap::Cpu::errata(Bootstrap::Cpu::Errata err) { - return false; } +bool Bootstrap::Cpu::errata(Bootstrap::Cpu::Errata) { return false; } void Bootstrap::Cpu::wake_up_all_cpus(void * const ip) diff --git a/repos/base-hw/src/bootstrap/spec/pbxa9/platform.cc b/repos/base-hw/src/bootstrap/spec/pbxa9/platform.cc index 07da434d4..0be44b8cf 100644 --- a/repos/base-hw/src/bootstrap/spec/pbxa9/platform.cc +++ b/repos/base-hw/src/bootstrap/spec/pbxa9/platform.cc @@ -27,8 +27,7 @@ Bootstrap::Platform::Board::Board() PL310_MMIO_SIZE }) { } -bool Bootstrap::Cpu::errata(Bootstrap::Cpu::Errata err) { - return false; } +bool Bootstrap::Cpu::errata(Bootstrap::Cpu::Errata) { return false; } void Bootstrap::Cpu::wake_up_all_cpus(void * const ip) diff --git a/repos/base-hw/src/bootstrap/spec/riscv/board.h b/repos/base-hw/src/bootstrap/spec/riscv/board.h index 29d6105be..5f5a57e00 100644 --- a/repos/base-hw/src/bootstrap/spec/riscv/board.h +++ b/repos/base-hw/src/bootstrap/spec/riscv/board.h @@ -33,8 +33,7 @@ namespace Board { } template -void Sv39::Level_x_translation_table::_translation_added(addr_t addr, - size_t size) +void Sv39::Level_x_translation_table::_translation_added(addr_t, size_t) { } #endif /* _SRC__BOOTSTRAP__SPEC__RISCV__BOARD_H_ */ diff --git a/repos/base-hw/src/bootstrap/spec/riscv/platform.cc b/repos/base-hw/src/bootstrap/spec/riscv/platform.cc index ea1e7392a..278d94bd7 100644 --- a/repos/base-hw/src/bootstrap/spec/riscv/platform.cc +++ b/repos/base-hw/src/bootstrap/spec/riscv/platform.cc @@ -17,7 +17,7 @@ using namespace Board; Bootstrap::Platform::Board::Board() -: early_ram_regions(Memory_region { RAM_0_BASE, RAM_0_SIZE } ) {} +: early_ram_regions(Memory_region { RAM_0_BASE, RAM_0_SIZE } ), core_mmio() {} unsigned Bootstrap::Platform::enable_mmu() diff --git a/repos/base-hw/src/bootstrap/spec/rpi/board.h b/repos/base-hw/src/bootstrap/spec/rpi/board.h index 37d0e075a..71f2b2059 100644 --- a/repos/base-hw/src/bootstrap/spec/rpi/board.h +++ b/repos/base-hw/src/bootstrap/spec/rpi/board.h @@ -39,8 +39,7 @@ constexpr unsigned Hw::Page_table::Descriptor_base::_device_tex() { constexpr bool Hw::Page_table::Descriptor_base::_smp() { return false; } -void Hw::Page_table::_translation_added(unsigned long addr, - unsigned long size) { +void Hw::Page_table::_translation_added(unsigned long, unsigned long) { Bootstrap::Cpu::clean_invalidate_data_cache(); } #endif /* _SRC__BOOTSTRAP__SPEC__RPI__BOARD_H_ */ diff --git a/repos/base-hw/src/bootstrap/spec/zynq_qemu/platform.cc b/repos/base-hw/src/bootstrap/spec/zynq_qemu/platform.cc index 19a8b15c0..fb74143bb 100644 --- a/repos/base-hw/src/bootstrap/spec/zynq_qemu/platform.cc +++ b/repos/base-hw/src/bootstrap/spec/zynq_qemu/platform.cc @@ -29,5 +29,5 @@ Bootstrap::Platform::Board::Board() PL310_MMIO_SIZE }) { } -bool Bootstrap::Cpu::errata(Bootstrap::Cpu::Errata err) { +bool Bootstrap::Cpu::errata(Bootstrap::Cpu::Errata) { return false; } diff --git a/repos/base-hw/src/core/core_region_map.cc b/repos/base-hw/src/core/core_region_map.cc index eaae88262..04757feca 100644 --- a/repos/base-hw/src/core/core_region_map.cc +++ b/repos/base-hw/src/core/core_region_map.cc @@ -26,7 +26,7 @@ using namespace Genode; Region_map::Local_addr Core_region_map::attach(Dataspace_capability ds_cap, size_t size, off_t offset, bool use_local_addr, - Region_map::Local_addr, bool executable) + Region_map::Local_addr, bool) { auto lambda = [&] (Dataspace_component *ds) -> Local_addr { if (!ds) diff --git a/repos/base-hw/src/core/cpu_thread_allocator.h b/repos/base-hw/src/core/cpu_thread_allocator.h index cfba45c57..c57eab0b8 100644 --- a/repos/base-hw/src/core/cpu_thread_allocator.h +++ b/repos/base-hw/src/core/cpu_thread_allocator.h @@ -28,7 +28,15 @@ namespace Genode */ class Cpu_thread_allocator : public Allocator { - Allocator * const _alloc; + private: + + /* + * Noncopyable + */ + Cpu_thread_allocator(Cpu_thread_allocator const &); + Cpu_thread_allocator &operator = (Cpu_thread_allocator const &); + + Allocator * const _alloc; public: @@ -56,7 +64,7 @@ namespace Genode return 0; } - size_t overhead(size_t size) const override + size_t overhead(size_t) const override { warning(__func__, "unexpectedly called"); while (1) ; diff --git a/repos/base-hw/src/core/io_mem_session_support.cc b/repos/base-hw/src/core/io_mem_session_support.cc index ec82bce58..90dde90a6 100644 --- a/repos/base-hw/src/core/io_mem_session_support.cc +++ b/repos/base-hw/src/core/io_mem_session_support.cc @@ -18,9 +18,8 @@ using namespace Genode; -void Io_mem_session_component::_unmap_local(addr_t base, size_t size) { } +void Io_mem_session_component::_unmap_local(addr_t, size_t) { } -addr_t Io_mem_session_component::_map_local(addr_t base, size_t size) -{ return base; } +addr_t Io_mem_session_component::_map_local(addr_t base, size_t) { return base; } diff --git a/repos/base-hw/src/core/irq_session_component.h b/repos/base-hw/src/core/irq_session_component.h index 5d7ff8816..e21aa5ddb 100644 --- a/repos/base-hw/src/core/irq_session_component.h +++ b/repos/base-hw/src/core/irq_session_component.h @@ -21,22 +21,29 @@ #include -namespace Genode { - class Irq_session_component; -} +namespace Genode { class Irq_session_component; } -class Genode::Irq_session_component : public Rpc_object, - public List::Element + +class Genode::Irq_session_component : public Rpc_object, + private List::Element { private: + friend class List; + + /* + * Noncopyable + */ + Irq_session_component(Irq_session_component const &); + Irq_session_component &operator = (Irq_session_component const &); + unsigned _irq_number; Range_allocator *_irq_alloc; Genode::uint8_t _kernel_object[sizeof(Kernel::User_irq)]; bool _is_msi; addr_t _address, _value; - Signal_context_capability _sig_cap; + Signal_context_capability _sig_cap { }; unsigned _find_irq_number(const char * const args); @@ -65,9 +72,9 @@ class Genode::Irq_session_component : public Rpc_object, Info info() override { - if (!_is_msi) { - return { .type = Info::Type::INVALID }; - } + if (!_is_msi) + return { .type = Info::Type::INVALID, .address = 0, .value = 0 }; + return { .type = Info::Type::MSI, .address = _address, .value = _value }; diff --git a/repos/base-hw/src/core/kernel/cpu.cc b/repos/base-hw/src/core/kernel/cpu.cc index 5b87b1943..d7267b38a 100644 --- a/repos/base-hw/src/core/kernel/cpu.cc +++ b/repos/base-hw/src/core/kernel/cpu.cc @@ -74,7 +74,7 @@ void Cpu_job::_yield() } -void Cpu_job::_interrupt(unsigned const cpu_id) +void Cpu_job::_interrupt(unsigned const /* cpu_id */) { /* determine handling for specific interrupt */ unsigned irq_id; @@ -149,8 +149,8 @@ time_t Cpu::timeout_max_us() const { return _timer.timeout_max_us(); } void Cpu::schedule(Job * const job) { - if (_id == executing_id()) { _scheduler.ready(job); } - else if (_scheduler.ready_check(job)) { trigger_ip_interrupt(); } + if (_id == executing_id()) { _scheduler.ready(&job->share()); } + else if (_scheduler.ready_check(&job->share())) { trigger_ip_interrupt(); } } diff --git a/repos/base-hw/src/core/kernel/cpu.h b/repos/base-hw/src/core/kernel/cpu.h index 6f14308e2..42187acbe 100644 --- a/repos/base-hw/src/core/kernel/cpu.h +++ b/repos/base-hw/src/core/kernel/cpu.h @@ -38,7 +38,37 @@ namespace Kernel Cpu_pool * cpu_pool(); } -class Kernel::Cpu : public Genode::Cpu, public Irq::Pool, private Timeout + +/* + * The 'Cpu' class violates the "Effective C++" practices because it publicly + * inherits the 'Genode::Cpu' base class, which does not have a virtual + * destructor. Since 'Cpu' implements the 'Timeout' interface, however, it has + * a vtable. + * + * Adding a virtual destructor in the base class would be unnatural as the base + * class hierarchy does not represent an abstract interface. + * + * Inheriting the 'Genode::Cpu' class privately is not an option because the + * user of 'Cpu' class expects architecture-specific register definitions to be + * provided by 'Cpu'. Hence, all those architecture- specific definitions would + * end up as 'using' clauses in the generic class. + * + * XXX Remove the disabled warning, e.g., by one of the following approaches: + * + * * Prevent 'Cpu' to have virtual methods by making 'Timeout' a member instead + * of a base class. + * + * * Change the class hierarchy behind 'Genode::Cpu' such that + * architecture-specific bits do no longer need to implicitly become part + * of the public interface of 'Cpu'. For example, register-definition types + * could all be embedded in an 'Arch_regs' type, which the 'Cpu' class could + * publicly provide via a 'typedef Genode::Cpu::Arch_regs Arch_regs'. + * Then, the 'Genode::Cpu' could be inherited privately. + */ +#pragma GCC diagnostic ignored "-Wnon-virtual-dtor" + + +class Kernel::Cpu : public Genode::Cpu, private Irq::Pool, private Timeout { private: @@ -156,8 +186,17 @@ class Kernel::Cpu : public Genode::Cpu, public Irq::Pool, private Timeout time_t us_to_ticks(time_t const us) const { return _timer.us_to_ticks(us); }; unsigned timer_interrupt_id() const { return _timer.interrupt_id(); } + + Irq::Pool &irq_pool() { return *this; } }; + +/* + * See the comment above the 'Cpu' class definition. + */ +#pragma GCC diagnostic pop + + class Kernel::Cpu_pool { private: diff --git a/repos/base-hw/src/core/kernel/cpu_context.h b/repos/base-hw/src/core/kernel/cpu_context.h index 44942c96d..b34aa127e 100644 --- a/repos/base-hw/src/core/kernel/cpu_context.h +++ b/repos/base-hw/src/core/kernel/cpu_context.h @@ -34,14 +34,15 @@ namespace Kernel class Cpu_domain_update; } -class Kernel::Cpu_domain_update : public Double_list_item +class Kernel::Cpu_domain_update : private Double_list_item { friend class Cpu_domain_update_list; + friend class Kernel::Double_list_typed; private: bool _pending[NR_OF_CPUS]; - unsigned _domain_id; + unsigned _domain_id = 0; /** * Domain-update back-end @@ -57,6 +58,8 @@ class Kernel::Cpu_domain_update : public Double_list_item Cpu_domain_update(); + virtual ~Cpu_domain_update() { }; + /** * Do an update of domain 'id' on all CPUs and return if this blocks */ @@ -68,8 +71,18 @@ class Kernel::Cpu_domain_update : public Double_list_item virtual void _cpu_domain_update_unblocks() = 0; }; -class Kernel::Cpu_job : public Cpu_share +class Kernel::Cpu_job : private Cpu_share { + private: + + friend class Cpu; /* static_cast from 'Cpu_share' to 'Cpu_job' */ + + /* + * Noncopyable + */ + Cpu_job(Cpu_job const &); + Cpu_job &operator = (Cpu_job const &); + protected: Cpu * _cpu; @@ -124,7 +137,7 @@ class Kernel::Cpu_job : public Cpu_share /** * Destructor */ - ~Cpu_job(); + virtual ~Cpu_job(); /** * Link job to CPU 'cpu' @@ -154,6 +167,8 @@ class Kernel::Cpu_job : public Cpu_share ***************/ void cpu(Cpu * const cpu) { _cpu = cpu; } + + Cpu_share &share() { return *this; } }; #endif /* _CORE__KERNEL__CPU_CONTEXT_H_ */ diff --git a/repos/base-hw/src/core/kernel/cpu_scheduler.h b/repos/base-hw/src/core/kernel/cpu_scheduler.h index a39183011..39ce8c257 100644 --- a/repos/base-hw/src/core/kernel/cpu_scheduler.h +++ b/repos/base-hw/src/core/kernel/cpu_scheduler.h @@ -88,8 +88,8 @@ class Kernel::Cpu_share : public Cpu_claim, public Cpu_fill signed const _prio; unsigned _quota; unsigned _claim; - unsigned _fill; - bool _ready; + unsigned _fill = 0; + bool _ready = false; public: @@ -100,7 +100,7 @@ class Kernel::Cpu_share : public Cpu_claim, public Cpu_fill * \param q claimed quota */ Cpu_share(signed const p, unsigned const q) - : _prio(p), _quota(q), _claim(q), _ready(0) { } + : _prio(p), _quota(q), _claim(q) { } /* * Accessors @@ -123,11 +123,11 @@ class Kernel::Cpu_scheduler Claim_list _rcl[Prio::MAX + 1]; /* ready claims */ Claim_list _ucl[Prio::MAX + 1]; /* unready claims */ - Fill_list _fills; /* ready fills */ + Fill_list _fills { }; /* ready fills */ Share * const _idle; - Share * _head; - unsigned _head_quota; - bool _head_claims; + Share * _head = nullptr; + unsigned _head_quota = 0; + bool _head_claims = false; bool _head_yields; unsigned const _quota; unsigned _residual; diff --git a/repos/base-hw/src/core/kernel/double_list.h b/repos/base-hw/src/core/kernel/double_list.h index c6cdc5d81..6ee4deb41 100644 --- a/repos/base-hw/src/core/kernel/double_list.h +++ b/repos/base-hw/src/core/kernel/double_list.h @@ -38,8 +38,8 @@ class Kernel::Double_list_item private: - Double_list_item * _next; - Double_list_item * _prev; + Double_list_item * _next = nullptr; + Double_list_item * _prev = nullptr; }; class Kernel::Double_list diff --git a/repos/base-hw/src/core/kernel/ipc_node.h b/repos/base-hw/src/core/kernel/ipc_node.h index 893227699..c52d5d446 100644 --- a/repos/base-hw/src/core/kernel/ipc_node.h +++ b/repos/base-hw/src/core/kernel/ipc_node.h @@ -39,7 +39,7 @@ namespace Kernel using Ipc_node_queue = Kernel::Fifo; } -class Kernel::Ipc_node : public Ipc_node_queue::Element +class Kernel::Ipc_node : private Ipc_node_queue::Element { protected: @@ -55,6 +55,8 @@ class Kernel::Ipc_node : public Ipc_node_queue::Element private: friend class Core_thread; + friend class Kernel::Fifo; + friend class Genode::Fifo; State _state = INACTIVE; capid_t _capid = cap_id_invalid(); @@ -63,7 +65,7 @@ class Kernel::Ipc_node : public Ipc_node_queue::Element bool _help = false; size_t _rcv_caps = 0; /* max capability num to receive */ Genode::Native_utcb * _utcb = nullptr; - Ipc_node_queue _request_queue; + Ipc_node_queue _request_queue { }; /* pre-allocation array for obkject identity references */ void * _obj_id_ref_ptr[Genode::Msgbuf_base::MAX_CAPS_PER_MSG]; @@ -137,7 +139,7 @@ class Kernel::Ipc_node : public Ipc_node_queue::Element protected: - Pd * _pd; /* pointer to PD this IPC node is part of */ + Pd * _pd = nullptr; /* pointer to PD this IPC node is part of */ /*************** @@ -149,7 +151,7 @@ class Kernel::Ipc_node : public Ipc_node_queue::Element public: - ~Ipc_node(); + virtual ~Ipc_node(); /** * Send a request and wait for the according reply @@ -200,8 +202,8 @@ class Kernel::Ipc_node : public Ipc_node_queue::Element ** Accessors ** ***************/ - Pd * const pd() const { return _pd; } - Genode::Native_utcb * utcb() { return _utcb; } + Pd *pd() const { return _pd; } + Genode::Native_utcb *utcb() { return _utcb; } }; #endif /* _CORE__KERNEL__IPC_NODE_H_ */ diff --git a/repos/base-hw/src/core/kernel/irq.h b/repos/base-hw/src/core/kernel/irq.h index e5f237777..5f1785172 100644 --- a/repos/base-hw/src/core/kernel/irq.h +++ b/repos/base-hw/src/core/kernel/irq.h @@ -47,8 +47,11 @@ namespace Genode } -class Kernel::Irq : public Genode::Avl_node +class Kernel::Irq : Genode::Avl_node { + friend class Genode::Avl_tree; + friend class Genode::Avl_node; + public: struct Pool : Genode::Avl_tree diff --git a/repos/base-hw/src/core/kernel/kernel.cc b/repos/base-hw/src/core/kernel/kernel.cc index 7eb7809db..c94b233cc 100644 --- a/repos/base-hw/src/core/kernel/kernel.cc +++ b/repos/base-hw/src/core/kernel/kernel.cc @@ -28,7 +28,7 @@ extern "C" void kernel() void Kernel::Cpu::Ipi::occurred() { } -void Kernel::Cpu::Ipi::trigger(unsigned const cpu_id) { } +void Kernel::Cpu::Ipi::trigger(unsigned) { } Kernel::Cpu::Ipi::Ipi(Kernel::Irq::Pool &p) : Kernel::Irq(Kernel::Pic::IPI, p) { } diff --git a/repos/base-hw/src/core/kernel/object.h b/repos/base-hw/src/core/kernel/object.h index 55cce9a82..fe5cc9645 100644 --- a/repos/base-hw/src/core/kernel/object.h +++ b/repos/base-hw/src/core/kernel/object.h @@ -71,8 +71,11 @@ namespace Kernel } -struct Kernel::Object : public Kernel::Object_identity_list +struct Kernel::Object : private Object_identity_list { + using Object_identity_list::remove; + using Object_identity_list::insert; + virtual ~Object(); }; @@ -83,6 +86,12 @@ class Kernel::Object_identity { private: + /* + * Noncopyable + */ + Object_identity(Object_identity const &); + Object_identity &operator = (Object_identity const &); + Object * _object = nullptr; public: @@ -103,6 +112,12 @@ class Kernel::Object_identity_reference { private: + /* + * Noncopyable + */ + Object_identity_reference(Object_identity_reference const &); + Object_identity_reference &operator = (Object_identity_reference const &); + capid_t _capid; Object_identity *_identity; Pd &_pd; @@ -181,13 +196,16 @@ class Kernel::Core_object_identity : public Object_identity, template -class Kernel::Core_object : public T, public Kernel::Core_object_identity +class Kernel::Core_object : public T, Kernel::Core_object_identity { public: template Core_object(ARGS &&... args) : T(args...), Core_object_identity(*static_cast(this)) { } + + using Kernel::Core_object_identity::core_capid; + using Kernel::Core_object_identity::capid; }; #endif /* _CORE__KERNEL__OBJECT_H_ */ diff --git a/repos/base-hw/src/core/kernel/pd.h b/repos/base-hw/src/core/kernel/pd.h index 42aec8ba9..1214b1f37 100644 --- a/repos/base-hw/src/core/kernel/pd.h +++ b/repos/base-hw/src/core/kernel/pd.h @@ -45,14 +45,20 @@ class Kernel::Pd : public Kernel::Object private: + /* + * Noncopyable + */ + Pd(Pd const &); + Pd &operator = (Pd const &); + Hw::Page_table * const _table; Genode::Platform_pd * const _platform_pd; - Capid_allocator _capid_alloc; - Object_identity_reference_tree _cap_tree; + Capid_allocator _capid_alloc { }; + Object_identity_reference_tree _cap_tree { }; public: - Genode::Cpu::Mmu_context mmu_regs; + Genode::Cpu::Mmu_context mmu_regs; /** * Constructor diff --git a/repos/base-hw/src/core/kernel/signal_receiver.h b/repos/base-hw/src/core/kernel/signal_receiver.h index c4f6d8e1f..d25925846 100644 --- a/repos/base-hw/src/core/kernel/signal_receiver.h +++ b/repos/base-hw/src/core/kernel/signal_receiver.h @@ -50,6 +50,12 @@ class Kernel::Signal_handler private: + /* + * Noncopyable + */ + Signal_handler(Signal_handler const &); + Signal_handler &operator = (Signal_handler const &); + typedef Genode::Fifo_element Fifo_element; Fifo_element _handlers_fe; @@ -95,6 +101,12 @@ class Kernel::Signal_context_killer private: + /* + * Noncopyable + */ + Signal_context_killer(Signal_context_killer const &); + Signal_context_killer &operator = (Signal_context_killer const &); + Signal_context * _context; /** @@ -138,6 +150,12 @@ class Kernel::Signal_context : public Kernel::Object private: + /* + * Noncopyable + */ + Signal_context(Signal_context const &); + Signal_context &operator = (Signal_context const &); + typedef Genode::Fifo_element Fifo_element; Fifo_element _deliver_fe; @@ -243,9 +261,9 @@ class Kernel::Signal_receiver : public Kernel::Object template class Fifo : public Genode::Fifo { }; - Fifo _handlers; - Fifo _deliver; - Fifo _contexts; + Fifo _handlers { }; + Fifo _deliver { }; + Fifo _contexts { }; /** * Recognize that context 'c' has submits to deliver diff --git a/repos/base-hw/src/core/kernel/thread.h b/repos/base-hw/src/core/kernel/thread.h index d7534949a..2797eb6ef 100644 --- a/repos/base-hw/src/core/kernel/thread.h +++ b/repos/base-hw/src/core/kernel/thread.h @@ -51,6 +51,14 @@ class Kernel::Thread public Ipc_node, public Signal_context_killer, public Signal_handler, private Timeout { + private: + + /* + * Noncopyable + */ + Thread(Thread const &); + Thread &operator = (Thread const &); + protected: enum { START_VERBOSE = 0 }; @@ -67,7 +75,7 @@ class Kernel::Thread }; Signal_context * _pager = nullptr; - Thread_fault _fault; + Thread_fault _fault { }; State _state; Signal_receiver * _signal_receiver; char const * const _label; diff --git a/repos/base-hw/src/core/kernel/timer.h b/repos/base-hw/src/core/kernel/timer.h index f51c5aeac..3518244d7 100644 --- a/repos/base-hw/src/core/kernel/timer.h +++ b/repos/base-hw/src/core/kernel/timer.h @@ -32,16 +32,17 @@ namespace Kernel /** * A timeout causes a kernel pass and the call of a timeout specific handle */ -class Kernel::Timeout : public Genode::List::Element +class Kernel::Timeout : Genode::List::Element { friend class Timer; + friend class Genode::List; private: - bool _listed = false; - time_t _start; - time_t _end; - bool _end_period; + bool _listed = false; + time_t _start = 0; + time_t _end = 0; + bool _end_period = false; public: diff --git a/repos/base-hw/src/core/kernel/vm.h b/repos/base-hw/src/core/kernel/vm.h index dedb3bda1..83a706312 100644 --- a/repos/base-hw/src/core/kernel/vm.h +++ b/repos/base-hw/src/core/kernel/vm.h @@ -36,9 +36,15 @@ class Kernel::Vm : public Cpu_job, { private: + /* + * Noncopyable + */ + Vm(Vm const &); + Vm &operator = (Vm const &); + enum State { ACTIVE, INACTIVE }; - unsigned _id; + unsigned _id = 0; Genode::Vm_state * const _state; Signal_context * const _context; void * const _table; diff --git a/repos/base-hw/src/core/native_pd_component.cc b/repos/base-hw/src/core/native_pd_component.cc index 7e00e26c8..a8193b1e4 100644 --- a/repos/base-hw/src/core/native_pd_component.cc +++ b/repos/base-hw/src/core/native_pd_component.cc @@ -22,11 +22,8 @@ void Native_pd_component::upgrade_cap_slab() { } -Native_pd_component::Native_pd_component(Pd_session_component &pd_session, - char const *args) -: _pd_session(pd_session) { - _pd_session._ep.manage(this); } +Native_pd_component::Native_pd_component(Pd_session_component &pd, char const *) +: _pd_session(pd) { _pd_session._ep.manage(this); } -Native_pd_component::~Native_pd_component() { - _pd_session._ep.dissolve(this); } +Native_pd_component::~Native_pd_component() { _pd_session._ep.dissolve(this); } diff --git a/repos/base-hw/src/core/object.h b/repos/base-hw/src/core/object.h index 667dbbb2e..9cfada59f 100644 --- a/repos/base-hw/src/core/object.h +++ b/repos/base-hw/src/core/object.h @@ -44,7 +44,7 @@ class Genode::Kernel_object protected: - Untyped_capability _cap; + Untyped_capability _cap { }; public: diff --git a/repos/base-hw/src/core/pager.h b/repos/base-hw/src/core/pager.h index d25c38aca..2c4606191 100644 --- a/repos/base-hw/src/core/pager.h +++ b/repos/base-hw/src/core/pager.h @@ -80,8 +80,9 @@ class Genode::Ipc_pager { protected: - Kernel::Thread_fault _fault; - Mapping _mapping; + Kernel::Thread_fault _fault { }; + + Mapping _mapping { }; public: @@ -112,10 +113,11 @@ class Genode::Ipc_pager }; -class Genode::Pager_object : public Object_pool::Entry, - public Genode::Kernel_object +class Genode::Pager_object : private Object_pool::Entry, + private Genode::Kernel_object { friend class Pager_entrypoint; + friend class Object_pool; private: @@ -186,13 +188,15 @@ class Genode::Pager_object : public Object_pool::Entry, Cpu_session_capability cpu_session_cap() const { return _cpu_session_cap; } Thread_capability thread_cap() const { return _thread_cap; } + + using Object_pool::Entry::cap; }; -class Genode::Pager_entrypoint : public Object_pool, - public Thread_deprecated, - public Kernel_object, - public Ipc_pager +class Genode::Pager_entrypoint : public Object_pool, + public Thread_deprecated, + private Kernel_object, + private Ipc_pager { public: diff --git a/repos/base-hw/src/core/platform.cc b/repos/base-hw/src/core/platform.cc index 4fd5b1bcb..42d6b7e44 100644 --- a/repos/base-hw/src/core/platform.cc +++ b/repos/base-hw/src/core/platform.cc @@ -188,6 +188,6 @@ bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr, return ::map_local(phys_addr, virt_addr, size / get_page_size()); } -bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t phys_addr, +bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t, unsigned size) { return ::unmap_local(virt_addr, size / get_page_size()); } diff --git a/repos/base-hw/src/core/platform.h b/repos/base-hw/src/core/platform.h index 8537b5f29..302c0129d 100644 --- a/repos/base-hw/src/core/platform.h +++ b/repos/base-hw/src/core/platform.h @@ -39,11 +39,11 @@ class Genode::Platform : public Genode::Platform_generic { private: - Core_mem_allocator _core_mem_alloc; /* core-accessible memory */ - Phys_allocator _io_mem_alloc; /* MMIO allocator */ - Phys_allocator _io_port_alloc; /* I/O port allocator */ - Phys_allocator _irq_alloc; /* IRQ allocator */ - Rom_fs _rom_fs; /* ROM file system */ + Core_mem_allocator _core_mem_alloc { }; /* core-accessible memory */ + Phys_allocator _io_mem_alloc; /* MMIO allocator */ + Phys_allocator _io_port_alloc; /* I/O port allocator */ + Phys_allocator _irq_alloc; /* IRQ allocator */ + Rom_fs _rom_fs { }; /* ROM file system */ static Hw::Boot_info const & _boot_info(); static Hw::Memory_region_array const & _core_virt_regions(); diff --git a/repos/base-hw/src/core/platform_pd.cc b/repos/base-hw/src/core/platform_pd.cc index 81b0606cc..cbabbf6aa 100644 --- a/repos/base-hw/src/core/platform_pd.cc +++ b/repos/base-hw/src/core/platform_pd.cc @@ -149,7 +149,7 @@ Platform_pd::Platform_pd(Page_table & tt, _label("core") { } -Platform_pd::Platform_pd(Allocator * md_alloc, char const *label) +Platform_pd::Platform_pd(Allocator *, char const *label) : Hw::Address_space(*kernel_object()), Kernel_object(true, (Page_table*)translation_table_phys(), this), _label(label) diff --git a/repos/base-hw/src/core/platform_pd.h b/repos/base-hw/src/core/platform_pd.h index 6fbd20d6d..6df3b4b8e 100644 --- a/repos/base-hw/src/core/platform_pd.h +++ b/repos/base-hw/src/core/platform_pd.h @@ -60,16 +60,23 @@ class Hw::Address_space : public Genode::Address_space { private: + /* + * Noncopyable + */ + Address_space(Address_space const &); + Address_space &operator = (Address_space const &); + friend class Genode::Platform; friend class Genode::Mapped_mem_allocator; using Table = Hw::Page_table; using Array = Table::Allocator::Array; - Genode::Lock _lock; /* table lock */ - Table & _tt; /* table virt addr */ - Genode::addr_t _tt_phys; /* table phys addr */ + + Genode::Lock _lock { }; /* table lock */ + Table & _tt; /* table virt addr */ + Genode::addr_t _tt_phys; /* table phys addr */ Array * _tt_array = nullptr; - Table::Allocator & _tt_alloc; /* table allocator */ + Table::Allocator & _tt_alloc; /* table allocator */ Kernel::Pd & _kernel_pd; static inline Genode::Core_mem_allocator * _cma(); @@ -77,7 +84,6 @@ class Hw::Address_space : public Genode::Address_space protected: - /** * Core-specific constructor * @@ -153,13 +159,19 @@ class Genode::Cap_space }; -class Genode::Platform_pd : public Hw::Address_space, - public Genode::Cap_space, - public Kernel_object +class Genode::Platform_pd : public Hw::Address_space, + private Cap_space, + private Kernel_object { private: - Native_capability _parent; + /* + * Noncopyable + */ + Platform_pd(Platform_pd const &); + Platform_pd &operator = (Platform_pd const &); + + Native_capability _parent { }; bool _thread_associated = false; char const * const _label; @@ -188,6 +200,9 @@ class Genode::Platform_pd : public Hw::Address_space, */ ~Platform_pd(); + using Cap_space::capability_slab; + using Cap_space::upgrade_slab; + /** * Bind thread 't' to protection domain */ @@ -198,7 +213,6 @@ class Genode::Platform_pd : public Hw::Address_space, */ void unbind_thread(Platform_thread *t); - /** * Assign parent interface to protection domain */ @@ -209,8 +223,8 @@ class Genode::Platform_pd : public Hw::Address_space, ** Accessors ** ***************/ - char const * const label() { return _label; } - Native_capability parent() { return _parent; } + char const * label() { return _label; } + Native_capability parent() { return _parent; } }; diff --git a/repos/base-hw/src/core/platform_thread.h b/repos/base-hw/src/core/platform_thread.h index f02aa38c7..f75361603 100644 --- a/repos/base-hw/src/core/platform_thread.h +++ b/repos/base-hw/src/core/platform_thread.h @@ -43,15 +43,21 @@ namespace Genode { */ class Platform_thread : public Kernel_object { + /* + * Noncopyable + */ + Platform_thread(Platform_thread const &); + Platform_thread &operator = (Platform_thread const &); + enum { LABEL_MAX_LEN = 32 }; - Platform_pd * _pd; - Weak_ptr _address_space; - Pager_object * _pager; - Native_utcb * _utcb_core_addr; /* UTCB addr in core */ - Native_utcb * _utcb_pd_addr; /* UTCB addr in pd */ - Ram_dataspace_capability _utcb; /* UTCB dataspace */ - char _label[LABEL_MAX_LEN]; + Platform_pd * _pd; + Weak_ptr _address_space { }; + Pager_object * _pager; + Native_utcb * _utcb_core_addr { }; /* UTCB addr in core */ + Native_utcb * _utcb_pd_addr; /* UTCB addr in pd */ + Ram_dataspace_capability _utcb { }; /* UTCB dataspace */ + char _label[LABEL_MAX_LEN]; /* * Wether this thread is the main thread of a program. @@ -63,7 +69,7 @@ namespace Genode { */ bool _main_thread; - Affinity::Location _location; + Affinity::Location _location { }; /** * Common construction part diff --git a/repos/base-hw/src/core/ram_dataspace_support.cc b/repos/base-hw/src/core/ram_dataspace_support.cc index 420820263..8f2b5653e 100644 --- a/repos/base-hw/src/core/ram_dataspace_support.cc +++ b/repos/base-hw/src/core/ram_dataspace_support.cc @@ -25,8 +25,8 @@ using namespace Genode; -void Ram_dataspace_factory::_export_ram_ds(Dataspace_component *ds) { } -void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component *ds) { } +void Ram_dataspace_factory::_export_ram_ds(Dataspace_component *) { } +void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component *) { } void Ram_dataspace_factory::_clear_ds (Dataspace_component * ds) { diff --git a/repos/base-hw/src/core/rpc_cap_factory.h b/repos/base-hw/src/core/rpc_cap_factory.h index c58531061..d98e9d18d 100644 --- a/repos/base-hw/src/core/rpc_cap_factory.h +++ b/repos/base-hw/src/core/rpc_cap_factory.h @@ -43,7 +43,7 @@ class Genode::Rpc_cap_factory { using Identity = Kernel::Core_object_identity; - Native_capability cap; + Native_capability cap { }; uint8_t data[sizeof(Identity)] __attribute__((aligned(sizeof(addr_t)))); @@ -53,8 +53,8 @@ class Genode::Rpc_cap_factory uint8_t _initial_slab_block[get_page_size()]; Slab _slab; - List _list; - Lock _lock; + List _list { }; + Lock _lock { }; public: diff --git a/repos/base-hw/src/core/signal_broker.h b/repos/base-hw/src/core/signal_broker.h index f49b340bd..29460fc76 100644 --- a/repos/base-hw/src/core/signal_broker.h +++ b/repos/base-hw/src/core/signal_broker.h @@ -42,9 +42,9 @@ class Genode::Signal_broker Allocator &_md_alloc; Slab _sources_slab { &_md_alloc }; - Signal_source_pool _sources; + Signal_source_pool _sources { }; Slab _contexts_slab { &_md_alloc }; - Signal_context_pool _contexts; + Signal_context_pool _contexts { }; public: @@ -138,7 +138,7 @@ class Genode::Signal_broker destroy(&_contexts_slab, context); } - void submit(Signal_context_capability cap, unsigned cnt) + void submit(Signal_context_capability, unsigned) { /* * This function is never called as base-hw delivers signals diff --git a/repos/base-hw/src/core/signal_source_component.h b/repos/base-hw/src/core/signal_source_component.h index 4b592163c..1ee8ab150 100644 --- a/repos/base-hw/src/core/signal_source_component.h +++ b/repos/base-hw/src/core/signal_source_component.h @@ -32,9 +32,13 @@ namespace Genode { } -struct Genode::Signal_context_component : Kernel_object, - Signal_context_pool::Entry +struct Genode::Signal_context_component : private Kernel_object, + public Signal_context_pool::Entry { + friend class Object_pool; + + using Signal_context_pool::Entry::cap; + inline Signal_context_component(Signal_source_component &s, addr_t const imprint); @@ -42,9 +46,14 @@ struct Genode::Signal_context_component : Kernel_object, }; -struct Genode::Signal_source_component : Kernel_object, - Signal_source_pool::Entry +struct Genode::Signal_source_component : private Kernel_object, + public Signal_source_pool::Entry { + friend class Object_pool; + friend class Signal_context_component; + + using Signal_source_pool::Entry::cap; + Signal_source_component() : Kernel_object(true), diff --git a/repos/base-hw/src/core/spec/arm/fpu.h b/repos/base-hw/src/core/spec/arm/fpu.h index 5a737ed16..f9a44c8e8 100644 --- a/repos/base-hw/src/core/spec/arm/fpu.h +++ b/repos/base-hw/src/core/spec/arm/fpu.h @@ -90,15 +90,24 @@ class Genode::Fpu { private: + /* + * Noncopyable + */ + Context(Context const &); + Context &operator = (Context const &); + friend class Fpu; - /* advanced FP/SIMD - system registers */ - uint32_t fpscr; - uint32_t fpexc; + struct + { + /* advanced FP/SIMD - system registers */ + uint32_t fpscr; + uint32_t fpexc; - /* advanced FP/SIMD - general purpose registers d0-d15 */ - uint64_t d0, d1, d2, d3, d4, d5, d6, d7; - uint64_t d8, d9, d10, d11, d12, d13, d14, d15; + /* advanced FP/SIMD - general purpose registers d0-d15 */ + uint64_t d0, d1, d2, d3, d4, d5, d6, d7; + uint64_t d8, d9, d10, d11, d12, d13, d14, d15; + }; Fpu * _fpu = nullptr; diff --git a/repos/base-hw/src/core/spec/arm/platform_support.cc b/repos/base-hw/src/core/spec/arm/platform_support.cc index 8c83fe457..04b3ec5c1 100644 --- a/repos/base-hw/src/core/spec/arm/platform_support.cc +++ b/repos/base-hw/src/core/spec/arm/platform_support.cc @@ -24,9 +24,8 @@ void Platform::setup_irq_mode(unsigned, unsigned, unsigned) { } long Platform::irq(long const user_irq) { return user_irq; } - -bool Platform::get_msi_params(const addr_t mmconf, addr_t &address, - addr_t &data, unsigned &irq_number) +bool Platform::get_msi_params(const addr_t /* mmconf */, addr_t & /* address */, + addr_t & /* data */, unsigned & /* irq_number */) { return false; } diff --git a/repos/base-hw/src/core/spec/arm_v7/trustzone/kernel/vm.cc b/repos/base-hw/src/core/spec/arm_v7/trustzone/kernel/vm.cc index f4792c07b..af1a3725e 100644 --- a/repos/base-hw/src/core/spec/arm_v7/trustzone/kernel/vm.cc +++ b/repos/base-hw/src/core/spec/arm_v7/trustzone/kernel/vm.cc @@ -21,7 +21,7 @@ using namespace Kernel; Kernel::Vm::Vm(void * const state, Kernel::Signal_context * const context, - void * const table) + void * const /* table */) : Cpu_job(Cpu_priority::MIN, 0), _state((Genode::Vm_state * const)state), _context(context), _table(0) { diff --git a/repos/base-hw/src/core/spec/arm_v7/trustzone/vm_session_component.h b/repos/base-hw/src/core/spec/arm_v7/trustzone/vm_session_component.h index 0ccf3079a..45bba287d 100644 --- a/repos/base-hw/src/core/spec/arm_v7/trustzone/vm_session_component.h +++ b/repos/base-hw/src/core/spec/arm_v7/trustzone/vm_session_component.h @@ -29,17 +29,22 @@ namespace Genode { class Vm_session_component; } -class Genode::Vm_session_component -: public Genode::Rpc_object, - public Kernel_object +class Genode::Vm_session_component : public Genode::Rpc_object, + private Kernel_object { private: + /* + * Noncopyable + */ + Vm_session_component(Vm_session_component const &); + Vm_session_component &operator = (Vm_session_component const &); + Rpc_entrypoint *_ds_ep; - Range_allocator *_ram_alloc; + Range_allocator *_ram_alloc = nullptr; Dataspace_component _ds; Dataspace_capability _ds_cap; - addr_t _ds_addr; + addr_t _ds_addr = 0; static size_t _ds_size() { return align_addr(sizeof(Cpu_state_modes), @@ -63,13 +68,13 @@ class Genode::Vm_session_component void run(void); void pause(void); - void attach(Dataspace_capability ds_cap, addr_t vm_addr) { + void attach(Dataspace_capability, addr_t /* vm_addr */) { warning("Not implemented for TrustZone case"); } - void attach_pic(addr_t vm_addr) { + void attach_pic(addr_t /* vm_addr */) { warning("Not implemented for TrustZone case"); } - void detach(addr_t vm_addr, size_t size) { + void detach(addr_t /* vm_addr */, size_t /* size */) { warning("Not implemented for TrustZone case"); } }; diff --git a/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc b/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc index f285d9dbd..13fa00ade 100644 --- a/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc +++ b/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc @@ -56,7 +56,10 @@ struct Host_context { struct Kernel::Vm_irq : Kernel::Irq { - Vm_irq(unsigned const irq) : Kernel::Irq(irq, *cpu_pool()->executing_cpu()) {} + Vm_irq(unsigned const irq) + : + Kernel::Irq(irq, cpu_pool()->executing_cpu()->irq_pool()) + { } /** * A VM interrupt gets injected into the VM scheduled on the current CPU diff --git a/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.h b/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.h index 88a11678f..b7ed552c6 100644 --- a/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.h +++ b/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.h @@ -31,20 +31,25 @@ namespace Genode { class Vm_session_component; } -class Genode::Vm_session_component -: public Genode::Rpc_object, - public Kernel_object +class Genode::Vm_session_component : public Genode::Rpc_object, + private Kernel_object { private: + /* + * Noncopyable + */ + Vm_session_component(Vm_session_component const &); + Vm_session_component &operator = (Vm_session_component const &); + using Table = Hw::Level_1_stage_2_translation_table; using Array = Table::Allocator::Array; Rpc_entrypoint *_ds_ep; - Range_allocator *_ram_alloc; + Range_allocator *_ram_alloc = nullptr; Dataspace_component _ds; Dataspace_capability _ds_cap; - addr_t _ds_addr; + addr_t _ds_addr = 0; Table &_table; Array &_table_array; diff --git a/repos/base-hw/src/core/spec/cortex_a9/cpu.h b/repos/base-hw/src/core/spec/cortex_a9/cpu.h index 45292569e..b3af52308 100644 --- a/repos/base-hw/src/core/spec/cortex_a9/cpu.h +++ b/repos/base-hw/src/core/spec/cortex_a9/cpu.h @@ -26,7 +26,7 @@ class Genode::Cpu : public Arm_v7_cpu { protected: - Fpu _fpu; + Fpu _fpu { }; public: diff --git a/repos/base-hw/src/core/spec/riscv/cpu.cc b/repos/base-hw/src/core/spec/riscv/cpu.cc index 394d74991..5a019a05b 100644 --- a/repos/base-hw/src/core/spec/riscv/cpu.cc +++ b/repos/base-hw/src/core/spec/riscv/cpu.cc @@ -69,7 +69,7 @@ void Genode::Cpu::switch_to(Mmu_context & context) } -void Genode::Cpu::mmu_fault(Context & c, Kernel::Thread_fault & f) +void Genode::Cpu::mmu_fault(Context &, Kernel::Thread_fault & f) { f.addr = Genode::Cpu::Sbadaddr::read(); f.type = Kernel::Thread_fault::PAGE_MISSING; diff --git a/repos/base-hw/src/core/spec/riscv/cpu.h b/repos/base-hw/src/core/spec/riscv/cpu.h index 40667c5fc..49c1daea0 100644 --- a/repos/base-hw/src/core/spec/riscv/cpu.h +++ b/repos/base-hw/src/core/spec/riscv/cpu.h @@ -49,7 +49,7 @@ class Genode::Cpu : public Hw::Riscv_cpu struct Mmu_context { - Sptbr::access_t sptbr; + Sptbr::access_t sptbr = 0; Mmu_context(addr_t page_table_base); ~Mmu_context(); @@ -75,7 +75,7 @@ class Genode::Cpu : public Hw::Riscv_cpu asm volatile ("sfence.vm\n"); } - static void invalidate_tlb_by_pid(unsigned const pid) { sfence(); } + static void invalidate_tlb_by_pid(unsigned const /* pid */) { sfence(); } void switch_to(Mmu_context & context); static void mmu_fault(Context & c, Kernel::Thread_fault & f); diff --git a/repos/base-hw/src/core/spec/riscv/kernel/cpu.cc b/repos/base-hw/src/core/spec/riscv/kernel/cpu.cc index dc6647db4..92c5b9928 100644 --- a/repos/base-hw/src/core/spec/riscv/kernel/cpu.cc +++ b/repos/base-hw/src/core/spec/riscv/kernel/cpu.cc @@ -15,5 +15,5 @@ #include #include -void Kernel::Cpu::init(Kernel::Pic &pic) { +void Kernel::Cpu::init(Kernel::Pic &) { Stvec::write(Hw::Mm::supervisor_exception_vector().base); } diff --git a/repos/base-hw/src/core/spec/riscv/pic.h b/repos/base-hw/src/core/spec/riscv/pic.h index b98cb3400..5528ec5a4 100644 --- a/repos/base-hw/src/core/spec/riscv/pic.h +++ b/repos/base-hw/src/core/spec/riscv/pic.h @@ -36,8 +36,8 @@ class Genode::Pic Pic() { } bool take_request(unsigned & i) { i = 0; return true; } - void unmask(unsigned const i, unsigned) { } - void mask(unsigned const i) { } + void unmask(unsigned, unsigned) { } + void mask(unsigned) { } void finish_request() { } }; diff --git a/repos/base-hw/src/core/spec/riscv/platform_support.cc b/repos/base-hw/src/core/spec/riscv/platform_support.cc index 18c1241a9..d52f4bc67 100644 --- a/repos/base-hw/src/core/spec/riscv/platform_support.cc +++ b/repos/base-hw/src/core/spec/riscv/platform_support.cc @@ -27,8 +27,8 @@ void Platform::_init_additional() { } void Platform::setup_irq_mode(unsigned, unsigned, unsigned) { } -long Platform::irq(long const user_irq) { return 0; } +long Platform::irq(long const /* user_irq */) { return 0; } -bool Platform::get_msi_params(const addr_t mmconf, addr_t &address, - addr_t &data, unsigned &irq_number) { +bool Platform::get_msi_params(addr_t /* mmconf */, addr_t & /* address */, + addr_t & /* data */, unsigned & /* irq_number */) { return false; } diff --git a/repos/base-hw/src/core/spec/riscv/translation_table.h b/repos/base-hw/src/core/spec/riscv/translation_table.h index 20d034c1b..a492b0947 100644 --- a/repos/base-hw/src/core/spec/riscv/translation_table.h +++ b/repos/base-hw/src/core/spec/riscv/translation_table.h @@ -18,8 +18,9 @@ #include template -void Sv39::Level_x_translation_table::_translation_added(addr_t addr, - size_t size) { - Genode::Cpu::sfence(); } +void Sv39::Level_x_translation_table::_translation_added(addr_t, size_t) +{ + Genode::Cpu::sfence(); +} #endif /* _CORE__SPEC__RISCV__TRANSLATION_TABLE_H_ */ diff --git a/repos/base-hw/src/core/spec/rpi/pic.h b/repos/base-hw/src/core/spec/rpi/pic.h index 1c9d9544e..ba878877c 100644 --- a/repos/base-hw/src/core/spec/rpi/pic.h +++ b/repos/base-hw/src/core/spec/rpi/pic.h @@ -107,7 +107,7 @@ class Genode::Pic : Mmio struct Irq_disable_gpu_2 : Register<0x20, 32> { }; struct Irq_disable_basic : Register<0x24, 32> { }; - Usb_dwc_otg _usb; + Usb_dwc_otg _usb { }; /** * Return true if specified interrupt is pending diff --git a/repos/base-hw/src/core/spec/x86_64/cpu.h b/repos/base-hw/src/core/spec/x86_64/cpu.h index 077bcc6ca..99deec7b4 100644 --- a/repos/base-hw/src/core/spec/x86_64/cpu.h +++ b/repos/base-hw/src/core/spec/x86_64/cpu.h @@ -43,7 +43,7 @@ class Genode::Cpu : public Hw::X86_64_cpu { protected: - Fpu _fpu; + Fpu _fpu { }; public: @@ -61,7 +61,7 @@ class Genode::Cpu : public Hw::X86_64_cpu uint64_t reserved2; static void init(); - } __attribute__((packed)) tss; + } __attribute__((packed)) tss { }; /** @@ -86,7 +86,7 @@ class Genode::Cpu : public Hw::X86_64_cpu uint64_t tss_desc[2]; void init(addr_t tss_addr); - } __attribute__((packed)) gdt; + } __attribute__((packed)) gdt { }; /** @@ -138,5 +138,4 @@ class Genode::Cpu : public Hw::X86_64_cpu static void mmu_fault(Context & regs, Kernel::Thread_fault & fault); }; - #endif /* _CORE__SPEC__X86_64__CPU_H_ */ diff --git a/repos/base-hw/src/core/spec/x86_64/muen/kernel/vm.cc b/repos/base-hw/src/core/spec/x86_64/muen/kernel/vm.cc index c9e21ea17..00485eab9 100644 --- a/repos/base-hw/src/core/spec/x86_64/muen/kernel/vm.cc +++ b/repos/base-hw/src/core/spec/x86_64/muen/kernel/vm.cc @@ -66,4 +66,4 @@ void Kernel::Vm::proceed(Cpu & cpu) } -void Kernel::Vm::inject_irq(unsigned irq) { } +void Kernel::Vm::inject_irq(unsigned) { } diff --git a/repos/base-hw/src/core/spec/x86_64/muen/pic.h b/repos/base-hw/src/core/spec/x86_64/muen/pic.h index 2ddf3d02a..b60398745 100644 --- a/repos/base-hw/src/core/spec/x86_64/muen/pic.h +++ b/repos/base-hw/src/core/spec/x86_64/muen/pic.h @@ -58,8 +58,8 @@ class Genode::Pic */ Pic() { } void finish_request() { } - void unmask(unsigned const i, unsigned) { } - void mask(unsigned const i) { } + void unmask(unsigned const, unsigned) { } + void mask(unsigned const) { } bool is_ip_interrupt(unsigned, unsigned) { return false; } void trigger_ip_interrupt(unsigned) { } diff --git a/repos/base-hw/src/core/spec/x86_64/muen/vm_session_component.h b/repos/base-hw/src/core/spec/x86_64/muen/vm_session_component.h index e5f7f329d..08609c51a 100644 --- a/repos/base-hw/src/core/spec/x86_64/muen/vm_session_component.h +++ b/repos/base-hw/src/core/spec/x86_64/muen/vm_session_component.h @@ -31,14 +31,15 @@ namespace Genode { class Genode::Vm_session_component : public Genode::Rpc_object, - public Kernel_object + private Kernel_object { private: + Vm_state _state; public: - Vm_session_component(Rpc_entrypoint*, size_t) { } + Vm_session_component(Rpc_entrypoint*, size_t) : _state() { } ~Vm_session_component() { } @@ -67,9 +68,9 @@ class Genode::Vm_session_component Kernel::pause_vm(kernel_object()); } - void attach(Dataspace_capability ds_cap, addr_t vm_addr) {} - void attach_pic(addr_t vm_addr) {} - void detach(addr_t vm_addr, size_t size) {} + void attach(Dataspace_capability, addr_t) {} + void attach_pic(addr_t) {} + void detach(addr_t, size_t) {} }; #endif /* _CORE__SPEC__X86_64__MUEN__VM_SESSION_COMPONENT_H_ */ diff --git a/repos/base-hw/src/core/spec/x86_64/pic.h b/repos/base-hw/src/core/spec/x86_64/pic.h index c5af1aef4..cfd7ef700 100644 --- a/repos/base-hw/src/core/spec/x86_64/pic.h +++ b/repos/base-hw/src/core/spec/x86_64/pic.h @@ -54,7 +54,7 @@ class Genode::Ioapic : public Mmio enum { REMAP_BASE = Board::VECTOR_REMAP_BASE }; /* Number of Redirection Table entries */ - unsigned _irte_count; + unsigned _irte_count = 0; enum { /* Register selectors */ @@ -180,7 +180,7 @@ class Genode::Pic : public Mmio */ Pic(); - Ioapic ioapic; + Ioapic ioapic { }; bool take_request(unsigned &irq); diff --git a/repos/base-hw/src/core/spec/x86_64/platform_support.cc b/repos/base-hw/src/core/spec/x86_64/platform_support.cc index c25ab460b..6dbc0262c 100644 --- a/repos/base-hw/src/core/spec/x86_64/platform_support.cc +++ b/repos/base-hw/src/core/spec/x86_64/platform_support.cc @@ -99,8 +99,7 @@ void Platform::setup_irq_mode(unsigned irq_number, unsigned trigger, Kernel::pic()->ioapic.setup_irq_mode(irq_number, trigger, polarity); } -bool Platform::get_msi_params(const addr_t mmconf, addr_t &address, - addr_t &data, unsigned &irq_number) { +bool Platform::get_msi_params(addr_t, addr_t &, addr_t &, unsigned &) { return false; } diff --git a/repos/base-hw/src/core/util.h b/repos/base-hw/src/core/util.h index 6bf737fd6..3f8f1e8a3 100644 --- a/repos/base-hw/src/core/util.h +++ b/repos/base-hw/src/core/util.h @@ -29,7 +29,7 @@ namespace Genode /** * Select source used for map operations */ - constexpr addr_t map_src_addr(addr_t core_local, addr_t phys) { return phys; } + constexpr addr_t map_src_addr(addr_t, addr_t phys) { return phys; } /** * Return highest supported flexpage size for the given mapping size diff --git a/repos/base-hw/src/include/base/internal/lock_helper.h b/repos/base-hw/src/include/base/internal/lock_helper.h index 8cbe36d38..5eafe6878 100644 --- a/repos/base-hw/src/include/base/internal/lock_helper.h +++ b/repos/base-hw/src/include/base/internal/lock_helper.h @@ -43,7 +43,7 @@ native_thread_id(Genode::Thread * const t) /** * Yield execution time-slice of current thread to thread t */ -static inline void thread_switch_to(Genode::Thread * const t) +static inline void thread_switch_to(Genode::Thread *) { Kernel::yield_thread(); } diff --git a/repos/base-hw/src/include/base/internal/native_utcb.h b/repos/base-hw/src/include/base/internal/native_utcb.h index 4c55ee0e2..e2235ddd3 100644 --- a/repos/base-hw/src/include/base/internal/native_utcb.h +++ b/repos/base-hw/src/include/base/internal/native_utcb.h @@ -59,29 +59,43 @@ class Genode::Native_utcb private: /* - * Note, the member variables are put into a header structure to ensure - * the header is padded by the compiler to the next machine-word - * boundary and '_data' is aligned. This also makes the dimensioning of - * '_data' easy (page size - size of header). + * Note that the members must not be touched at construction time. For + * this reason, they are backed by the uninitialized '_raw' array and + * indirectly accessed via a 'Header *' pointer. + * + * The array part beyond the 'Header' is used to carry IPC message + * payload. */ - struct { + struct Header + { size_t cap_cnt; /* capability counter */ size_t data_size; /* bytes to transfer */ long exception_code; /* result code of RPC */ Kernel::capid_t destination; /* invoked object */ Kernel::capid_t caps[MAX_CAP_ARGS]; /* capability buffer */ - } _header; /* is padded to machine word boundary by the compiler */ - uint8_t _data[get_page_size() - sizeof(_header)]; + }; + + uint8_t _raw[get_page_size()]; + + Header &_header() { return *reinterpret_cast
(this); } + Header const &_header() const { return *reinterpret_cast
(this); } + + uint8_t *_data() { return &_raw[sizeof(Header)]; } + uint8_t const *_data() const { return &_raw[sizeof(Header)]; } + + static constexpr size_t _max_data_size = get_page_size() - sizeof(Header); public: + Native_utcb() { } + Native_utcb& operator= (const Native_utcb &other) { - _header.cap_cnt = 0; - _header.data_size = min(sizeof(_data), other._header.data_size); - _header.exception_code = other._header.exception_code; - _header.destination = other._header.destination; - memcpy(_data, other._data, _header.data_size); + _header().cap_cnt = 0; + _header().data_size = min(_max_data_size, other._header().data_size); + _header().exception_code = other._header().exception_code; + _header().destination = other._header().destination; + memcpy(_data(), other._data(), _header().data_size); return *this; } @@ -89,49 +103,49 @@ class Genode::Native_utcb /** * Set the destination capability id (server object identity) */ - void destination(Kernel::capid_t id) { _header.destination = id; } + void destination(Kernel::capid_t id) { _header().destination = id; } /** * Return identity of invoked server object */ - Kernel::capid_t destination() const { return _header.destination; } + Kernel::capid_t destination() const { return _header().destination; } - void exception_code(long code) { _header.exception_code = code; } + void exception_code(long code) { _header().exception_code = code; } - long exception_code() const { return _header.exception_code; } + long exception_code() const { return _header().exception_code; } /** * Return the count of capabilities in the UTCB */ - size_t cap_cnt() const { return _header.cap_cnt; } + size_t cap_cnt() const { return _header().cap_cnt; } /** * Set the count of capabilities in the UTCB */ - void cap_cnt(size_t cnt) { _header.cap_cnt = cnt; } + void cap_cnt(size_t cnt) { _header().cap_cnt = cnt; } /** * Return the start address of the payload data */ - void const *data() const { return &_data[0]; } - void *data() { return &_data[0]; } + void const *data() const { return &_data()[0]; } + void *data() { return &_data()[0]; } /** * Return maximum number of bytes for message payload */ - size_t capacity() const { return sizeof(_data); } + size_t capacity() const { return _max_data_size; } /** * Return size of message data in bytes */ - size_t data_size() const { return _header.data_size; } + size_t data_size() const { return _header().data_size; } /** * Define size of message data to be transferred, in bytes */ void data_size(size_t data_size) { - _header.data_size = min(data_size, sizeof(_data)); + _header().data_size = min(data_size, _max_data_size); } /** @@ -139,7 +153,7 @@ class Genode::Native_utcb */ Kernel::capid_t cap_get(unsigned i) const { - return (i < MAX_CAP_ARGS) ? _header.caps[i] : Kernel::cap_id_invalid(); + return (i < MAX_CAP_ARGS) ? _header().caps[i] : Kernel::cap_id_invalid(); } /** @@ -148,14 +162,15 @@ class Genode::Native_utcb void cap_set(unsigned i, Kernel::capid_t cap) { if (i < MAX_CAP_ARGS) - _header.caps[i] = cap; + _header().caps[i] = cap; } /** * Set the capability id 'cap_id' at the next index */ void cap_add(Kernel::capid_t cap_id) { - if (_header.cap_cnt < MAX_CAP_ARGS) _header.caps[_header.cap_cnt++] = cap_id; } + if (_header().cap_cnt < MAX_CAP_ARGS) + _header().caps[_header().cap_cnt++] = cap_id; } }; static_assert(sizeof(Genode::Native_utcb) == Genode::get_page_size(), diff --git a/repos/base-hw/src/lib/base/ipc.cc b/repos/base-hw/src/lib/base/ipc.cc index 684faab74..29a9478bb 100644 --- a/repos/base-hw/src/lib/base/ipc.cc +++ b/repos/base-hw/src/lib/base/ipc.cc @@ -119,7 +119,7 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst, ** IPC server ** ****************/ -void Genode::ipc_reply(Native_capability caller, Rpc_exception_code exc, +void Genode::ipc_reply(Native_capability, Rpc_exception_code exc, Msgbuf_base &snd_msg) { Native_utcb &utcb = *Thread::myself()->utcb(); diff --git a/repos/base-hw/src/lib/hw/boot_info.h b/repos/base-hw/src/lib/hw/boot_info.h index c4a33ca0a..513c6ebc7 100644 --- a/repos/base-hw/src/lib/hw/boot_info.h +++ b/repos/base-hw/src/lib/hw/boot_info.h @@ -29,7 +29,7 @@ struct Hw::Boot_info Mapping_pool const elf_mappings; Mapping const boot_modules; Mmio_space const mmio_space; - Memory_region_array ram_regions; + Memory_region_array ram_regions { }; Acpi_rsdp const acpi_rsdp; Framebuffer const framebuffer; diff --git a/repos/base-hw/src/lib/hw/page_table_allocator.h b/repos/base-hw/src/lib/hw/page_table_allocator.h index ca6872d47..72cc9cab6 100644 --- a/repos/base-hw/src/lib/hw/page_table_allocator.h +++ b/repos/base-hw/src/lib/hw/page_table_allocator.h @@ -48,6 +48,8 @@ class Hw::Page_table_allocator Page_table_allocator(addr_t virt_addr, addr_t phys_addr) : _virt_addr(virt_addr), _phys_addr(phys_addr) { } + virtual ~Page_table_allocator() { } + template addr_t phys_addr(TABLE & table) { static_assert((sizeof(TABLE) == TABLE_SIZE), "unexpected size"); return _offset(table) + _phys_addr; } @@ -106,7 +108,7 @@ class Hw::Page_table_allocator::Array::Allocator using Bit_allocator = Genode::Bit_allocator; using Array = Page_table_allocator::Array; - Bit_allocator _free_tables; + Bit_allocator _free_tables { }; unsigned _alloc() { diff --git a/repos/base-hw/src/lib/hw/spec/arm/lpae.h b/repos/base-hw/src/lib/hw/spec/arm/lpae.h index 6a9465fea..acd255cde 100644 --- a/repos/base-hw/src/lib/hw/spec/arm/lpae.h +++ b/repos/base-hw/src/lib/hw/spec/arm/lpae.h @@ -265,7 +265,7 @@ class Hw::Long_translation_table struct Mem_attr : Block_descriptor_base::template Bitfield<2,4>{}; struct Hap : Block_descriptor_base::template Bitfield<6,2>{}; - static typename Descriptor::access_t create(Page_flags const &f, + static typename Descriptor::access_t create(Page_flags const &, addr_t const pa) { return Base::Shareability::bits( @@ -360,9 +360,9 @@ class Hw::Level_3_translation_table : { Remove_func() { } - void operator () (addr_t const vo, - addr_t const pa, - size_t const size, + void operator () (addr_t /* vo */, + addr_t /* pa */, + size_t /* size */, Descriptor::access_t &desc) { desc = 0; } }; @@ -375,7 +375,7 @@ class Hw::Level_3_translation_table : addr_t pa, size_t size, Page_flags const & flags, - Allocator & alloc) { + Allocator &) { _range_op(vo, pa, size, Insert_func(flags)); } void remove_translation(addr_t vo, size_t size, Allocator&) { @@ -461,7 +461,7 @@ class Hw::Level_x_translation_table : Remove_func(Allocator & alloc) : alloc(alloc) { } void operator () (addr_t const vo, - addr_t const pa, + addr_t const /* pa */, size_t const size, typename Descriptor::access_t &desc) { @@ -540,6 +540,6 @@ struct Hw::Page_table : Level_1_stage_1_translation_table * On ARM we do not need to copy top-level kernel entries * because the virtual-memory kernel part is hold in a separate table */ - explicit Page_table(Page_table &o) : Level_1_stage_1_translation_table() { } + explicit Page_table(Page_table &) : Level_1_stage_1_translation_table() { } }; #endif /* _SRC__LIB__HW__SPEC__ARM__LPAE_H_ */ diff --git a/repos/base-hw/src/lib/hw/spec/arm/page_table.h b/repos/base-hw/src/lib/hw/spec/arm/page_table.h index be2ae7389..d9d8249d9 100644 --- a/repos/base-hw/src/lib/hw/spec/arm/page_table.h +++ b/repos/base-hw/src/lib/hw/spec/arm/page_table.h @@ -460,7 +460,7 @@ class Hw::Page_table * On ARM we do not need to copy top-level kernel entries * because the virtual-memory kernel part is hold in a separate table */ - explicit Page_table(Page_table &o) : Page_table() { } + explicit Page_table(Page_table &) : Page_table() { } /** * Maximum virtual offset that can be translated by this table diff --git a/repos/base-hw/src/lib/hw/spec/riscv/page_table.h b/repos/base-hw/src/lib/hw/spec/riscv/page_table.h index ce3bde22c..5044a40a9 100644 --- a/repos/base-hw/src/lib/hw/spec/riscv/page_table.h +++ b/repos/base-hw/src/lib/hw/spec/riscv/page_table.h @@ -261,9 +261,9 @@ class Sv39::Level_x_translation_table Remove_func(Allocator & alloc) : alloc(alloc) { } - void operator () (addr_t const vo, - addr_t const pa, - size_t const size, + void operator () (addr_t const vo, + addr_t const /* pa */, + size_t const size, typename Descriptor::access_t &desc) { using Td = Table_descriptor; @@ -374,9 +374,9 @@ namespace Sv39 { { Remove_func(Allocator &) { } - void operator () (addr_t const vo, - addr_t const pa, - size_t const size, + void operator () (addr_t /* vo */, + addr_t /* pa */, + size_t /* size */, Descriptor::access_t &desc) { desc = 0; } }; diff --git a/repos/base-hw/src/lib/hw/spec/x86_64/page_table.h b/repos/base-hw/src/lib/hw/spec/x86_64/page_table.h index 37fe511af..4da316858 100644 --- a/repos/base-hw/src/lib/hw/spec/x86_64/page_table.h +++ b/repos/base-hw/src/lib/hw/spec/x86_64/page_table.h @@ -167,8 +167,7 @@ class Hw::Level_4_translation_table struct Remove_func { - void operator () (addr_t const vo, addr_t const pa, - size_t const size, + void operator () (addr_t /* vo */, addr_t /* pa */, size_t /* size */, Descriptor::access_t &desc) { desc = 0; } }; @@ -397,7 +396,7 @@ class Hw::Page_directory Remove_func(Allocator & alloc) : alloc(alloc) { } - void operator () (addr_t const vo, addr_t const pa, + void operator () (addr_t const vo, addr_t /* pa */, size_t const size, typename Base_descriptor::access_t &desc) { @@ -562,7 +561,7 @@ class Hw::Pml4_table Remove_func(Allocator & alloc) : alloc(alloc) { } - void operator () (addr_t const vo, addr_t const pa, + void operator () (addr_t const vo, addr_t /* pa */, size_t const size, Descriptor::access_t &desc) { diff --git a/repos/base-hw/src/lib/muen/sinfo.cc b/repos/base-hw/src/lib/muen/sinfo.cc index 5887195a8..58b40fe24 100644 --- a/repos/base-hw/src/lib/muen/sinfo.cc +++ b/repos/base-hw/src/lib/muen/sinfo.cc @@ -30,21 +30,19 @@ static_assert(sizeof(subject_info_type) <= Sinfo::SIZE, "Size of subject info type larger than Sinfo::SIZE."); /* Log channel information */ -static bool log_channel( - const struct Genode::Sinfo::Channel_info * const channel, - void *data) +static bool log_channel(Genode::Sinfo::Channel_info const * const channel, void *) { if (channel->has_event || channel->has_vector) { Genode::log("muen-sinfo: [", channel->writable ? "writer" : "reader", " with ", channel->has_event ? "event " : "vector", " ", channel->has_event ? channel->event_number : channel->vector, - "] ", channel->name); + "] ", Genode::Cstring(channel->name)); } else { Genode::log("muen-sinfo: [", channel->writable ? "writer" : "reader", " with no ", channel->writable ? "event " : "vector", " ", - "] ", channel->name); + "] ", Genode::Cstring(channel->name)); } return true; @@ -65,7 +63,7 @@ static bool hash_available(const uint8_t * const first) /* Convert given hash to hex string */ -static const char * const hash_to_hex(char *buffer, const unsigned char *first) +static char *hash_to_hex(char *buffer, const unsigned char *first) { int i; for (i = 0; i < Sinfo::HASH_LENGTH; i++) @@ -75,8 +73,7 @@ static const char * const hash_to_hex(char *buffer, const unsigned char *first) /* Log memory region information */ -static bool log_memregion(const struct Genode::Sinfo::Memregion_info * const region, - void *data) +static bool log_memregion(Genode::Sinfo::Memregion_info const * const region, void *) { char hash_str[65]; @@ -85,13 +82,13 @@ static bool log_memregion(const struct Genode::Sinfo::Memregion_info * const reg " size ", Genode::Hex(region->size), " ", region->writable ? "rw" : "ro", region->executable ? "x" : "-", - "] ", region->name); + "] ", Genode::Cstring(region->name)); if (region->content == Sinfo::CONTENT_FILL) Genode::log("muen-sinfo: [pattern ", region->pattern, "]"); if (hash_available(region->hash)) Genode::log("muen-sinfo: [hash 0x", - hash_to_hex(hash_str, region->hash), "]"); + Genode::Cstring(hash_to_hex(hash_str, region->hash)), "]"); return true; } @@ -112,9 +109,10 @@ static bool is_channel(const struct resource_type * const resource) Sinfo::Sinfo(const addr_t base_addr) +: + sinfo((subject_info_type *)base_addr) { const uint64_t sinfo_page_size = roundup(sizeof(subject_info_type), 0x1000); - sinfo = ((subject_info_type *)base_addr); sched_info = ((scheduling_info_type *)(base_addr + sinfo_page_size)); if (!check_magic()) { @@ -130,7 +128,7 @@ bool Sinfo::check_magic(void) } -const char * const Sinfo::get_subject_name(void) +const char * Sinfo::get_subject_name(void) { if (!check_magic()) return nullptr; @@ -281,7 +279,7 @@ void Sinfo::log_status() Sinfo::get_subject_name(), "'"); Genode::log("muen-sinfo: Subject information exports ", sinfo->memregion_count, " memory region(s)"); - for_each_memregion(log_memregion, 0); + for_each_memregion(log_memregion, nullptr); Genode::log("muen-sinfo: Subject information exports ", sinfo->channel_info_count, " channel(s)"); for_each_channel(log_channel, 0); diff --git a/repos/base-hw/src/test/cpu_quota/main.cc b/repos/base-hw/src/test/cpu_quota/main.cc index 1fbe50b47..f550ccdcc 100644 --- a/repos/base-hw/src/test/cpu_quota/main.cc +++ b/repos/base-hw/src/test/cpu_quota/main.cc @@ -24,8 +24,8 @@ using namespace Genode; struct Single_signal { - Signal_receiver receiver; - Signal_context context; + Signal_receiver receiver { }; + Signal_context context { }; Signal_context_capability cap; Signal_transmitter transmitter; @@ -39,7 +39,7 @@ struct Single_signal struct Synchronizer { - Single_signal signal; + Single_signal signal { }; Sync::Session &session; Synchronizer(Sync::Session &session) : session(session) { } @@ -65,8 +65,8 @@ class Counter : public Thread Name const &_name; unsigned long long volatile _value { 0 }; Stage volatile _stage { PAUSE }; - Single_signal _start_measurement; - Single_signal _start_destruction; + Single_signal _start_measurement { }; + Single_signal _start_destruction { }; Synchronizer _synchronizer; void entry() @@ -113,7 +113,7 @@ struct Main CONCLUSION_NR_OF_THREADS = 3, }; Env &env; - Single_signal timer_signal; + Single_signal timer_signal { }; Timer::Connection timer { env }; Sync::Connection sync { env }; Synchronizer synchronizer { sync }; diff --git a/repos/base-hw/src/test/cpu_quota/sync/main.cc b/repos/base-hw/src/test/cpu_quota/sync/main.cc index ce9a6f6f5..ace27c896 100644 --- a/repos/base-hw/src/test/cpu_quota/sync/main.cc +++ b/repos/base-hw/src/test/cpu_quota/sync/main.cc @@ -49,7 +49,7 @@ struct Sync_root : public Root_component submitted = 0; } - Session_component *_create_session(char const *args) override + Session_component *_create_session(char const *) override { try { return new (md_alloc()) Session_component(*this); } catch (...) { throw Service_denied(); } diff --git a/repos/base-hw/src/test/cpu_scheduler/test.cc b/repos/base-hw/src/test/cpu_scheduler/test.cc index e33fa9d2e..414228fcf 100644 --- a/repos/base-hw/src/test/cpu_scheduler/test.cc +++ b/repos/base-hw/src/test/cpu_scheduler/test.cc @@ -25,7 +25,7 @@ using Genode::addr_t; using Kernel::Cpu_share; using Kernel::Cpu_scheduler; -void * operator new(__SIZE_TYPE__ s, void * p) { return p; } +void * operator new(__SIZE_TYPE__, void * p) { return p; } struct Data { diff --git a/repos/base-hw/src/test/double_list/test.cc b/repos/base-hw/src/test/double_list/test.cc index b545508a3..1f8bf1282 100644 --- a/repos/base-hw/src/test/double_list/test.cc +++ b/repos/base-hw/src/test/double_list/test.cc @@ -27,9 +27,9 @@ using Genode::size_t; using Kernel::Double_list_typed; using Kernel::Double_list_item; -void * operator new(__SIZE_TYPE__ s, void * p) { return p; } +void * operator new(__SIZE_TYPE__, void * p) { return p; } -struct Item_load { char volatile x, y, z; }; +struct Item_load { char volatile x = 0, y = 0, z = 0; }; struct Item : Item_load, Double_list_item { @@ -44,7 +44,7 @@ struct Data { static constexpr unsigned nr_of_items = 9; - Double_list_typed list; + Double_list_typed list { }; char items[nr_of_items][sizeof(Item)]; Data() diff --git a/repos/base-linux/src/core/include/core_region_map.h b/repos/base-linux/src/core/include/core_region_map.h index 96227d7eb..92946ef42 100644 --- a/repos/base-linux/src/core/include/core_region_map.h +++ b/repos/base-linux/src/core/include/core_region_map.h @@ -22,7 +22,7 @@ namespace Genode { class Core_region_map; } struct Genode::Core_region_map : Region_map_mmap { - Core_region_map(Rpc_entrypoint &ep) : Region_map_mmap(false) { } + Core_region_map(Rpc_entrypoint &) : Region_map_mmap(false) { } }; #endif /* _CORE__INCLUDE__CORE_REGION_MAP_H_ */ diff --git a/repos/base-linux/src/core/include/dataspace_component.h b/repos/base-linux/src/core/include/dataspace_component.h index 91fa8ad98..0f01bc001 100644 --- a/repos/base-linux/src/core/include/dataspace_component.h +++ b/repos/base-linux/src/core/include/dataspace_component.h @@ -32,17 +32,17 @@ namespace Genode { /** * Deriving classes can own a dataspace to implement conditional behavior */ - class Dataspace_owner { }; + class Dataspace_owner : Interface { }; class Dataspace_component : public Rpc_object { private: - Filename _fname; /* filename for mmap */ - size_t _size; /* size of dataspace in bytes */ - addr_t _addr; /* meaningless on linux */ - int _fd; /* file descriptor */ - bool _writable; /* false if read-only */ + Filename _fname { }; /* filename for mmap */ + size_t _size { 0 }; /* size of dataspace in bytes */ + addr_t _addr { 0 }; /* meaningless on linux */ + int _fd { -1 }; /* file descriptor */ + bool _writable { false }; /* false if read-only */ /* Holds the dataspace owner if a distinction between owner and * others is necessary on the dataspace, otherwise it is 0 */ @@ -51,6 +51,12 @@ namespace Genode { static Filename _file_name(const char *args); size_t _file_size(); + /* + * Noncopyable + */ + Dataspace_component(Dataspace_component const &); + Dataspace_component &operator = (Dataspace_component const &); + public: /** @@ -72,9 +78,8 @@ namespace Genode { * This constructor is only provided for compatibility * reasons and should not be used. */ - Dataspace_component(size_t size, addr_t core_local_addr, - addr_t phys_addr, Cache_attribute, - bool writable, Dataspace_owner * _owner) + Dataspace_component(size_t size, addr_t, addr_t phys_addr, + Cache_attribute, bool, Dataspace_owner *_owner) : _size(size), _addr(phys_addr), _fd(-1), _owner(_owner) { diff --git a/repos/base-linux/src/core/include/irq_session_component.h b/repos/base-linux/src/core/include/irq_session_component.h index c6b05179f..96ccebec5 100644 --- a/repos/base-linux/src/core/include/irq_session_component.h +++ b/repos/base-linux/src/core/include/irq_session_component.h @@ -23,32 +23,34 @@ namespace Genode { } class Genode::Irq_session_component : public Rpc_object, - public List::Element + private List::Element { + private: + + friend class List; + public: /** * Constructor - * - * \param irq_alloc platform-dependent IRQ allocator - * \param args session construction arguments */ - Irq_session_component(Range_allocator *irq_alloc, - const char *args) { } + Irq_session_component(Range_allocator *, const char *) { } /** * Destructor */ ~Irq_session_component() { } + /*************************** ** Irq session interface ** ***************************/ void ack_irq() override { } void sigh(Signal_context_capability) override { } - Info info() override { - return { .type = Genode::Irq_session::Info::Type::INVALID }; } + Info info() override { + return { .type = Genode::Irq_session::Info::Type::INVALID, + .address = 0, .value = 0 }; } }; #endif /* _CORE__INCLUDE__IRQ_SESSION_COMPONENT_H_ */ diff --git a/repos/base-linux/src/core/include/pager.h b/repos/base-linux/src/core/include/pager.h index 9f0f30139..e17e6ed6a 100644 --- a/repos/base-linux/src/core/include/pager.h +++ b/repos/base-linux/src/core/include/pager.h @@ -29,9 +29,8 @@ namespace Genode { struct Pager_object { - Thread_capability _thread_cap; - Signal_context_capability _sigh; - + Thread_capability _thread_cap { }; + Signal_context_capability _sigh { }; virtual ~Pager_object() { } @@ -41,7 +40,7 @@ namespace Genode { * Remember thread cap so that rm_session can tell thread that * rm_client is gone. */ - Thread_capability thread_cap() { return _thread_cap; } const + Thread_capability thread_cap() const { return _thread_cap; } void thread_cap(Thread_capability cap) { _thread_cap = cap; } }; diff --git a/repos/base-linux/src/core/include/platform.h b/repos/base-linux/src/core/include/platform.h index 5519bc53c..78c3e4d02 100644 --- a/repos/base-linux/src/core/include/platform.h +++ b/repos/base-linux/src/core/include/platform.h @@ -41,7 +41,7 @@ namespace Genode { */ struct Pseudo_ram_allocator : Range_allocator { - bool alloc(size_t size, void **out_addr) + bool alloc(size_t, void **out_addr) { *out_addr = 0; return true; @@ -69,7 +69,7 @@ namespace Genode { bool need_size_for_free() const override { return true; } }; - Pseudo_ram_allocator _ram_alloc; + Pseudo_ram_allocator _ram_alloc { }; public: diff --git a/repos/base-linux/src/core/include/platform_thread.h b/repos/base-linux/src/core/include/platform_thread.h index c254d95f2..ebccd765b 100644 --- a/repos/base-linux/src/core/include/platform_thread.h +++ b/repos/base-linux/src/core/include/platform_thread.h @@ -45,8 +45,8 @@ namespace Genode { struct Registry { - Lock _lock; - List _list; + Lock _lock { }; + List _list { }; void insert(Platform_thread *thread); void remove(Platform_thread *thread); @@ -62,27 +62,27 @@ namespace Genode { */ static Registry *_registry(); - unsigned long _tid; - unsigned long _pid; - char _name[32]; + unsigned long _tid = -1; + unsigned long _pid = -1; + char _name[32] { }; /** * Unix-domain socket pair bound to the thread */ - Socket_pair _socket_pair; + Socket_pair _socket_pair { }; /* * Dummy pager object that is solely used for storing the * 'Signal_context_capability' for the thread's exception handler. */ - Pager_object _pager; + Pager_object _pager { }; public: /** * Constructor */ - Platform_thread(size_t, const char *name, unsigned priority, + Platform_thread(size_t, const char *name, unsigned priority, Affinity::Location, addr_t); ~Platform_thread(); @@ -112,7 +112,7 @@ namespace Genode { */ Pager_object *pager() { return &_pager; } void pager(Pager_object *) { } - int start(void *ip, void *sp) { return 0; } + int start(void *, void *) { return 0; } Thread_state state() { @@ -170,7 +170,7 @@ namespace Genode { /** * Set CPU quota of the thread to 'quota' */ - void quota(size_t const quota) { /* not supported*/ } + void quota(size_t const) { /* not supported*/ } /** * Return execution time consumed by the thread diff --git a/repos/base-linux/src/core/include/region_map_component.h b/repos/base-linux/src/core/include/region_map_component.h index fd85ffa6d..b4b58ef94 100644 --- a/repos/base-linux/src/core/include/region_map_component.h +++ b/repos/base-linux/src/core/include/region_map_component.h @@ -35,10 +35,12 @@ namespace Genode { class Genode::Region_map_component : public Rpc_object, - public List::Element + private List::Element { private: + friend class List; + struct Rm_dataspace_component { void sub_rm(Native_capability) { } }; public: @@ -46,7 +48,7 @@ class Genode::Region_map_component : public Rpc_object, Region_map_component(Rpc_entrypoint &, Allocator &, Pager_entrypoint &, addr_t, size_t, Session::Diag) { } - void upgrade_ram_quota(size_t ram_quota) { } + void upgrade_ram_quota(size_t) { } void add_client(Rm_client &) { } void remove_client(Rm_client &) { } @@ -68,14 +70,17 @@ class Genode::Region_map_component : public Rpc_object, }; -struct Genode::Rm_member { Region_map_component *member_rm() { return 0; } }; +struct Genode::Rm_member : Interface +{ + Region_map_component *member_rm() { return 0; } +}; struct Genode::Rm_client : Pager_object, Rm_member { Rm_client(Cpu_session_capability, Thread_capability, - Region_map_component *rm, unsigned long badge, - Affinity::Location location, Cpu_session::Name const&, + Region_map_component *, unsigned long, + Affinity::Location, Cpu_session::Name const&, Session_label const&) { } }; diff --git a/repos/base-linux/src/core/include/rpc_cap_factory.h b/repos/base-linux/src/core/include/rpc_cap_factory.h index 9b0200c56..9b6000c00 100644 --- a/repos/base-linux/src/core/include/rpc_cap_factory.h +++ b/repos/base-linux/src/core/include/rpc_cap_factory.h @@ -29,7 +29,7 @@ class Genode::Rpc_cap_factory public: - Rpc_cap_factory(Allocator &md_alloc) { } + Rpc_cap_factory(Allocator &) { } Native_capability alloc(Native_capability ep); diff --git a/repos/base-linux/src/core/include/server_socket_pair.h b/repos/base-linux/src/core/include/server_socket_pair.h index 8a50eb571..0b73275bf 100644 --- a/repos/base-linux/src/core/include/server_socket_pair.h +++ b/repos/base-linux/src/core/include/server_socket_pair.h @@ -33,8 +33,9 @@ struct Uds_addr : sockaddr_un { Uds_addr(long thread_id) + : + sockaddr_un({.sun_family = AF_UNIX, .sun_path = { }}) { - sun_family = AF_UNIX; Genode::snprintf(sun_path, sizeof(sun_path), "%s/ep-%ld", resource_path(), thread_id); } diff --git a/repos/base-linux/src/core/io_mem_session_component.cc b/repos/base-linux/src/core/io_mem_session_component.cc index a30883c6b..25e064cb1 100644 --- a/repos/base-linux/src/core/io_mem_session_component.cc +++ b/repos/base-linux/src/core/io_mem_session_component.cc @@ -18,8 +18,8 @@ using namespace Genode; -Io_mem_session_component::Io_mem_session_component(Range_allocator *io_mem_alloc, - Range_allocator *ram_alloc, - Rpc_entrypoint *ds_ep, +Io_mem_session_component::Io_mem_session_component(Range_allocator *, + Range_allocator *, + Rpc_entrypoint *, const char *args) { warning("no io_mem support on Linux (args=\"", args, "\")"); } diff --git a/repos/base-linux/src/core/native_pd_component.cc b/repos/base-linux/src/core/native_pd_component.cc index 4337939bc..937a91f41 100644 --- a/repos/base-linux/src/core/native_pd_component.cc +++ b/repos/base-linux/src/core/native_pd_component.cc @@ -179,10 +179,9 @@ void Native_pd_component::_start(Dataspace_component &ds) } -Native_pd_component::Native_pd_component(Pd_session_component &pd_session, - const char *args) +Native_pd_component::Native_pd_component(Pd_session_component &pd, const char *) : - _pd_session(pd_session) + _pd_session(pd) { _pd_session._ep.manage(this); } diff --git a/repos/base-linux/src/core/platform.cc b/repos/base-linux/src/core/platform.cc index cdb8ba025..aa1867fe4 100644 --- a/repos/base-linux/src/core/platform.cc +++ b/repos/base-linux/src/core/platform.cc @@ -75,14 +75,14 @@ static Pipe_semaphore _wait_for_exit_sem; /* wakeup of '_wait_for_exit' */ static bool _do_exit = false; /* exit condition */ -static void sigint_handler(int signum) +static void sigint_handler(int) { _do_exit = true; _wait_for_exit_sem.up(); } -static void sigchld_handler(int signnum) +static void sigchld_handler(int) { _wait_for_exit_sem.up(); } diff --git a/repos/base-linux/src/core/platform_thread.cc b/repos/base-linux/src/core/platform_thread.cc index 646913e37..2f602dbdf 100644 --- a/repos/base-linux/src/core/platform_thread.cc +++ b/repos/base-linux/src/core/platform_thread.cc @@ -76,7 +76,6 @@ Platform_thread::Registry *Platform_thread::_registry() Platform_thread::Platform_thread(size_t, const char *name, unsigned, Affinity::Location, addr_t) -: _tid(-1), _pid(-1) { strncpy(_name, name, min(sizeof(_name), strlen(name) + 1)); diff --git a/repos/base-linux/src/core/ram_dataspace_support.cc b/repos/base-linux/src/core/ram_dataspace_support.cc index 116210643..572e741ea 100644 --- a/repos/base-linux/src/core/ram_dataspace_support.cc +++ b/repos/base-linux/src/core/ram_dataspace_support.cc @@ -64,4 +64,4 @@ void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component *ds) } -void Ram_dataspace_factory::_clear_ds(Dataspace_component *ds) { } +void Ram_dataspace_factory::_clear_ds(Dataspace_component *) { } diff --git a/repos/base-linux/src/core/rom_session_component.cc b/repos/base-linux/src/core/rom_session_component.cc index b3c52c545..0292f35a9 100644 --- a/repos/base-linux/src/core/rom_session_component.cc +++ b/repos/base-linux/src/core/rom_session_component.cc @@ -33,7 +33,7 @@ using namespace Genode; -Rom_session_component::Rom_session_component(Rom_fs *rom_fs, +Rom_session_component::Rom_session_component(Rom_fs *, Rpc_entrypoint *ds_ep, const char *args) : _ds(args), _ds_ep(ds_ep) diff --git a/repos/base-linux/src/core/stack_area.cc b/repos/base-linux/src/core/stack_area.cc index d1a30ed53..a19f688c6 100644 --- a/repos/base-linux/src/core/stack_area.cc +++ b/repos/base-linux/src/core/stack_area.cc @@ -42,10 +42,8 @@ class Stack_area_region_map : public Genode::Region_map /** * Attach backing store to stack area */ - Local_addr attach(Genode::Dataspace_capability ds_cap, - Genode::size_t size, Genode::off_t offset, - bool use_local_addr, Local_addr local_addr, - bool executable) + Local_addr attach(Genode::Dataspace_capability, Genode::size_t size, + Genode::off_t, bool, Local_addr local_addr, bool) { using namespace Genode; @@ -80,7 +78,7 @@ class Stack_area_region_map : public Genode::Region_map struct Stack_area_ram_allocator : Genode::Ram_allocator { - Genode::Ram_dataspace_capability alloc(Genode::size_t size, + Genode::Ram_dataspace_capability alloc(Genode::size_t, Genode::Cache_attribute) override { return Genode::Ram_dataspace_capability(); } diff --git a/repos/base-linux/src/include/base/internal/local_parent.h b/repos/base-linux/src/include/base/internal/local_parent.h index e62f7052a..00d336351 100644 --- a/repos/base-linux/src/include/base/internal/local_parent.h +++ b/repos/base-linux/src/include/base/internal/local_parent.h @@ -46,7 +46,7 @@ class Genode::Local_parent : public Expanding_parent_client private: Allocator &_alloc; - Id_space _local_sessions_id_space; + Id_space _local_sessions_id_space { }; public: diff --git a/repos/base-linux/src/include/base/internal/lock_helper.h b/repos/base-linux/src/include/base/internal/lock_helper.h index 8c1d29f58..701090ce2 100644 --- a/repos/base-linux/src/include/base/internal/lock_helper.h +++ b/repos/base-linux/src/include/base/internal/lock_helper.h @@ -46,10 +46,7 @@ static inline bool thread_check_stopped_and_restart(Genode::Thread *thread_base) } -static inline void thread_switch_to(Genode::Thread *thread_base) -{ - thread_yield(); -} +static inline void thread_switch_to(Genode::Thread *) { thread_yield(); } static inline void thread_stop_myself() diff --git a/repos/base-linux/src/include/base/internal/native_thread.h b/repos/base-linux/src/include/base/internal/native_thread.h index 1ec8ff35d..e3d8aec8c 100644 --- a/repos/base-linux/src/include/base/internal/native_thread.h +++ b/repos/base-linux/src/include/base/internal/native_thread.h @@ -46,7 +46,7 @@ struct Genode::Native_thread */ Meta_data *meta_data = nullptr; - Socket_pair socket_pair; + Socket_pair socket_pair { }; Native_thread() { } }; diff --git a/repos/base-linux/src/include/base/internal/region_map_mmap.h b/repos/base-linux/src/include/base/internal/region_map_mmap.h index 4ba382ca8..b4181caf6 100644 --- a/repos/base-linux/src/include/base/internal/region_map_mmap.h +++ b/repos/base-linux/src/include/base/internal/region_map_mmap.h @@ -35,7 +35,7 @@ class Genode::Region_map_mmap : public Region_map, public Dataspace { private: - Region_registry _rmap; + Region_registry _rmap { }; bool const _sub_rm; /* false if region map is root */ size_t const _size; @@ -120,7 +120,7 @@ class Genode::Region_map_mmap : public Region_map, public Dataspace void detach(Local_addr local_addr); - void fault_handler(Signal_context_capability handler) { } + void fault_handler(Signal_context_capability) { } State state() { return State(); } diff --git a/repos/base-linux/src/include/base/internal/region_registry.h b/repos/base-linux/src/include/base/internal/region_registry.h index b50301f58..80c4a3d22 100644 --- a/repos/base-linux/src/include/base/internal/region_registry.h +++ b/repos/base-linux/src/include/base/internal/region_registry.h @@ -27,10 +27,10 @@ class Genode::Region { private: - addr_t _start; - off_t _offset; - Dataspace_capability _ds; - size_t _size; + addr_t _start { 0 }; + off_t _offset { 0 }; + Dataspace_capability _ds { }; + size_t _size { 0 }; /** * Return offset of first byte after the region @@ -39,7 +39,7 @@ class Genode::Region public: - Region() : _start(0), _offset(0), _size(0) { } + Region() { } Region(addr_t start, off_t offset, Dataspace_capability ds, size_t size) : _start(start), _offset(offset), _ds(ds), _size(size) { } diff --git a/repos/base-linux/src/include/base/internal/socket_descriptor_registry.h b/repos/base-linux/src/include/base/internal/socket_descriptor_registry.h index 36691ab04..c85844865 100644 --- a/repos/base-linux/src/include/base/internal/socket_descriptor_registry.h +++ b/repos/base-linux/src/include/base/internal/socket_descriptor_registry.h @@ -66,7 +66,7 @@ class Genode::Socket_descriptor_registry Entry _entries[MAX_FDS]; - Genode::Lock mutable _lock; + Genode::Lock mutable _lock { }; Entry &_find_free_entry() { diff --git a/repos/base-linux/src/lib/base/child_process.cc b/repos/base-linux/src/lib/base/child_process.cc index 0472e660d..9427d8b37 100644 --- a/repos/base-linux/src/lib/base/child_process.cc +++ b/repos/base-linux/src/lib/base/child_process.cc @@ -60,7 +60,7 @@ Child::Process::Loaded_executable::Loaded_executable(Dataspace_capability, Child::Process::Process(Dataspace_capability elf_ds, Dataspace_capability ldso_ds, - Pd_session_capability pd_cap, + Pd_session_capability, Pd_session &pd, Ram_session &ram, Initial_thread_base &, diff --git a/repos/base-linux/src/lib/base/ipc.cc b/repos/base-linux/src/lib/base/ipc.cc index de2c9771d..0ababee1e 100644 --- a/repos/base-linux/src/lib/base/ipc.cc +++ b/repos/base-linux/src/lib/base/ipc.cc @@ -182,9 +182,9 @@ namespace { typedef Genode::size_t size_t; - msghdr _msg; - sockaddr_un _addr; - iovec _iovec; + msghdr _msg { }; + sockaddr_un _addr { }; + iovec _iovec { }; char _cmsg_buf[CMSG_SPACE(MAX_SDS_PER_MSG*sizeof(int))]; unsigned _num_sds; @@ -286,7 +286,7 @@ static void extract_sds_from_message(unsigned start_index, Genode::Msgbuf_base &buf) { unsigned sd_cnt = 0; - for (unsigned i = 0; i < min(header.num_caps, Msgbuf_base::MAX_CAPS_PER_MSG); i++) { + for (unsigned i = 0; i < min(header.num_caps, (size_t)Msgbuf_base::MAX_CAPS_PER_MSG); i++) { unsigned long const badge = header.badges[i]; diff --git a/repos/base-linux/src/lib/base/thread_linux.cc b/repos/base-linux/src/lib/base/thread_linux.cc index 909bf94f2..69773f1de 100644 --- a/repos/base-linux/src/lib/base/thread_linux.cc +++ b/repos/base-linux/src/lib/base/thread_linux.cc @@ -83,7 +83,7 @@ void Thread::_thread_start() } -void Thread::_init_platform_thread(size_t weight, Type type) +void Thread::_init_platform_thread(size_t /* weight */, Type type) { /* if no cpu session is given, use it from the environment */ if (!_cpu_session) diff --git a/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc b/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc index d032ce836..91ba10641 100644 --- a/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc +++ b/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc @@ -35,7 +35,7 @@ enum { verbose_atexit = false }; /** * Dummy for symbol that is normally provided by '_main.cc' */ -int genode___cxa_atexit(void (*func)(void*), void *arg, void *dso) +int genode___cxa_atexit(void (*)(void*), void *, void *) { if (verbose_atexit) Genode::raw("genode___cxa_atexit called, not implemented\n"); @@ -146,7 +146,9 @@ int main() /* host libc includes */ #define size_t __SIZE_TYPE__ /* see comment in 'linux_syscalls.h' */ +#pragma GCC diagnostic ignored "-Weffc++" #include +#pragma GCC diagnostic pop #include #include #undef size_t @@ -161,7 +163,7 @@ static pthread_key_t tls_key() { struct Tls_key { - pthread_key_t key; + pthread_key_t key { }; Tls_key() { @@ -188,29 +190,31 @@ namespace Genode { * 'Stack'. But the POSIX threads of hybrid programs have no 'Stack' * object. So we have to keep the meta data here. */ - Native_thread native_thread; + Native_thread native_thread { }; /** * Filled out by 'thread_start' function in the stack of the new * thread */ - Thread * const thread_base; + Thread &thread_base; /** * POSIX thread handle */ - pthread_t pt; + pthread_t pt { }; /** * Constructor * * \param thread associated 'Thread' object */ - Meta_data(Thread *thread) : thread_base(thread) + Meta_data(Thread *thread) : thread_base(*thread) { native_thread.meta_data = this; } + virtual ~Meta_data() { } + /** * Used to block the constructor until the new thread has initialized * 'id' @@ -247,17 +251,17 @@ namespace Genode { * Used to block the constructor until the new thread has initialized * 'id' */ - Barrier _construct_lock; + Barrier _construct_lock { }; /** * Used to block the new thread until 'start' is called */ - Barrier _start_lock; + Barrier _start_lock { }; /** * Used to block the 'join()' function until the 'entry()' is done */ - Barrier _join_lock; + Barrier _join_lock { }; public: @@ -362,7 +366,7 @@ static void adopt_thread(Native_thread::Meta_data *meta_data) /* * Initialize thread meta data */ - Native_thread &native_thread = meta_data->thread_base->native_thread(); + Native_thread &native_thread = meta_data->thread_base.native_thread(); native_thread.tid = lx_gettid(); native_thread.pid = lx_getpid(); } @@ -402,11 +406,11 @@ namespace { return true; } - void free(void *addr, size_t size) override { ::free(addr); } + void free(void *addr, size_t) override { ::free(addr); } bool need_size_for_free() const override { return false; } - size_t overhead(size_t size) const override { return 0; } + size_t overhead(size_t) const override { return 0; } }; } @@ -423,7 +427,7 @@ Thread *Thread::myself() void * const tls = pthread_getspecific(tls_key()); if (tls != 0) - return ((Native_thread::Meta_data *)tls)->thread_base; + return &((Native_thread::Meta_data *)tls)->thread_base; bool const called_by_main_thread = (lx_getpid() == lx_gettid()); if (called_by_main_thread) @@ -457,7 +461,7 @@ Thread *Thread::myself() * Initialize 'Thread::_native_thread' to point to the default- * constructed 'Native_thread' (part of 'Meta_data'). */ - meta_data->thread_base->_native_thread = &meta_data->native_thread; + meta_data->thread_base._native_thread = &meta_data->native_thread; adopt_thread(meta_data); return thread; @@ -482,9 +486,9 @@ void Thread::join() Native_thread &Thread::native_thread() { return *_native_thread; } -Thread::Thread(size_t weight, const char *name, size_t stack_size, - Type type, Cpu_session * cpu_sess, Affinity::Location) -: _cpu_session(cpu_sess) +Thread::Thread(size_t weight, const char *name, size_t /* stack size */, + Type, Cpu_session * cpu_sess, Affinity::Location) +: _cpu_session(cpu_sess), _affinity(), _join_lock() { Native_thread::Meta_data *meta_data = new (global_alloc()) Thread_meta_data_created(this); @@ -513,7 +517,7 @@ Thread::Thread(size_t weight, const char *name, size_t stack_size, : Thread(weight, name, stack_size, type, &_env_ptr->cpu()) { } -Thread::Thread(Env &env, Name const &name, size_t stack_size, Location location, +Thread::Thread(Env &, Name const &name, size_t stack_size, Location location, Weight weight, Cpu_session &cpu) : Thread(weight.value, name.string(), stack_size, NORMAL, &cpu, location) diff --git a/repos/base-linux/src/test/lx_hybrid_pthread_ipc/main.cc b/repos/base-linux/src/test/lx_hybrid_pthread_ipc/main.cc index 99da1cdc1..a2d198322 100644 --- a/repos/base-linux/src/test/lx_hybrid_pthread_ipc/main.cc +++ b/repos/base-linux/src/test/lx_hybrid_pthread_ipc/main.cc @@ -17,7 +17,9 @@ #include /* libc includes */ +#pragma GCC diagnostic ignored "-Weffc++" #include +#pragma GCC diagnostic pop #include diff --git a/repos/base-nova/include/nova/cap_map.h b/repos/base-nova/include/nova/cap_map.h index e5b58c075..eda569c9a 100644 --- a/repos/base-nova/include/nova/cap_map.h +++ b/repos/base-nova/include/nova/cap_map.h @@ -32,9 +32,9 @@ namespace Genode { private: - Lock _lock; - addr_t _base; - addr_t _last; + Lock _lock { }; + addr_t _base = 0; + addr_t _last = 0; enum { HEADER = sizeof(_base) + sizeof(_lock) + sizeof(_last), @@ -49,8 +49,8 @@ namespace Genode { public: - Cap_range(addr_t base) : _base(base), _last(0) { - + Cap_range(addr_t base) : _base(base) + { static_assert(sizeof(*this) == CAP_RANGE_SIZE, "Cap_range misconfigured"); @@ -58,8 +58,8 @@ namespace Genode { _cap_array[i] = 0; } - addr_t const base() const { return _base; } - unsigned const elements() { return sizeof(_cap_array) / sizeof(_cap_array[0]); } + addr_t base() const { return _base; } + unsigned elements() const { return sizeof(_cap_array) / sizeof(_cap_array[0]); } Cap_range *find_by_id(addr_t); @@ -109,7 +109,7 @@ namespace Genode { { private: - Avl_tree _tree; + Avl_tree _tree { }; public: diff --git a/repos/base-nova/include/nova/capability_space.h b/repos/base-nova/include/nova/capability_space.h index bbb00bc79..f02998dc5 100644 --- a/repos/base-nova/include/nova/capability_space.h +++ b/repos/base-nova/include/nova/capability_space.h @@ -22,7 +22,7 @@ namespace Genode { namespace Capability_space { - enum { INVALID_INDEX = ~0UL }; + static constexpr unsigned long INVALID_INDEX = ~0UL; typedef Nova::Crd Ipc_cap_data; diff --git a/repos/base-nova/include/nova/native_thread.h b/repos/base-nova/include/nova/native_thread.h index 654e43de5..2e629ce41 100644 --- a/repos/base-nova/include/nova/native_thread.h +++ b/repos/base-nova/include/nova/native_thread.h @@ -26,15 +26,15 @@ namespace Genode { struct Native_thread; } struct Genode::Native_thread { - enum { INVALID_INDEX = ~0UL }; + static constexpr unsigned long INVALID_INDEX = ~0UL; - addr_t ec_sel; /* selector for execution context */ - addr_t exc_pt_sel; /* base of event portal window */ - bool vcpu; /* true if thread is a virtual CPU */ - addr_t initial_ip; /* initial IP of local thread */ + addr_t ec_sel { 0 }; /* selector for execution context */ + addr_t exc_pt_sel { 0 }; /* base of event portal window */ + bool vcpu { false }; /* true if thread is a virtual CPU */ + addr_t initial_ip { 0 }; /* initial IP of local thread */ /* receive window for capability selectors received at the server side */ - Receive_window server_rcv_window; + Receive_window server_rcv_window { }; /* * Designated selector to populate with the result of an IPC call @@ -52,7 +52,7 @@ struct Genode::Native_thread void reset_client_rcv_sel() { client_rcv_sel = INVALID_INDEX; } - Native_capability pager_cap; + Native_capability pager_cap { }; Native_thread() : ec_sel(INVALID_INDEX), exc_pt_sel(INVALID_INDEX), diff --git a/repos/base-nova/include/nova/receive_window.h b/repos/base-nova/include/nova/receive_window.h index 299f9a9fe..de5599b55 100644 --- a/repos/base-nova/include/nova/receive_window.h +++ b/repos/base-nova/include/nova/receive_window.h @@ -97,7 +97,7 @@ struct Genode::Receive_window public: - enum { INVALID_INDEX = ~0UL }; + static constexpr unsigned long INVALID_INDEX = ~0UL; Receive_window() : diff --git a/repos/base-nova/include/nova/syscall-generic.h b/repos/base-nova/include/nova/syscall-generic.h index 5597fb6cf..d81158b54 100644 --- a/repos/base-nova/include/nova/syscall-generic.h +++ b/repos/base-nova/include/nova/syscall-generic.h @@ -229,7 +229,7 @@ namespace Nova { { protected: - mword_t _value; + mword_t _value { 0 }; /** * Assign bitfield to descriptor @@ -250,6 +250,7 @@ namespace Nova { public: mword_t value() const { return _value; } + } __attribute__((packed)); diff --git a/repos/base-nova/src/core/core_region_map.cc b/repos/base-nova/src/core/core_region_map.cc index 6d395aec3..849b0694b 100644 --- a/repos/base-nova/src/core/core_region_map.cc +++ b/repos/base-nova/src/core/core_region_map.cc @@ -48,9 +48,9 @@ static inline void * alloc_region(Dataspace_component *ds, const size_t size) } Region_map::Local_addr -Core_region_map::attach(Dataspace_capability ds_cap, size_t size, +Core_region_map::attach(Dataspace_capability ds_cap, size_t, off_t offset, bool use_local_addr, - Region_map::Local_addr local_addr, + Region_map::Local_addr, bool executable) { auto lambda = [&] (Dataspace_component *ds) -> Local_addr { diff --git a/repos/base-nova/src/core/include/ipc_pager.h b/repos/base-nova/src/core/include/ipc_pager.h index e15b92caa..3b1008616 100644 --- a/repos/base-nova/src/core/include/ipc_pager.h +++ b/repos/base-nova/src/core/include/ipc_pager.h @@ -43,7 +43,7 @@ class Genode::Mapping * Constructor */ Mapping(addr_t dst_addr, addr_t source_addr, - Cache_attribute c, bool io_mem, + Cache_attribute c, bool /* io_mem */, unsigned size_log2, bool writeable, bool executable) : diff --git a/repos/base-nova/src/core/include/irq_object.h b/repos/base-nova/src/core/include/irq_object.h index f63a35bed..e3a681bd2 100644 --- a/repos/base-nova/src/core/include/irq_object.h +++ b/repos/base-nova/src/core/include/irq_object.h @@ -19,16 +19,16 @@ class Genode::Irq_object { private: - Signal_context_capability _sigh_cap; + Signal_context_capability _sigh_cap { }; - Genode::addr_t _kernel_caps; - Genode::addr_t _msi_addr; - Genode::addr_t _msi_data; - Genode::addr_t _device_phys; /* PCI config extended address */ + addr_t _kernel_caps; + addr_t _msi_addr; + addr_t _msi_data; + addr_t _device_phys = 0; /* PCI config extended address */ enum { KERNEL_CAP_COUNT_LOG2 = 0 }; - Genode::addr_t const irq_sel() { return _kernel_caps; } + Genode::addr_t irq_sel() const { return _kernel_caps; } public: diff --git a/repos/base-nova/src/core/include/nova_util.h b/repos/base-nova/src/core/include/nova_util.h index 12c7154d9..48017c0bd 100644 --- a/repos/base-nova/src/core/include/nova_util.h +++ b/repos/base-nova/src/core/include/nova_util.h @@ -192,7 +192,7 @@ inline int map_local(Nova::Utcb *utcb, * \param self map from this pd or solely from other pds * \param rights rights to be revoked, default: all rwx */ -inline void unmap_local(Nova::Utcb *utcb, Genode::addr_t start, +inline void unmap_local(Nova::Utcb *, Genode::addr_t start, Genode::size_t num_pages, bool const self = true, Nova::Rights const rwx = Nova::Rights(true, true, true)) diff --git a/repos/base-nova/src/core/include/pager.h b/repos/base-nova/src/core/include/pager.h index 2ba830f99..d7a40ab5e 100644 --- a/repos/base-nova/src/core/include/pager.h +++ b/repos/base-nova/src/core/include/pager.h @@ -64,7 +64,7 @@ namespace Genode { * User-level signal handler registered for this pager object via * 'Cpu_session::exception_handler()'. */ - Signal_context_capability _exception_sigh; + Signal_context_capability _exception_sigh { }; /** * selectors for @@ -74,11 +74,11 @@ namespace Genode { */ addr_t _selectors; - addr_t _initial_esp; - addr_t _initial_eip; + addr_t _initial_esp = 0; + addr_t _initial_eip = 0; addr_t _client_exc_pt_sel; - Lock _state_lock; + Lock _state_lock { }; struct { @@ -115,7 +115,7 @@ namespace Genode { inline void submit_signal() { _status |= SUBMIT_SIGNAL; } inline void reset_submit() { _status &= ~SUBMIT_SIGNAL; } - } _state; + } _state { }; Cpu_session_capability _cpu_session_cap; Thread_capability _thread_cap; @@ -378,6 +378,12 @@ namespace Genode { */ Lock _cap_valid; + /* + * Noncopyable + */ + Pager_activation_base(Pager_activation_base const &); + Pager_activation_base &operator = (Pager_activation_base const &); + public: /** diff --git a/repos/base-nova/src/core/include/platform.h b/repos/base-nova/src/core/include/platform.h index 1c5bb557c..1fef37717 100644 --- a/repos/base-nova/src/core/include/platform.h +++ b/repos/base-nova/src/core/include/platform.h @@ -29,14 +29,14 @@ namespace Genode { private: - Core_mem_allocator _core_mem_alloc; /* core-accessible memory */ - Phys_allocator _io_mem_alloc; /* MMIO allocator */ - Phys_allocator _io_port_alloc; /* I/O port allocator */ - Phys_allocator _irq_alloc; /* IRQ allocator */ - Rom_fs _rom_fs; /* ROM file system */ - unsigned _gsi_base_sel; /* cap selector of 1st IRQ */ - unsigned _core_pd_sel; /* cap selector of root PD */ - addr_t _core_phys_start { 0ULL }; + Core_mem_allocator _core_mem_alloc { }; /* core-accessible memory */ + Phys_allocator _io_mem_alloc; /* MMIO allocator */ + Phys_allocator _io_port_alloc; /* I/O port allocator */ + Phys_allocator _irq_alloc; /* IRQ allocator */ + Rom_fs _rom_fs { }; /* ROM file system */ + unsigned _gsi_base_sel { 0 }; /* cap selector of 1st IRQ */ + unsigned _core_pd_sel { 0 }; /* cap selector of root PD */ + addr_t _core_phys_start { 0 }; /** * Virtual address range usable by non-core processes diff --git a/repos/base-nova/src/core/include/platform_pd.h b/repos/base-nova/src/core/include/platform_pd.h index e801dbe15..0c80468d5 100644 --- a/repos/base-nova/src/core/include/platform_pd.h +++ b/repos/base-nova/src/core/include/platform_pd.h @@ -26,11 +26,17 @@ namespace Genode { { private: - Native_capability _parent; + Native_capability _parent { }; int _thread_cnt; addr_t const _pd_sel; const char * _label; + /* + * Noncopyable + */ + Platform_pd(Platform_pd const &); + Platform_pd &operator = (Platform_pd const &); + public: /** diff --git a/repos/base-nova/src/core/include/platform_thread.h b/repos/base-nova/src/core/include/platform_thread.h index 1b0d330dd..cdbd4d0b2 100644 --- a/repos/base-nova/src/core/include/platform_thread.h +++ b/repos/base-nova/src/core/include/platform_thread.h @@ -63,6 +63,12 @@ namespace Genode { inline bool sc_created() const { return _features & SC_CREATED; } inline bool remote_pd() const { return _features & REMOTE_PD; } + /* + * Noncopyable + */ + Platform_thread(Platform_thread const &); + Platform_thread &operator = (Platform_thread const &); + public: /* mark as vcpu in remote pd if it is a vcpu */ @@ -193,7 +199,7 @@ namespace Genode { /** * Set CPU quota of the thread to 'quota' */ - void quota(size_t const quota) { /* not supported*/ } + void quota(size_t const) { /* not supported*/ } /** * Return execution time consumed by the thread diff --git a/repos/base-nova/src/core/include/rpc_cap_factory.h b/repos/base-nova/src/core/include/rpc_cap_factory.h index fc906c893..d3f0fb451 100644 --- a/repos/base-nova/src/core/include/rpc_cap_factory.h +++ b/repos/base-nova/src/core/include/rpc_cap_factory.h @@ -39,8 +39,8 @@ class Genode::Rpc_cap_factory uint8_t _initial_sb[SBS]; Tslab _slab; - List _list; - Lock _lock; + List _list { }; + Lock _lock { }; public: diff --git a/repos/base-nova/src/core/include/signal_broker.h b/repos/base-nova/src/core/include/signal_broker.h index 7fc49e050..0380b02cb 100644 --- a/repos/base-nova/src/core/include/signal_broker.h +++ b/repos/base-nova/src/core/include/signal_broker.h @@ -35,7 +35,7 @@ class Genode::Signal_broker Allocator &_md_alloc; Rpc_entrypoint &_source_ep; - Object_pool _obj_pool; + Object_pool _obj_pool { }; Rpc_entrypoint &_context_ep; Signal_source_component _source; Signal_source_capability _source_cap; @@ -127,7 +127,7 @@ class Genode::Signal_broker cap_map()->remove(context_cap.local_name(), 0); } - void submit(Signal_context_capability cap, unsigned cnt) + void submit(Signal_context_capability, unsigned) { /* * On NOVA, signals are submitted directly to the kernel, not diff --git a/repos/base-nova/src/core/include/signal_source_component.h b/repos/base-nova/src/core/include/signal_source_component.h index 6a350f4bf..ea360a197 100644 --- a/repos/base-nova/src/core/include/signal_source_component.h +++ b/repos/base-nova/src/core/include/signal_source_component.h @@ -39,7 +39,7 @@ class Genode::Signal_source_component : public Rpc_object MAX_MAP_LOG2 ? MAX_MAP_LOG2 : size_log2; + return size_log2 > MAX_MAP_LOG2 ? (size_t)MAX_MAP_LOG2 : size_log2; } } diff --git a/repos/base-nova/src/core/io_mem_session_support.cc b/repos/base-nova/src/core/io_mem_session_support.cc index 1f8ba093d..92f7cc6b3 100644 --- a/repos/base-nova/src/core/io_mem_session_support.cc +++ b/repos/base-nova/src/core/io_mem_session_support.cc @@ -20,7 +20,6 @@ using namespace Genode; -void Io_mem_session_component::_unmap_local(addr_t base, size_t size) { } +void Io_mem_session_component::_unmap_local(addr_t, size_t) { } -addr_t Io_mem_session_component::_map_local(addr_t base, size_t size) { - return 0; } +addr_t Io_mem_session_component::_map_local(addr_t, size_t) { return 0; } diff --git a/repos/base-nova/src/core/irq_session_component.cc b/repos/base-nova/src/core/irq_session_component.cc index 63e6bfb64..4f78c7611 100644 --- a/repos/base-nova/src/core/irq_session_component.cc +++ b/repos/base-nova/src/core/irq_session_component.cc @@ -201,7 +201,7 @@ static Nova::Hip * kernel_hip() Irq_session_component::Irq_session_component(Range_allocator *irq_alloc, const char *args) : - _irq_number(~0U), _irq_alloc(irq_alloc) + _irq_number(~0U), _irq_alloc(irq_alloc), _irq_object() { long irq_number = Arg_string::find_arg(args, "irq_number").long_value(-1); long device_phys = Arg_string::find_arg(args, "device_config_phys").long_value(0); @@ -252,10 +252,10 @@ void Irq_session_component::sigh(Genode::Signal_context_capability cap) Genode::Irq_session::Info Irq_session_component::info() { if (!_irq_object.msi_address() || !_irq_object.msi_value()) - return { .type = Genode::Irq_session::Info::Type::INVALID }; + return { .type = Info::Type::INVALID, .address = 0, .value = 0 }; return { - .type = Genode::Irq_session::Info::Type::MSI, + .type = Info::Type::MSI, .address = _irq_object.msi_address(), .value = _irq_object.msi_value() }; diff --git a/repos/base-nova/src/core/native_pd_component.cc b/repos/base-nova/src/core/native_pd_component.cc index a0b7e4838..5de829aae 100644 --- a/repos/base-nova/src/core/native_pd_component.cc +++ b/repos/base-nova/src/core/native_pd_component.cc @@ -38,10 +38,9 @@ void Native_pd_component::imprint_rpc_cap(Native_capability cap, unsigned long b } -Native_pd_component::Native_pd_component(Pd_session_component &pd_session, - char const *args) +Native_pd_component::Native_pd_component(Pd_session_component &pd, char const *) : - _pd_session(pd_session) + _pd_session(pd) { _pd_session._ep.manage(this); } diff --git a/repos/base-nova/src/core/pager.cc b/repos/base-nova/src/core/pager.cc index 37e9d69ea..a30f88ca3 100644 --- a/repos/base-nova/src/core/pager.cc +++ b/repos/base-nova/src/core/pager.cc @@ -435,10 +435,10 @@ uint8_t Pager_object::client_recall(bool get_state_and_block) uint8_t Pager_object::_unsynchronized_client_recall(bool get_state_and_block) { - enum { STATE_REQUESTED = 1 }; + enum { STATE_REQUESTED = 1UL, STATE_INVALID = ~0UL }; uint8_t res = ec_ctrl(EC_RECALL, _state.sel_client_ec, - get_state_and_block ? STATE_REQUESTED : ~0UL); + get_state_and_block ? STATE_REQUESTED : STATE_INVALID); if (res != NOVA_OK) return res; @@ -781,17 +781,11 @@ void Pager_object::_oom_handler(addr_t pager_dst, addr_t pager_src, /* check assertions - cases that should not happen on Genode@Nova */ - enum { NO_OOM_PT = ~0UL, EC_OF_PT_OOM_OUTSIDE_OF_CORE }; + enum { NO_OOM_PT = 0UL }; /* all relevant (user) threads should have a OOM PT */ bool assert = pager_dst == NO_OOM_PT; - /* - * PT OOM solely created by core and they have to point to the pager - * thread inside core. - */ - assert |= pager_dst == EC_OF_PT_OOM_OUTSIDE_OF_CORE; - /* * This pager thread does solely reply to IPC calls - it should never * cause OOM during the sending phase of a IPC. @@ -934,8 +928,7 @@ void Pager_activation_base::entry() { } ** Pager entrypoint ** **********************/ - -Pager_entrypoint::Pager_entrypoint(Rpc_cap_factory &cap_factory) +Pager_entrypoint::Pager_entrypoint(Rpc_cap_factory &) { /* sanity check for pager threads */ if (kernel_hip()->cpu_max() > PAGER_CPUS) { diff --git a/repos/base-nova/src/core/platform.cc b/repos/base-nova/src/core/platform.cc index 794440409..4fc530be9 100644 --- a/repos/base-nova/src/core/platform.cc +++ b/repos/base-nova/src/core/platform.cc @@ -158,9 +158,9 @@ static void page_fault_handler() /* dump stack trace */ struct Core_img { - addr_t _beg; - addr_t _end; - addr_t *_ip; + addr_t _beg = 0; + addr_t _end = 0; + addr_t *_ip = nullptr; Core_img(addr_t sp) { @@ -753,8 +753,9 @@ Platform::Platform() : if (!hip->is_cpu_enabled(kernel_cpu_id)) continue; - struct Idle_trace_source : Trace::Source::Info_accessor, Trace::Control, - Trace::Source + struct Idle_trace_source : public Trace::Source::Info_accessor, + private Trace::Control, + private Trace::Source { Affinity::Location const affinity; unsigned const sc_sel; @@ -775,8 +776,11 @@ Platform::Platform() : Idle_trace_source(Affinity::Location affinity, unsigned sc_sel) : + Trace::Control(), Trace::Source(*this, *this), affinity(affinity), sc_sel(sc_sel) { } + + Trace::Source &source() { return *this; } }; Idle_trace_source *source = new (core_mem_alloc()) @@ -784,7 +788,7 @@ Platform::Platform() : _cpus.width(), 1), sc_idle_base + kernel_cpu_id); - Trace::sources().insert(source); + Trace::sources().insert(&source->source()); } } @@ -819,8 +823,7 @@ bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr, } -bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t phys_addr, - unsigned size) +bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t, unsigned size) { unmap_local((Utcb *)Thread::myself()->utcb(), virt_addr, size / get_page_size()); diff --git a/repos/base-nova/src/core/platform_pd.cc b/repos/base-nova/src/core/platform_pd.cc index aaaa3b110..32bf1d3f9 100644 --- a/repos/base-nova/src/core/platform_pd.cc +++ b/repos/base-nova/src/core/platform_pd.cc @@ -34,7 +34,7 @@ bool Platform_pd::bind_thread(Platform_thread *thread) } -void Platform_pd::unbind_thread(Platform_thread *thread) +void Platform_pd::unbind_thread(Platform_thread *) { warning(__func__, "not implemented"); } @@ -47,8 +47,7 @@ void Platform_pd::assign_parent(Native_capability parent) } -Platform_pd::Platform_pd(Allocator * md_alloc, char const *label, - signed pd_id, bool create) +Platform_pd::Platform_pd(Allocator *, char const *label, signed, bool) : _thread_cnt(0), _pd_sel(cap_map()->insert()), _label(label) { if (_pd_sel == Native_thread::INVALID_INDEX) { diff --git a/repos/base-nova/src/core/platform_thread.cc b/repos/base-nova/src/core/platform_thread.cc index 1f4c701cf..affcfa063 100644 --- a/repos/base-nova/src/core/platform_thread.cc +++ b/repos/base-nova/src/core/platform_thread.cc @@ -65,7 +65,7 @@ static uint8_t map_thread_portals(Pager_object &pager, ** Platform thread ** *********************/ -void Platform_thread::affinity(Affinity::Location location) +void Platform_thread::affinity(Affinity::Location) { error("dynamic affinity change not supported on NOVA"); } @@ -337,7 +337,7 @@ void Platform_thread::thread_type(Nova_native_cpu::Thread_type thread_type, Platform_thread::Platform_thread(size_t, const char *name, unsigned prio, - Affinity::Location affinity, int thread_id) + Affinity::Location affinity, int) : _pd(0), _pager(0), _id_base(cap_map()->insert(2)), _sel_exc_base(Native_thread::INVALID_INDEX), _location(affinity), diff --git a/repos/base-nova/src/core/ram_dataspace_support.cc b/repos/base-nova/src/core/ram_dataspace_support.cc index 4b3465d77..dcf70fde6 100644 --- a/repos/base-nova/src/core/ram_dataspace_support.cc +++ b/repos/base-nova/src/core/ram_dataspace_support.cc @@ -26,7 +26,7 @@ using namespace Genode; -void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component *ds) { } +void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component *) { } static inline void * alloc_region(Dataspace_component *ds, const size_t size) diff --git a/repos/base-nova/src/include/base/internal/lock_helper.h b/repos/base-nova/src/include/base/internal/lock_helper.h index 826cda353..53901e308 100644 --- a/repos/base-nova/src/include/base/internal/lock_helper.h +++ b/repos/base-nova/src/include/base/internal/lock_helper.h @@ -44,7 +44,7 @@ static inline bool thread_check_stopped_and_restart(Genode::Thread *thread_base) } -static inline void thread_switch_to(Genode::Thread *thread_base) { } +static inline void thread_switch_to(Genode::Thread *) { } static inline void thread_stop_myself() diff --git a/repos/base-nova/src/include/base/internal/native_utcb.h b/repos/base-nova/src/include/base/internal/native_utcb.h index 98e0cac8d..2f309b65e 100644 --- a/repos/base-nova/src/include/base/internal/native_utcb.h +++ b/repos/base-nova/src/include/base/internal/native_utcb.h @@ -36,6 +36,10 @@ class Genode::Native_utcb * dataspace but provided by the kernel. */ addr_t _utcb[UTCB_SIZE/sizeof(addr_t)]; + + public: + + Native_utcb() { } }; #endif /* _INCLUDE__BASE__INTERNAL__NATIVE_UTCB_H_ */ diff --git a/repos/base-nova/src/include/base/internal/spin_lock.h b/repos/base-nova/src/include/base/internal/spin_lock.h index e3e077851..e2cc71017 100644 --- a/repos/base-nova/src/include/base/internal/spin_lock.h +++ b/repos/base-nova/src/include/base/internal/spin_lock.h @@ -35,7 +35,8 @@ static inline void spinlock_lock(volatile T *lock_variable) using Genode::cmpxchg; Genode::Thread * myself = Genode::Thread::myself(); - T const tid = myself ? myself->native_thread().ec_sel : Nova::PT_SEL_MAIN_EC; + T const tid = myself ? myself->native_thread().ec_sel + : (Genode::addr_t)Nova::PT_SEL_MAIN_EC; unsigned help_counter = 0; diff --git a/repos/base-nova/src/include/signal_source/client.h b/repos/base-nova/src/include/signal_source/client.h index 0fd9473f3..83a2caf9d 100644 --- a/repos/base-nova/src/include/signal_source/client.h +++ b/repos/base-nova/src/include/signal_source/client.h @@ -42,7 +42,7 @@ namespace Genode { /** * Capability referring to a NOVA semaphore */ - Native_capability _sem; + Native_capability _sem { }; public: diff --git a/repos/base-nova/src/kernel/nova/target.mk b/repos/base-nova/src/kernel/nova/target.mk index 04aec00f5..e676ada5d 100644 --- a/repos/base-nova/src/kernel/nova/target.mk +++ b/repos/base-nova/src/kernel/nova/target.mk @@ -16,6 +16,7 @@ CC_WARN = -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual \ -Wold-style-cast -Woverloaded-virtual -Wsign-promo \ -Wlogical-op -Wstrict-null-sentinel \ -Wstrict-overflow=5 -Wvolatile-register-var +CC_CXX_WARN_STRICT = CC_OPT += -pipe \ -fdata-sections -fomit-frame-pointer -freg-struct-return \ -freorder-blocks -funit-at-a-time -fno-exceptions -fno-rtti \ diff --git a/repos/base-nova/src/lib/base/sleep.cc b/repos/base-nova/src/lib/base/sleep.cc index 4b4af79dc..15f78b49b 100644 --- a/repos/base-nova/src/lib/base/sleep.cc +++ b/repos/base-nova/src/lib/base/sleep.cc @@ -28,7 +28,8 @@ void Genode::sleep_forever() using namespace Nova; Thread *myself = Thread::myself(); - addr_t sem = myself ? myself->native_thread().exc_pt_sel + SM_SEL_EC : SM_SEL_EC; + addr_t sem = myself ? (addr_t)SM_SEL_EC + myself->native_thread().exc_pt_sel + : (addr_t)SM_SEL_EC; while (1) { if (Nova::sm_ctrl(sem, SEMAPHORE_DOWNZERO)) diff --git a/repos/base-nova/src/test/platform/ipc.cc b/repos/base-nova/src/test/platform/ipc.cc index bab7c529f..caddb39b8 100644 --- a/repos/base-nova/src/test/platform/ipc.cc +++ b/repos/base-nova/src/test/platform/ipc.cc @@ -51,6 +51,6 @@ long Test::cap_void_manual(Genode::Native_capability dst, utcb->crd_rcv = orig_crd; local_reply = utcb->msg()[1]; - return (res == Nova::NOVA_OK && utcb->msg_words() == 3 && utcb->msg()[2]) - ? utcb->msg()[0] : Genode::Rpc_exception_code::INVALID_OBJECT; + return (res == (Genode::uint8_t)Nova::NOVA_OK && utcb->msg_words() == 3 && utcb->msg()[2]) + ? utcb->msg()[0] : (long)Genode::Rpc_exception_code::INVALID_OBJECT; } diff --git a/repos/base-nova/src/test/platform/main.cc b/repos/base-nova/src/test/platform/main.cc index 345803937..4aea5cd04 100644 --- a/repos/base-nova/src/test/platform/main.cc +++ b/repos/base-nova/src/test/platform/main.cc @@ -421,7 +421,7 @@ class Pager : private Genode::Thread { private: - Native_capability _call_to_map; + Native_capability _call_to_map { }; Ram_dataspace_capability _ds; static addr_t _ds_mem; @@ -487,7 +487,7 @@ class Cause_mapping : public Genode::Thread { private: - Native_capability _call_to_map; + Native_capability _call_to_map { }; Rm_connection _rm; Region_map_client _sub_rm; addr_t _mem_nd; diff --git a/repos/base-nova/src/test/platform/server.h b/repos/base-nova/src/test/platform/server.h index cac9573ab..266f0f334 100644 --- a/repos/base-nova/src/test/platform/server.h +++ b/repos/base-nova/src/test/platform/server.h @@ -55,7 +55,7 @@ struct Test::Session : Genode::Session struct Test::Client : Genode::Rpc_client { - Client(Capability cap) : Rpc_client(cap) { } + Client(Genode::Capability cap) : Rpc_client(cap) { } bool cap_void(Genode::Native_capability cap, Genode::addr_t &local_name) { return call(cap, local_name); } diff --git a/repos/base-okl4/lib/mk/kernel-okl4.inc b/repos/base-okl4/lib/mk/kernel-okl4.inc index 36fcb1b6a..e9583a53c 100644 --- a/repos/base-okl4/lib/mk/kernel-okl4.inc +++ b/repos/base-okl4/lib/mk/kernel-okl4.inc @@ -44,7 +44,7 @@ CC_OPT += -DCONFIG_MAX_THREAD_BITS=10 CC_OPT_PIC = -CC_WARN := -Wall -Wno-unused-but-set-variable -Wno-uninitialized +CC_CXX_WARN := -Wall -Wno-unused-but-set-variable -Wno-uninitialized # # Enforce building the kernel with -O3. Otherwise, the kernel build would fail diff --git a/repos/base-okl4/src/core/core_log_out.cc b/repos/base-okl4/src/core/core_log_out.cc index 69b1c9723..7bb5b4681 100644 --- a/repos/base-okl4/src/core/core_log_out.cc +++ b/repos/base-okl4/src/core/core_log_out.cc @@ -14,8 +14,7 @@ /* core includes */ #include -namespace Okl4 { extern "C" { -#include -}; } +/* base-internal includes */ +#include void Genode::Core_log::out(char const c) { Okl4::L4_KDB_PrintChar(c); } diff --git a/repos/base-okl4/src/core/core_region_map.cc b/repos/base-okl4/src/core/core_region_map.cc index 4ea9e63fe..4b97f7224 100644 --- a/repos/base-okl4/src/core/core_region_map.cc +++ b/repos/base-okl4/src/core/core_region_map.cc @@ -22,7 +22,7 @@ using namespace Genode; Region_map::Local_addr Core_region_map::attach(Dataspace_capability ds_cap, size_t size, off_t offset, bool use_local_addr, - Region_map::Local_addr, bool executable) + Region_map::Local_addr, bool) { using namespace Okl4; diff --git a/repos/base-okl4/src/core/include/ipc_pager.h b/repos/base-okl4/src/core/include/ipc_pager.h index f51e0b15c..e37aaedd7 100644 --- a/repos/base-okl4/src/core/include/ipc_pager.h +++ b/repos/base-okl4/src/core/include/ipc_pager.h @@ -18,11 +18,8 @@ #include #include -namespace Okl4 { extern "C" { -#include -#include -#include -} } +/* base-internal includes */ +#include namespace Genode { @@ -30,9 +27,9 @@ namespace Genode { { private: - addr_t _phys_addr; - Okl4::L4_Fpage_t _fpage; - Okl4::L4_PhysDesc_t _phys_desc; + addr_t _phys_addr { 0 }; + Okl4::L4_Fpage_t _fpage { }; + Okl4::L4_PhysDesc_t _phys_desc { }; public: @@ -76,12 +73,12 @@ namespace Genode { { private: - Okl4::L4_MsgTag_t _faulter_tag; /* fault flags */ - Okl4::L4_ThreadId_t _last; /* faulted thread */ - Okl4::L4_Word_t _last_space; /* space of faulted thread */ - Okl4::L4_Word_t _fault_addr; /* page-fault address */ - Okl4::L4_Word_t _fault_ip; /* instruction pointer of faulter */ - Mapping _reply_mapping; /* page-fault answer */ + Okl4::L4_MsgTag_t _faulter_tag { 0 }; /* fault flags */ + Okl4::L4_ThreadId_t _last { 0 }; /* faulted thread */ + Okl4::L4_Word_t _last_space { 0 }; /* space of faulted thread */ + Okl4::L4_Word_t _fault_addr { 0 }; /* page-fault address */ + Okl4::L4_Word_t _fault_ip { 0 }; /* instruction pointer of faulter */ + Mapping _reply_mapping { }; /* page-fault answer */ protected: diff --git a/repos/base-okl4/src/core/include/map_local.h b/repos/base-okl4/src/core/include/map_local.h index fa3c5bc3a..66fc2d48c 100644 --- a/repos/base-okl4/src/core/include/map_local.h +++ b/repos/base-okl4/src/core/include/map_local.h @@ -20,12 +20,8 @@ /* core includes */ #include -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include -#include -#include -} } +/* base-internal includes */ +#include namespace Genode { diff --git a/repos/base-okl4/src/core/include/platform.h b/repos/base-okl4/src/core/include/platform.h index 5c9815037..862373f64 100644 --- a/repos/base-okl4/src/core/include/platform.h +++ b/repos/base-okl4/src/core/include/platform.h @@ -38,31 +38,37 @@ namespace Genode { { private: + /* + * Noncopyable + */ + Platform(Platform const &); + Platform &operator = (Platform const &); + using Rom_slab = Tslab; using Thread_slab = Tslab; - Platform_pd *_core_pd; /* core protection domain */ - Platform_thread *_core_pager; /* pager for core threads */ - Core_mem_allocator _core_mem_alloc; /* core-accessible memory */ - Phys_allocator _io_mem_alloc; /* MMIO allocator */ - Phys_allocator _io_port_alloc; /* I/O port allocator */ - Phys_allocator _irq_alloc; /* IRQ allocator */ - Rom_slab _rom_slab; /* Slab for rom modules */ - Rom_fs _rom_fs; /* ROM file system */ - Thread_slab _thread_slab; /* Slab for platform threads */ + Platform_pd *_core_pd = nullptr; /* core protection domain */ + Platform_thread *_core_pager = nullptr; /* pager for core threads */ + Core_mem_allocator _core_mem_alloc { }; /* core-accessible memory */ + Phys_allocator _io_mem_alloc; /* MMIO allocator */ + Phys_allocator _io_port_alloc; /* I/O port allocator */ + Phys_allocator _irq_alloc; /* IRQ allocator */ + Rom_slab _rom_slab; /* slab for rom modules */ + Rom_fs _rom_fs { }; /* ROM file system */ + Thread_slab _thread_slab; /* slab for platform threads */ /* * Virtual-memory range for non-core address spaces. * The virtual memory layout of core is maintained in * '_core_mem_alloc.virt_alloc()'. */ - addr_t _vm_start; - size_t _vm_size; + addr_t _vm_start = 0; + size_t _vm_size = 0; /* * Start of address range used for the UTCBs */ - addr_t _utcb_base; + addr_t _utcb_base = 0; void _init_rom_modules(); diff --git a/repos/base-okl4/src/core/include/platform_pd.h b/repos/base-okl4/src/core/include/platform_pd.h index 9a0b96def..5605721a1 100644 --- a/repos/base-okl4/src/core/include/platform_pd.h +++ b/repos/base-okl4/src/core/include/platform_pd.h @@ -20,9 +20,8 @@ /* core includes */ #include -namespace Okl4 { extern "C" { -#include -} } +/* base-internal includes */ +#include namespace Genode { @@ -42,13 +41,20 @@ namespace Genode { friend class Platform_thread; + /* + * Noncopyable + */ + Platform_pd(Platform_pd const &); + Platform_pd &operator = (Platform_pd const &); + enum { PD_INVALID = -1, PD_FIRST = 0, PD_MAX = (1 << Thread_id_bits::PD) - 1, THREAD_MAX = (1 << Thread_id_bits::THREAD) - 1 }; - unsigned _pd_id; /* plain pd number */ - Platform_thread *_space_pager; /* pager of the new pd */ + unsigned _pd_id = PD_INVALID; + + Platform_thread *_space_pager = nullptr; /** * Manually construct L4 thread ID from its components @@ -185,7 +191,7 @@ namespace Genode { /** * Assign parent interface to protection domain */ - void assign_parent(Native_capability parent) { } + void assign_parent(Native_capability) { } Platform_thread* space_pager() const { return _space_pager; } diff --git a/repos/base-okl4/src/core/include/platform_thread.h b/repos/base-okl4/src/core/include/platform_thread.h index 1db39f837..8c12cf5e2 100644 --- a/repos/base-okl4/src/core/include/platform_thread.h +++ b/repos/base-okl4/src/core/include/platform_thread.h @@ -28,6 +28,12 @@ namespace Genode { { private: + /* + * Noncopyable + */ + Platform_thread(Platform_thread const &); + Platform_thread &operator = (Platform_thread const &); + int _thread_id; /* plain thread number */ Okl4::L4_ThreadId_t _l4_thread_id; /* L4 thread ID */ char _name[32]; /* thread name that will be diff --git a/repos/base-okl4/src/core/include/rpc_cap_factory.h b/repos/base-okl4/src/core/include/rpc_cap_factory.h index 9b0200c56..9b6000c00 100644 --- a/repos/base-okl4/src/core/include/rpc_cap_factory.h +++ b/repos/base-okl4/src/core/include/rpc_cap_factory.h @@ -29,7 +29,7 @@ class Genode::Rpc_cap_factory public: - Rpc_cap_factory(Allocator &md_alloc) { } + Rpc_cap_factory(Allocator &) { } Native_capability alloc(Native_capability ep); diff --git a/repos/base-okl4/src/core/include/util.h b/repos/base-okl4/src/core/include/util.h index d33231ac4..f64b87bf8 100644 --- a/repos/base-okl4/src/core/include/util.h +++ b/repos/base-okl4/src/core/include/util.h @@ -22,12 +22,7 @@ /* base-internal includes */ #include - -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include -#include -} } +#include /* * The binding for 'L4_KDB_Enter' on ARM takes a 'char *' as argument, which @@ -44,8 +39,8 @@ namespace Okl4 { extern "C" { namespace Genode { - inline void log_event(const char *s) { } - inline void log_event(const char *s, unsigned v1, unsigned v2, unsigned v3) { } + inline void log_event(const char *) { } + inline void log_event(const char *, unsigned, unsigned, unsigned) { } inline void panic(const char *s) { @@ -113,7 +108,7 @@ namespace Genode { return trunc_page(page + get_page_size() - 1); } - inline addr_t map_src_addr(addr_t core_local, addr_t phys) { return phys; } + inline addr_t map_src_addr(addr_t, addr_t phys) { return phys; } inline size_t constrain_map_size_log2(size_t size_log2) { return size_log2; } } diff --git a/repos/base-okl4/src/core/io_mem_session_support.cc b/repos/base-okl4/src/core/io_mem_session_support.cc index b2b03494a..4b9c8c49f 100644 --- a/repos/base-okl4/src/core/io_mem_session_support.cc +++ b/repos/base-okl4/src/core/io_mem_session_support.cc @@ -19,9 +19,7 @@ using namespace Genode; -void Io_mem_session_component::_unmap_local(addr_t base, size_t size) -{ } +void Io_mem_session_component::_unmap_local(addr_t, size_t) { } -addr_t Io_mem_session_component::_map_local(addr_t base, size_t size) -{ return 0; } +addr_t Io_mem_session_component::_map_local(addr_t, size_t) { return 0; } diff --git a/repos/base-okl4/src/core/irq_session_component.cc b/repos/base-okl4/src/core/irq_session_component.cc index 9a7c51318..54cbd1615 100644 --- a/repos/base-okl4/src/core/irq_session_component.cc +++ b/repos/base-okl4/src/core/irq_session_component.cc @@ -22,15 +22,7 @@ /* base-internal includes */ #include - -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include -#include -#include -#include -#include -} } +#include using namespace Okl4; using namespace Genode; @@ -177,5 +169,5 @@ void Irq_session_component::sigh(Genode::Signal_context_capability cap) Genode::Irq_session::Info Irq_session_component::info() { /* no MSI support */ - return { .type = Genode::Irq_session::Info::Type::INVALID }; + return { .type = Info::Type::INVALID, .address = 0, .value = 0 }; } diff --git a/repos/base-okl4/src/core/pager.cc b/repos/base-okl4/src/core/pager.cc index aef397b41..2ef0f8df4 100644 --- a/repos/base-okl4/src/core/pager.cc +++ b/repos/base-okl4/src/core/pager.cc @@ -23,13 +23,7 @@ #include #include #include - -namespace Okl4 { extern "C" { -#include -#include -#include -#include -} } +#include static const bool verbose_page_fault = false; static const bool verbose_exception = false; @@ -71,9 +65,8 @@ static inline Okl4::L4_ThreadId_t thread_get_my_global_id() ** Mapping ** *************/ -Mapping::Mapping(addr_t dst_addr, addr_t src_addr, - Cache_attribute cacheability, bool io_mem, - unsigned l2size, bool rw, bool executable) +Mapping::Mapping(addr_t dst_addr, addr_t src_addr, Cache_attribute, bool, + unsigned l2size, bool rw, bool) : _fpage(L4_FpageLog2(dst_addr, l2size)), /* diff --git a/repos/base-okl4/src/core/pager_object.cc b/repos/base-okl4/src/core/pager_object.cc index cf23bf549..661c052e9 100644 --- a/repos/base-okl4/src/core/pager_object.cc +++ b/repos/base-okl4/src/core/pager_object.cc @@ -16,12 +16,7 @@ /* base-internal includes */ #include - -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include -#include -} } +#include using namespace Genode; diff --git a/repos/base-okl4/src/core/platform.cc b/repos/base-okl4/src/core/platform.cc index e6b772b54..7cb417285 100644 --- a/repos/base-okl4/src/core/platform.cc +++ b/repos/base-okl4/src/core/platform.cc @@ -22,6 +22,7 @@ #include #include #include +#include /* core includes */ #include @@ -31,12 +32,6 @@ #include #include -/* OKL4 includes */ -namespace Okl4 { -#include -#include -} - using namespace Genode; @@ -49,7 +44,7 @@ bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr, return map_local(phys_addr, virt_addr, size / get_page_size()); } -bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t phys_addr, +bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t, unsigned size) { return unmap_local(virt_addr, size / get_page_size()); } @@ -69,7 +64,7 @@ int Platform::bi_init_mem(Okl4::uintptr_t virt_base, Okl4::uintptr_t virt_end, } -int Platform::bi_add_virt_mem(Okl4::bi_name_t pool, Okl4::uintptr_t base, +int Platform::bi_add_virt_mem(Okl4::bi_name_t, Okl4::uintptr_t base, Okl4::uintptr_t end, const Okl4::bi_user_data_t *data) { /* prevent first page from being added to core memory */ diff --git a/repos/base-okl4/src/core/platform_pd.cc b/repos/base-okl4/src/core/platform_pd.cc index b2a254773..db997b22b 100644 --- a/repos/base-okl4/src/core/platform_pd.cc +++ b/repos/base-okl4/src/core/platform_pd.cc @@ -20,11 +20,8 @@ #include #include -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include -#include -} } +/* base-internal includes */ +#include using namespace Genode; @@ -296,8 +293,7 @@ void Platform_pd::flush(addr_t addr, size_t size, Core_local_addr) } -Platform_pd::Platform_pd(bool core) -: _space_pager(0) +Platform_pd::Platform_pd(bool) : _space_pager(0) { /* init remainder */ Pd_alloc free(false, true); @@ -311,8 +307,7 @@ Platform_pd::Platform_pd(bool core) } -Platform_pd::Platform_pd(Allocator *, char const *label) -: _space_pager(0) +Platform_pd::Platform_pd(Allocator *, char const *) { _init_threads(); diff --git a/repos/base-okl4/src/core/platform_thread.cc b/repos/base-okl4/src/core/platform_thread.cc index 6a12cfccf..d0401c131 100644 --- a/repos/base-okl4/src/core/platform_thread.cc +++ b/repos/base-okl4/src/core/platform_thread.cc @@ -25,21 +25,13 @@ /* base-internal includes */ #include - -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include -#include -#include -#include -#include -} } +#include using namespace Genode; using namespace Okl4; -int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no) +int Platform_thread::start(void *ip, void *sp, unsigned) { if (!_platform_pd) { warning("thread ", _thread_id, " is not bound to a PD"); diff --git a/repos/base-okl4/src/core/ram_dataspace_support.cc b/repos/base-okl4/src/core/ram_dataspace_support.cc index 0f65bd3a0..e346d742f 100644 --- a/repos/base-okl4/src/core/ram_dataspace_support.cc +++ b/repos/base-okl4/src/core/ram_dataspace_support.cc @@ -22,15 +22,13 @@ #include #include -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include /* needed for 'L4_ErrorCode' */ -} } +/* base-internal includes */ +#include using namespace Genode; -void Ram_dataspace_factory::_export_ram_ds(Dataspace_component *ds) { } -void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component *ds) { } +void Ram_dataspace_factory::_export_ram_ds(Dataspace_component *) { } +void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component *) { } void Ram_dataspace_factory::_clear_ds (Dataspace_component *ds) { diff --git a/repos/base-okl4/src/core/spec/x86/platform_thread_x86.cc b/repos/base-okl4/src/core/spec/x86/platform_thread_x86.cc index 9bcc48b59..5ab3ffb73 100644 --- a/repos/base-okl4/src/core/spec/x86/platform_thread_x86.cc +++ b/repos/base-okl4/src/core/spec/x86/platform_thread_x86.cc @@ -14,10 +14,8 @@ /* core includes */ #include -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include -} } +/* base-internal includes */ +#include using namespace Genode; using namespace Okl4; diff --git a/repos/base-okl4/src/include/base/internal/lock_helper.h b/repos/base-okl4/src/include/base/internal/lock_helper.h index 6b1f79997..bc3907fc3 100644 --- a/repos/base-okl4/src/include/base/internal/lock_helper.h +++ b/repos/base-okl4/src/include/base/internal/lock_helper.h @@ -20,11 +20,8 @@ /* Genode includes */ #include -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include -#include -} } +/* base-internal includes */ +#include /** diff --git a/repos/base-okl4/src/include/base/internal/native_thread.h b/repos/base-okl4/src/include/base/internal/native_thread.h index b25affdd1..d05a9c421 100644 --- a/repos/base-okl4/src/include/base/internal/native_thread.h +++ b/repos/base-okl4/src/include/base/internal/native_thread.h @@ -17,10 +17,8 @@ /* Genode includes */ #include -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include -} } +/* base-internal includes */ +#include namespace Genode { diff --git a/repos/base-okl4/src/include/base/internal/okl4.h b/repos/base-okl4/src/include/base/internal/okl4.h new file mode 100644 index 000000000..eed31dcf8 --- /dev/null +++ b/repos/base-okl4/src/include/base/internal/okl4.h @@ -0,0 +1,35 @@ +/* + * \brief OKL4 system-call bindings + * \author Norman Feske + * \date 2017-12-22 + */ + +/* + * Copyright (C) 2017 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + +#ifndef _BASE__INTERNAL__OKL4_H_ +#define _BASE__INTERNAL__OKL4_H_ + +/* OKL4 includes */ +namespace Okl4 { extern "C" { +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#pragma GCC diagnostic pop +#undef UTCB_SIZE +} } + +#endif /* _BASE__INTERNAL__OKL4_H_ */ diff --git a/repos/base-okl4/src/include/base/internal/raw_write_string.h b/repos/base-okl4/src/include/base/internal/raw_write_string.h index e8b6f8712..77be26ca1 100644 --- a/repos/base-okl4/src/include/base/internal/raw_write_string.h +++ b/repos/base-okl4/src/include/base/internal/raw_write_string.h @@ -14,9 +14,7 @@ #ifndef _INCLUDE__BASE__INTERNAL__RAW_WRITE_STRING_H_ #define _INCLUDE__BASE__INTERNAL__RAW_WRITE_STRING_H_ -namespace Okl4 { extern "C" { -#include -} } +#include namespace Genode { diff --git a/repos/base-okl4/src/include/base/internal/rpc_destination.h b/repos/base-okl4/src/include/base/internal/rpc_destination.h index 7e890f10e..0aeb69e12 100644 --- a/repos/base-okl4/src/include/base/internal/rpc_destination.h +++ b/repos/base-okl4/src/include/base/internal/rpc_destination.h @@ -14,10 +14,8 @@ #ifndef _INCLUDE__BASE__INTERNAL__RPC_DESTINATION_H_ #define _INCLUDE__BASE__INTERNAL__RPC_DESTINATION_H_ -/* OKL4 includes */ -namespace Okl4 { -#include -} +/* base-internal includes */ +#include namespace Genode { diff --git a/repos/base-okl4/src/lib/base/ipc.cc b/repos/base-okl4/src/lib/base/ipc.cc index b0a38fe5b..0e2798978 100644 --- a/repos/base-okl4/src/lib/base/ipc.cc +++ b/repos/base-okl4/src/lib/base/ipc.cc @@ -20,13 +20,7 @@ #include #include #include - -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include -#include -#include -} } +#include using namespace Genode; using namespace Okl4; diff --git a/repos/base-okl4/src/lib/base/thread_bootstrap.cc b/repos/base-okl4/src/lib/base/thread_bootstrap.cc index 42cf2baec..d9d16eae8 100644 --- a/repos/base-okl4/src/lib/base/thread_bootstrap.cc +++ b/repos/base-okl4/src/lib/base/thread_bootstrap.cc @@ -20,12 +20,7 @@ #include #include #include - -/* OKL4 includes */ -namespace Okl4 { extern "C" { -#include -#include -} } +#include Okl4::L4_ThreadId_t main_thread_tid; diff --git a/repos/base-pistachio/src/core/include/platform.h b/repos/base-pistachio/src/core/include/platform.h index d3c4007a9..cad8b1953 100644 --- a/repos/base-pistachio/src/core/include/platform.h +++ b/repos/base-pistachio/src/core/include/platform.h @@ -34,21 +34,26 @@ namespace Genode { { private: + /* + * Noncopyable + */ + Platform(Platform const &); + Platform &operator = (Platform const &); + /* * Shortcut for the type of allocator instances for physical resources */ typedef Synced_range_allocator Phys_allocator; - Phys_allocator _ram_alloc; /* RAM allocator */ - Phys_allocator _io_mem_alloc; /* MMIO allocator */ - Phys_allocator _io_port_alloc; /* I/O port allocator */ - Phys_allocator _irq_alloc; /* IRQ allocator */ - Phys_allocator _region_alloc; /* virtual memory allocator for core */ - Rom_fs _rom_fs; /* ROM file system */ - Rom_module _kip_rom; /* ROM module for Fiasco KIP */ - - addr_t _vm_start; /* begin of virtual memory */ - size_t _vm_size; /* size of virtual memory */ + Phys_allocator _ram_alloc; /* RAM allocator */ + Phys_allocator _io_mem_alloc; /* MMIO allocator */ + Phys_allocator _io_port_alloc; /* I/O port allocator */ + Phys_allocator _irq_alloc; /* IRQ allocator */ + Phys_allocator _region_alloc; /* virtual memory allocator for core */ + Rom_fs _rom_fs { }; /* ROM file system */ + Rom_module _kip_rom; /* ROM module for Fiasco KIP */ + addr_t _vm_start = 0; /* begin of virtual memory */ + size_t _vm_size = 0; /* size of virtual memory */ /* * We do not export any boot module loaded before FIRST_ROM. @@ -102,7 +107,7 @@ namespace Genode { */ Sigma0(); - int pager(Ipc_pager &ps) { /* never called */ return -1; } + int pager(Ipc_pager &) { /* never called */ return -1; } }; /** @@ -120,7 +125,7 @@ namespace Genode { */ Core_pager(Platform_pd *core_pd); - int pager(Ipc_pager &ps) { /* never called */ return -1; } + int pager(Ipc_pager &) { /* never called */ return -1; } }; /** diff --git a/repos/base-pistachio/src/core/include/platform_pd.h b/repos/base-pistachio/src/core/include/platform_pd.h index e879a00a3..f22219357 100644 --- a/repos/base-pistachio/src/core/include/platform_pd.h +++ b/repos/base-pistachio/src/core/include/platform_pd.h @@ -29,6 +29,12 @@ namespace Genode { { private: + /* + * Noncopyable + */ + Platform_pd(Platform_pd const &); + Platform_pd &operator = (Platform_pd const &); + friend class Platform_thread; /* @@ -46,10 +52,10 @@ namespace Genode { PD_INVALID = -1, }; - unsigned _pd_id; /* plain pd number */ - unsigned _version; /* version number */ + unsigned _pd_id = 0; + unsigned _version = 0; - Pistachio::L4_ThreadId_t _l4_task_id; /* L4 task ID */ + Pistachio::L4_ThreadId_t _l4_task_id { }; /* L4 task ID */ /** * Manually construct L4 thread ID from its components @@ -127,8 +133,8 @@ namespace Genode { return static_pds; } - Pistachio::L4_Word_t _kip_ptr; - Pistachio::L4_Word_t _utcb_ptr; + Pistachio::L4_Word_t _kip_ptr = 0; + Pistachio::L4_Word_t _utcb_ptr = 0; /** * Protection-domain creation @@ -195,7 +201,7 @@ namespace Genode { /** * Register quota donation at allocator guard */ - void upgrade_ram_quota(size_t ram_quota) { } + void upgrade_ram_quota(size_t) { } static Pistachio::L4_Word_t _core_utcb_ptr; static void touch_utcb_space(); @@ -219,7 +225,7 @@ namespace Genode { /** * Assign parent interface to protection domain */ - void assign_parent(Native_capability parent) { } + void assign_parent(Native_capability) { } int pd_id() const { return _pd_id; } diff --git a/repos/base-pistachio/src/core/include/platform_thread.h b/repos/base-pistachio/src/core/include/platform_thread.h index e05b4f647..9b0ec37f8 100644 --- a/repos/base-pistachio/src/core/include/platform_thread.h +++ b/repos/base-pistachio/src/core/include/platform_thread.h @@ -41,25 +41,29 @@ inline unsigned long convert_native_thread_id_to_badge(Pistachio::L4_ThreadId_t namespace Genode { class Platform_pd; - class Platform_thread + class Platform_thread : Interface { private: - int _thread_id; /* plain thread number */ - Pistachio::L4_ThreadId_t _l4_thread_id; /* L4 thread ID */ - char _name[32]; /* thread name that will be - registered at the kernel - debugger */ - Platform_pd *_platform_pd; /* protection domain thread - is bound to */ - unsigned _priority; /* thread priority */ - Pager_object *_pager; + typedef Pistachio::L4_ThreadId_t L4_ThreadId_t; - Affinity::Location _location; + /* + * Noncopyable + */ + Platform_thread(Platform_thread const &); + Platform_thread &operator = (Platform_thread const &); + + int _thread_id; + L4_ThreadId_t _l4_thread_id; + char _name[32]; /* thread name at kernel debugger */ + Platform_pd *_platform_pd = nullptr; + unsigned _priority; + Pager_object *_pager; + Affinity::Location _location { }; public: - enum { THREAD_INVALID = -1 }; /* invalid thread number */ + enum { THREAD_INVALID = -1 }; enum { DEFAULT_PRIORITY = 128 }; /** @@ -162,7 +166,7 @@ namespace Genode { /** * Set CPU quota of the thread to 'quota' */ - void quota(size_t const quota) { /* not supported*/ } + void quota(size_t const) { /* not supported*/ } /** * Return execution time consumed by the thread diff --git a/repos/base-pistachio/src/core/include/rpc_cap_factory.h b/repos/base-pistachio/src/core/include/rpc_cap_factory.h index 9b0200c56..9b6000c00 100644 --- a/repos/base-pistachio/src/core/include/rpc_cap_factory.h +++ b/repos/base-pistachio/src/core/include/rpc_cap_factory.h @@ -29,7 +29,7 @@ class Genode::Rpc_cap_factory public: - Rpc_cap_factory(Allocator &md_alloc) { } + Rpc_cap_factory(Allocator &) { } Native_capability alloc(Native_capability ep); diff --git a/repos/base-pistachio/src/core/include/util.h b/repos/base-pistachio/src/core/include/util.h index e74e56aeb..2850c18aa 100644 --- a/repos/base-pistachio/src/core/include/util.h +++ b/repos/base-pistachio/src/core/include/util.h @@ -36,8 +36,8 @@ namespace Pistachio { namespace Genode { - inline void log_event(const char *s) { } - inline void log_event(const char *s, unsigned v1, unsigned v2, unsigned v3) { } + inline void log_event(const char *) { } + inline void log_event(const char *, unsigned, unsigned, unsigned) { } inline void panic(const char *s) { @@ -83,7 +83,7 @@ namespace Genode { touch_read_write(bptr); } - constexpr addr_t get_page_mask() { return ~(get_page_size() - 1); } + constexpr addr_t get_page_mask() { return ~(get_page_size() - 1); } inline size_t get_super_page_size_log2() { @@ -107,7 +107,7 @@ namespace Genode { return trunc_page(addr + get_page_size() - 1); } - inline addr_t map_src_addr(addr_t core_local_addr, addr_t phys_addr) { + inline addr_t map_src_addr(addr_t core_local_addr, addr_t) { return core_local_addr; } inline size_t constrain_map_size_log2(size_t size_log2) { diff --git a/repos/base-pistachio/src/core/io_mem_session_support.cc b/repos/base-pistachio/src/core/io_mem_session_support.cc index 9fafb9c24..7d7074897 100644 --- a/repos/base-pistachio/src/core/io_mem_session_support.cc +++ b/repos/base-pistachio/src/core/io_mem_session_support.cc @@ -50,7 +50,7 @@ bool is_conventional_memory(addr_t base) } -void Io_mem_session_component::_unmap_local(addr_t base, size_t size) { } +void Io_mem_session_component::_unmap_local(addr_t, size_t) { } static inline bool can_use_super_page(addr_t base, size_t size) { diff --git a/repos/base-pistachio/src/core/irq_session_component.cc b/repos/base-pistachio/src/core/irq_session_component.cc index 6f2b01142..4119a0bda 100644 --- a/repos/base-pistachio/src/core/irq_session_component.cc +++ b/repos/base-pistachio/src/core/irq_session_component.cc @@ -170,5 +170,5 @@ void Irq_session_component::sigh(Genode::Signal_context_capability cap) Genode::Irq_session::Info Irq_session_component::info() { /* no MSI support */ - return { .type = Genode::Irq_session::Info::Type::INVALID }; + return { .type = Info::Type::INVALID, .address = 0, .value = 0 }; } diff --git a/repos/base-pistachio/src/core/pager.cc b/repos/base-pistachio/src/core/pager.cc index e9a8347cc..507ffe4c9 100644 --- a/repos/base-pistachio/src/core/pager.cc +++ b/repos/base-pistachio/src/core/pager.cc @@ -40,8 +40,8 @@ using namespace Pistachio; *************/ Mapping::Mapping(addr_t dst_addr, addr_t src_addr, - Cache_attribute, bool io_mem, unsigned l2size, - bool rw, bool executable) + Cache_attribute, bool, unsigned l2size, + bool rw, bool) { bool const grant = false; diff --git a/repos/base-pistachio/src/core/platform.cc b/repos/base-pistachio/src/core/platform.cc index 2e189de1d..17f03e6a8 100644 --- a/repos/base-pistachio/src/core/platform.cc +++ b/repos/base-pistachio/src/core/platform.cc @@ -149,7 +149,7 @@ static void _core_pager_loop() else wait_for_page_fault(t, pf_addr, pf_ip, flags); -#warning "TODO Ignore fault messages from non-core tasks" + /* XXX Ignore fault messages from non-core tasks */ /* * Check for local echo mapping request. To request a local diff --git a/repos/base-pistachio/src/core/platform_pd.cc b/repos/base-pistachio/src/core/platform_pd.cc index 6a986f437..9e884d1b0 100644 --- a/repos/base-pistachio/src/core/platform_pd.cc +++ b/repos/base-pistachio/src/core/platform_pd.cc @@ -303,8 +303,7 @@ void Platform_pd::flush(addr_t, size_t size, Core_local_addr core_local_base) } -Platform_pd::Platform_pd(bool core) : - _l4_task_id(L4_MyGlobalId()) +Platform_pd::Platform_pd(bool) : _l4_task_id(L4_MyGlobalId()) { /* * Start with version 2 to avoid being mistaken as local or @@ -327,21 +326,21 @@ Platform_pd::Platform_pd(bool core) : } -Platform_pd::Platform_pd(Allocator * md_alloc, char const *, - signed pd_id, bool create) +Platform_pd::Platform_pd(Allocator *, char const *, signed pd_id, bool create) { if (!create) panic("create must be true."); _init_threads(); - _pd_id = _alloc_pd(pd_id); - - if (_pd_id < 0) { + int const id = _alloc_pd(pd_id); + if (id < 0) { error("pd alloc failed"); return; } + _pd_id = id; + _create_pd(create); } diff --git a/repos/base-sel4/src/core/core_region_map.cc b/repos/base-sel4/src/core/core_region_map.cc index 6b8eb619d..987e85ebb 100644 --- a/repos/base-sel4/src/core/core_region_map.cc +++ b/repos/base-sel4/src/core/core_region_map.cc @@ -23,10 +23,8 @@ using namespace Genode; Region_map::Local_addr -Core_region_map::attach(Dataspace_capability ds_cap, size_t size, - off_t offset, bool use_local_addr, - Region_map::Local_addr local_addr, - bool executable) +Core_region_map::attach(Dataspace_capability ds_cap, size_t size, off_t offset, + bool use_local_addr, Region_map::Local_addr, bool) { auto lambda = [&] (Dataspace_component *ds) -> Local_addr { if (!ds) diff --git a/repos/base-sel4/src/core/include/cap_sel_alloc.h b/repos/base-sel4/src/core/include/cap_sel_alloc.h index 1f0aa4caa..baaf531b1 100644 --- a/repos/base-sel4/src/core/include/cap_sel_alloc.h +++ b/repos/base-sel4/src/core/include/cap_sel_alloc.h @@ -23,7 +23,7 @@ namespace Genode { struct Cap_sel_alloc; } -struct Genode::Cap_sel_alloc +struct Genode::Cap_sel_alloc : Interface { struct Alloc_failed : Exception { }; diff --git a/repos/base-sel4/src/core/include/ipc_pager.h b/repos/base-sel4/src/core/include/ipc_pager.h index e332c3a3a..bc3603103 100644 --- a/repos/base-sel4/src/core/include/ipc_pager.h +++ b/repos/base-sel4/src/core/include/ipc_pager.h @@ -30,13 +30,13 @@ class Genode::Mapping private: - addr_t _from_phys_addr; - addr_t _to_virt_addr; - Cache_attribute _attr; - size_t _num_pages; - addr_t _fault_type = { 0 }; - bool _writeable = { false }; - bool _executable = { false }; + addr_t _from_phys_addr { 0 }; + addr_t _to_virt_addr { 0 }; + Cache_attribute _attr { CACHED }; + size_t _num_pages { 0 }; + addr_t _fault_type { 0 }; + bool _writeable { false }; + bool _executable { false }; enum { PAGE_SIZE_LOG2 = 12 }; @@ -46,7 +46,7 @@ class Genode::Mapping * Constructor */ Mapping(addr_t dst_addr, addr_t src_addr, - Cache_attribute const cacheability, bool io_mem, + Cache_attribute const cacheability, bool, unsigned l2size, bool rw, bool executable) : _from_phys_addr(src_addr), @@ -59,7 +59,7 @@ class Genode::Mapping /** * Construct invalid mapping */ - Mapping() : _num_pages(0) { } + Mapping() { } /** * Prepare map operation @@ -86,15 +86,15 @@ class Genode::Ipc_pager : public Native_capability { private: - addr_t _badge; /* faulted badge of thread */ - addr_t _reply_sel; /* selector to save reply cap */ - addr_t _pf_addr; /* page-fault address */ - addr_t _pf_ip; /* instruction pointer of faulter */ - addr_t _fault_type; /* type of fault */ - bool _pf_write; /* true on write fault */ - bool _pf_exec; /* true on exec fault */ + addr_t _badge = 0; /* faulted badge of thread */ + addr_t _reply_sel = 0; /* selector to save reply cap */ + addr_t _pf_addr = 0; /* page-fault address */ + addr_t _pf_ip = 0; /* instruction pointer of faulter */ + addr_t _fault_type = 0; /* type of fault */ + bool _pf_write = false; /* true on write fault */ + bool _pf_exec = false; /* true on exec fault */ - Mapping _reply_mapping; + Mapping _reply_mapping { }; public: diff --git a/repos/base-sel4/src/core/include/irq_object.h b/repos/base-sel4/src/core/include/irq_object.h index c261d4ef6..e20883f50 100644 --- a/repos/base-sel4/src/core/include/irq_object.h +++ b/repos/base-sel4/src/core/include/irq_object.h @@ -24,7 +24,7 @@ class Genode::Irq_object : public Thread_deprecated<4096> { private: - Signal_context_capability _sig_cap; + Signal_context_capability _sig_cap { }; Lock _sync_bootup; unsigned _irq; Cap_sel _kernel_irq_sel; diff --git a/repos/base-sel4/src/core/include/page_table_registry.h b/repos/base-sel4/src/core/include/page_table_registry.h index d87d4d147..f7fbbbc0b 100644 --- a/repos/base-sel4/src/core/include/page_table_registry.h +++ b/repos/base-sel4/src/core/include/page_table_registry.h @@ -66,8 +66,8 @@ class Genode::Page_table_registry _vaddr(_base(vaddr, log2base)), _sel(sel) { } - Cap_sel const sel() const { return _sel; } - addr_t const vaddr() const { return _vaddr; } + Cap_sel sel() const { return _sel; } + addr_t vaddr() const { return _vaddr; } static Frame * lookup(Avl_tree &tree, addr_t const vaddr, @@ -116,9 +116,9 @@ class Genode::Page_table_registry _vaddr(_base(vaddr, log2base)), _paddr(paddr), _sel(sel) { } - Cap_sel const sel() const { return _sel; } - addr_t const vaddr() const { return _vaddr; } - addr_t const paddr() const { return _paddr; } + Cap_sel sel() const { return _sel; } + addr_t vaddr() const { return _vaddr; } + addr_t paddr() const { return _paddr; } static Table * lookup(Avl_tree &tree, addr_t const vaddr, @@ -147,10 +147,10 @@ class Genode::Page_table_registry Tslab _alloc_high; uint8_t _initial_sb_high[SLAB_BLOCK_SIZE]; - Avl_tree _frames; - Avl_tree
_level1; - Avl_tree
_level2; - Avl_tree
_level3; + Avl_tree _frames { }; + Avl_tree
_level1 { }; + Avl_tree
_level2 { }; + Avl_tree
_level3 { }; void _insert(addr_t const vaddr, Cap_sel const sel, Level const level, addr_t const paddr, unsigned const level_log2_size) diff --git a/repos/base-sel4/src/core/include/pager.h b/repos/base-sel4/src/core/include/pager.h index 15b3787eb..cbf184cac 100644 --- a/repos/base-sel4/src/core/include/pager.h +++ b/repos/base-sel4/src/core/include/pager.h @@ -54,7 +54,7 @@ class Genode::Pager_object : public Object_pool::Entry /** * Local name for this pager object */ - unsigned long _badge; + unsigned long _badge = 0; Cpu_session_capability _cpu_session_cap; Thread_capability _thread_cap; @@ -64,17 +64,17 @@ class Genode::Pager_object : public Object_pool::Entry * User-level signal handler registered for this pager object via * 'Cpu_session::exception_handler()'. */ - Signal_context_capability _exception_sigh; + Signal_context_capability _exception_sigh { }; - Session_label _pd_label; - Cpu_session::Name _name; + Session_label _pd_label; + Cpu_session::Name _name; public: /** * Contains information about exception state of corresponding thread. */ - Thread_state state; + Thread_state state { }; /** * Constructor @@ -160,7 +160,7 @@ class Genode::Pager_entrypoint : public Object_pool, { private: - Ipc_pager _pager; + Ipc_pager _pager { }; Rpc_cap_factory _cap_factory; Untyped_capability _pager_object_cap(unsigned long badge); diff --git a/repos/base-sel4/src/core/include/platform.h b/repos/base-sel4/src/core/include/platform.h index 8d2b53dd5..d4a4a85fa 100644 --- a/repos/base-sel4/src/core/include/platform.h +++ b/repos/base-sel4/src/core/include/platform.h @@ -39,7 +39,7 @@ class Genode::Static_allocator : public Allocator { private: - Bit_allocator _used; + Bit_allocator _used { }; struct Elem_space { uint8_t space[4096]; }; @@ -82,12 +82,18 @@ class Genode::Platform : public Platform_generic { private: - Core_mem_allocator _core_mem_alloc; /* core-accessible memory */ - Phys_allocator _io_mem_alloc; /* MMIO allocator */ - Phys_allocator _io_port_alloc; /* I/O port allocator */ - Phys_allocator _irq_alloc; /* IRQ allocator */ + /* + * Noncopyable + */ + Platform(Platform const &); + Platform &operator = (Platform const &); - Initial_untyped_pool _initial_untyped_pool; + Core_mem_allocator _core_mem_alloc { }; /* core-accessible memory */ + Phys_allocator _io_mem_alloc; /* MMIO allocator */ + Phys_allocator _io_port_alloc; /* I/O port allocator */ + Phys_allocator _irq_alloc; /* IRQ allocator */ + + Initial_untyped_pool _initial_untyped_pool { }; /* * Allocator for tracking unused physical addresses, which is used @@ -104,13 +110,13 @@ class Genode::Platform : public Platform_generic void _init_unused_phys_alloc(); bool const _init_unused_phys_alloc_done; - Rom_fs _rom_fs; /* ROM file system */ + Rom_fs _rom_fs { }; /* ROM file system */ /* * Virtual address range usable by non-core processes */ - addr_t _vm_base; - size_t _vm_size; + addr_t _vm_base = 0; + size_t _vm_size = 0; /* * Until this point, no interaction with the seL4 kernel was needed. @@ -162,7 +168,7 @@ class Genode::Platform : public Platform_generic struct Core_sel_alloc : Cap_sel_alloc, private Core_sel_bit_alloc { - Lock _lock; + Lock _lock { }; Core_sel_alloc() { _reserve(0, Core_cspace::core_static_sel_end()); } @@ -183,7 +189,7 @@ class Genode::Platform : public Platform_generic Core_sel_bit_alloc::free(sel.value()); } - } _core_sel_alloc; + } _core_sel_alloc { }; /** * Replace initial CSpace with custom CSpace layout @@ -191,7 +197,7 @@ class Genode::Platform : public Platform_generic void _switch_to_core_cspace(); bool const _switch_to_core_cspace_done; - Static_allocator _core_page_table_registry_alloc; + Static_allocator _core_page_table_registry_alloc { }; Page_table_registry _core_page_table_registry; /** diff --git a/repos/base-sel4/src/core/include/platform_pd.h b/repos/base-sel4/src/core/include/platform_pd.h index dd77a78a7..3e6fa2bce 100644 --- a/repos/base-sel4/src/core/include/platform_pd.h +++ b/repos/base-sel4/src/core/include/platform_pd.h @@ -45,7 +45,7 @@ class Genode::Platform_pd : public Address_space Constructible _cspace_cnode_2nd[1UL << CSPACE_SIZE_LOG2_1ST]; - Native_capability _parent; + Native_capability _parent { }; /* * Allocator for core-managed selectors within the PD's CSpace @@ -57,8 +57,8 @@ class Genode::Platform_pd : public Address_space Sel_alloc() { _reserve(0, INITIAL_SEL_END); } }; - Sel_alloc _sel_alloc; - Lock _sel_alloc_lock; + Sel_alloc _sel_alloc { }; + Lock _sel_alloc_lock { }; Cap_sel alloc_sel(); void free_sel(Cap_sel sel); diff --git a/repos/base-sel4/src/core/include/platform_thread.h b/repos/base-sel4/src/core/include/platform_thread.h index ea47fed31..256d42181 100644 --- a/repos/base-sel4/src/core/include/platform_thread.h +++ b/repos/base-sel4/src/core/include/platform_thread.h @@ -35,6 +35,12 @@ class Genode::Platform_thread : public List::Element { private: + /* + * Noncopyable + */ + Platform_thread(Platform_thread const &); + Platform_thread &operator = (Platform_thread const &); + Pager_object *_pager = nullptr; String<128> _name; @@ -47,7 +53,7 @@ class Genode::Platform_thread : public List::Element */ addr_t const _utcb; - Thread_info _info; + Thread_info _info { }; Cap_sel const _pager_obj_sel; @@ -141,7 +147,7 @@ class Genode::Platform_thread : public List::Element /** * Set pager capability */ - Pager_object *pager(Pager_object *pager) const { return _pager; } + Pager_object *pager(Pager_object *) const { return _pager; } void pager(Pager_object *pager) { _pager = pager; } Pager_object *pager() { return _pager; } diff --git a/repos/base-sel4/src/core/include/rpc_cap_factory.h b/repos/base-sel4/src/core/include/rpc_cap_factory.h index 9b0200c56..9b6000c00 100644 --- a/repos/base-sel4/src/core/include/rpc_cap_factory.h +++ b/repos/base-sel4/src/core/include/rpc_cap_factory.h @@ -29,7 +29,7 @@ class Genode::Rpc_cap_factory public: - Rpc_cap_factory(Allocator &md_alloc) { } + Rpc_cap_factory(Allocator &) { } Native_capability alloc(Native_capability ep); diff --git a/repos/base-sel4/src/core/include/util.h b/repos/base-sel4/src/core/include/util.h index 5e088824e..725b632b4 100644 --- a/repos/base-sel4/src/core/include/util.h +++ b/repos/base-sel4/src/core/include/util.h @@ -27,8 +27,8 @@ namespace Genode { inline addr_t trunc_page(addr_t addr) { return addr & get_page_mask(); } inline addr_t round_page(addr_t addr) { return trunc_page(addr + get_page_size() - 1); } - inline addr_t map_src_addr(addr_t core_local, addr_t phys) { return phys; } - inline size_t constrain_map_size_log2(size_t size_log2) { return get_page_size_log2(); } + inline addr_t map_src_addr(addr_t, addr_t phys) { return phys; } + inline size_t constrain_map_size_log2(size_t) { return get_page_size_log2(); } } #endif /* _CORE__INCLUDE__UTIL_H_ */ diff --git a/repos/base-sel4/src/core/include/vm_space.h b/repos/base-sel4/src/core/include/vm_space.h index 8d0051f78..cd4657fb0 100644 --- a/repos/base-sel4/src/core/include/vm_space.h +++ b/repos/base-sel4/src/core/include/vm_space.h @@ -103,7 +103,7 @@ class Genode::Vm_space * objects (where we cannot pass any arguments to the * constructors of the individual objects). */ - Constructible _cnode; + Constructible _cnode { }; public: @@ -130,7 +130,7 @@ class Genode::Vm_space /** * Allocator for the selectors within '_vm_cnodes' */ - Bit_allocator<1UL << NUM_VM_SEL_LOG2> _sel_alloc; + Bit_allocator<1UL << NUM_VM_SEL_LOG2> _sel_alloc { }; /** * Return leaf CNode that contains an index allocated from '_sel_alloc' @@ -148,7 +148,7 @@ class Genode::Vm_space return Cnode_index(idx & (LEAF_CNODE_SIZE - 1)); } - Lock _lock; + Lock _lock { }; /** * Return selector for a capability slot within '_vm_cnodes' diff --git a/repos/base-sel4/src/core/io_mem_session_support.cc b/repos/base-sel4/src/core/io_mem_session_support.cc index 2bf937281..c83341aa9 100644 --- a/repos/base-sel4/src/core/io_mem_session_support.cc +++ b/repos/base-sel4/src/core/io_mem_session_support.cc @@ -18,9 +18,7 @@ using namespace Genode; -void Io_mem_session_component::_unmap_local(addr_t base, size_t size) -{ } +void Io_mem_session_component::_unmap_local(addr_t, size_t) { } -addr_t Io_mem_session_component::_map_local(addr_t base, size_t size) -{ return 0; } +addr_t Io_mem_session_component::_map_local(addr_t, size_t) { return 0; } diff --git a/repos/base-sel4/src/core/irq_session_component.cc b/repos/base-sel4/src/core/irq_session_component.cc index 336fd5d63..b6d1e1afc 100644 --- a/repos/base-sel4/src/core/irq_session_component.cc +++ b/repos/base-sel4/src/core/irq_session_component.cc @@ -148,5 +148,5 @@ void Irq_session_component::sigh(Genode::Signal_context_capability cap) Genode::Irq_session::Info Irq_session_component::info() { /* no MSI support */ - return { .type = Genode::Irq_session::Info::Type::INVALID }; + return { .type = Info::Type::INVALID, .address = 0, .value = 0 }; } diff --git a/repos/base-sel4/src/core/pager.cc b/repos/base-sel4/src/core/pager.cc index 8ae86614a..8ce7d58f6 100644 --- a/repos/base-sel4/src/core/pager.cc +++ b/repos/base-sel4/src/core/pager.cc @@ -81,7 +81,7 @@ void Ipc_pager::reply_and_wait_for_fault() } -Ipc_pager::Ipc_pager() : _badge(0), _reply_sel(0) { } +Ipc_pager::Ipc_pager() { } /****************** @@ -90,7 +90,7 @@ Ipc_pager::Ipc_pager() : _badge(0), _reply_sel(0) { } Pager_object::Pager_object(Cpu_session_capability cpu_session, Thread_capability thread, - unsigned long badge, Affinity::Location location, + unsigned long badge, Affinity::Location, Session_label const &pd_label, Cpu_session::Name const &name) : diff --git a/repos/base-sel4/src/core/platform.cc b/repos/base-sel4/src/core/platform.cc index 50a648b3e..9126258d0 100644 --- a/repos/base-sel4/src/core/platform.cc +++ b/repos/base-sel4/src/core/platform.cc @@ -541,8 +541,10 @@ Platform::Platform() /* add idle thread trace subjects */ for (unsigned cpu_id = 0; cpu_id < affinity_space().width(); cpu_id ++) { - struct Idle_trace_source : Trace::Source::Info_accessor, Trace::Control, - Trace::Source, Genode::Thread_info + struct Idle_trace_source : public Trace::Source::Info_accessor, + private Trace::Control, + private Trace::Source, + private Thread_info { Affinity::Location const affinity; @@ -568,10 +570,13 @@ Platform::Platform() Idle_trace_source(Platform &platform, Range_allocator &phys_alloc, Affinity::Location affinity) : + Trace::Control(), Trace::Source(*this, *this), affinity(affinity) { Thread_info::init_tcb(platform, phys_alloc, 0, affinity.xpos()); } + + Trace::Source &source() { return *this; } }; Idle_trace_source *source = new (core_mem_alloc()) @@ -580,7 +585,7 @@ Platform::Platform() affinity_space().width(), affinity_space().height())); - Trace::sources().insert(source); + Trace::sources().insert(&source->source()); } /* I/O port allocator (only meaningful for x86) */ diff --git a/repos/base-sel4/src/core/platform_pd.cc b/repos/base-sel4/src/core/platform_pd.cc index b06074e3c..26e49d479 100644 --- a/repos/base-sel4/src/core/platform_pd.cc +++ b/repos/base-sel4/src/core/platform_pd.cc @@ -87,7 +87,8 @@ bool Platform_pd::bind_thread(Platform_thread *thread) * to attach the UTCB as a dataspace to the stack area to make the RM * session aware to the mapping. This code is missing. */ - addr_t const utcb = (thread->_utcb) ? thread->_utcb : thread->INITIAL_IPC_BUFFER_VIRT; + addr_t const utcb = (thread->_utcb) ? thread->_utcb + : (addr_t)thread->INITIAL_IPC_BUFFER_VIRT; enum { WRITABLE = true, ONE_PAGE = 1, FLUSHABLE = true, NON_EXECUTABLE = false }; _vm_space.alloc_page_tables(utcb, get_page_size()); @@ -199,8 +200,7 @@ void Platform_pd::flush(addr_t virt_addr, size_t size, Core_local_addr) } -Platform_pd::Platform_pd(Allocator * md_alloc, char const *label, - signed pd_id, bool create) +Platform_pd::Platform_pd(Allocator * md_alloc, char const *label, signed, bool) : _id(pd_id_alloc().alloc()), _page_table_registry(*md_alloc), diff --git a/repos/base-sel4/src/core/platform_thread.cc b/repos/base-sel4/src/core/platform_thread.cc index eb20b5680..fa326c00c 100644 --- a/repos/base-sel4/src/core/platform_thread.cc +++ b/repos/base-sel4/src/core/platform_thread.cc @@ -37,8 +37,8 @@ class Platform_thread_registry : Noncopyable { private: - List _threads; - Lock _lock; + List _threads { }; + Lock _lock { }; public: @@ -117,8 +117,8 @@ static void prepopulate_ipc_buffer(addr_t ipc_buffer_phys, Cap_sel ep_sel, /* populate IPC buffer with thread information */ Native_utcb &utcb = *(Native_utcb *)virt_addr; - utcb.ep_sel = ep_sel.value(); - utcb.lock_sel = lock_sel.value(); + utcb.ep_sel (ep_sel .value()); + utcb.lock_sel(lock_sel.value()); /* unmap IPC buffer from core */ if (!unmap_local((addr_t)virt_addr, 1)) { @@ -136,7 +136,7 @@ static void prepopulate_ipc_buffer(addr_t ipc_buffer_phys, Cap_sel ep_sel, ** Platform_thread interface ** *******************************/ -int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no) +int Platform_thread::start(void *ip, void *sp, unsigned int) { ASSERT(_pd); ASSERT(_pager); @@ -198,7 +198,7 @@ void Platform_thread::resume() } -void Platform_thread::state(Thread_state s) +void Platform_thread::state(Thread_state) { warning(__PRETTY_FUNCTION__, " not implemented"); throw Cpu_thread::State_access_failed(); @@ -232,7 +232,7 @@ Platform_thread::Platform_thread(size_t, const char *name, unsigned priority, if (_priority > 0) _priority -= 1; - _info.init(_utcb ? _utcb : INITIAL_IPC_BUFFER_VIRT, _priority); + _info.init(_utcb ? _utcb : (addr_t)INITIAL_IPC_BUFFER_VIRT, _priority); platform_thread_registry().insert(*this); } diff --git a/repos/base-sel4/src/core/spec/arm/fault_info.h b/repos/base-sel4/src/core/spec/arm/fault_info.h index 5f598ea75..ce9011b7e 100644 --- a/repos/base-sel4/src/core/spec/arm/fault_info.h +++ b/repos/base-sel4/src/core/spec/arm/fault_info.h @@ -24,7 +24,7 @@ struct Fault_info DFSR_WRITE_FAULT = 1UL << 11 }; - Fault_info(seL4_MessageInfo_t msg_info) + Fault_info(seL4_MessageInfo_t) : ip(seL4_GetMR(0)), pf(seL4_GetMR(1)), diff --git a/repos/base-sel4/src/core/spec/arm/platform.cc b/repos/base-sel4/src/core/spec/arm/platform.cc index 65a956d6c..c6e9d32ed 100644 --- a/repos/base-sel4/src/core/spec/arm/platform.cc +++ b/repos/base-sel4/src/core/spec/arm/platform.cc @@ -65,7 +65,7 @@ void Genode::Platform::_init_core_page_table_registry() addr_t const max_pd_mem = MAX_PROCESS_COUNT * (1UL << Page_directory_kobj::SIZE_LOG2); _initial_untyped_pool.turn_into_untyped_object(Core_cspace::TOP_CNODE_UNTYPED_16K, - [&] (addr_t const phys, addr_t const size, bool const device) { + [&] (addr_t const phys, addr_t const size, bool) { phys_alloc_16k().add_range(phys, size); _unused_phys_alloc.remove_range(phys, size); }, diff --git a/repos/base-sel4/src/core/spec/arm/thread.cc b/repos/base-sel4/src/core/spec/arm/thread.cc index 509bde6ed..5ab1a951d 100644 --- a/repos/base-sel4/src/core/spec/arm/thread.cc +++ b/repos/base-sel4/src/core/spec/arm/thread.cc @@ -41,7 +41,7 @@ void Genode::start_sel4_thread(Cap_sel tcb_sel, addr_t ip, addr_t sp, seL4_TCB_Resume(tcb_sel.value()); } -void Genode::affinity_sel4_thread(Cap_sel const &tcb_sel, unsigned cpu) +void Genode::affinity_sel4_thread(Cap_sel const &, unsigned cpu) { if (cpu != 0) error("could not set affinity of thread"); diff --git a/repos/base-sel4/src/core/spec/x86/fault_info.h b/repos/base-sel4/src/core/spec/x86/fault_info.h index 6527678d6..d765fe34c 100644 --- a/repos/base-sel4/src/core/spec/x86/fault_info.h +++ b/repos/base-sel4/src/core/spec/x86/fault_info.h @@ -29,7 +29,7 @@ struct Fault_info ERR_P = 1 << 0, }; - Fault_info(seL4_MessageInfo_t msg_info) + Fault_info(seL4_MessageInfo_t) : ip(seL4_GetMR(0)), pf(seL4_GetMR(1)), diff --git a/repos/base-sel4/src/core/spec/x86/vm_space.cc b/repos/base-sel4/src/core/spec/x86/vm_space.cc index 2c04c1407..067e08381 100644 --- a/repos/base-sel4/src/core/spec/x86/vm_space.cc +++ b/repos/base-sel4/src/core/spec/x86/vm_space.cc @@ -18,7 +18,7 @@ long Genode::Vm_space::_map_page(Genode::Cap_sel const &idx, Genode::addr_t const virt, Cache_attribute const cacheability, bool const writable, - bool const executable) + bool const) { seL4_X86_Page const service = _idx_to_sel(idx.value()); seL4_X86_PageDirectory const pd = _pd_sel.value(); diff --git a/repos/base-sel4/src/core/stack_area.cc b/repos/base-sel4/src/core/stack_area.cc index 53448634c..e491d78e0 100644 --- a/repos/base-sel4/src/core/stack_area.cc +++ b/repos/base-sel4/src/core/stack_area.cc @@ -57,10 +57,8 @@ class Stack_area_region_map : public Region_map /** * Allocate and attach on-the-fly backing store to the stack area */ - Local_addr attach(Dataspace_capability ds_cap, /* ignored capability */ - size_t size, off_t offset, - bool use_local_addr, Local_addr local_addr, - bool executable) override + Local_addr attach(Dataspace_capability, size_t size, off_t, + bool, Local_addr local_addr, bool) override { size = round_page(size); diff --git a/repos/base-sel4/src/include/base/internal/capability_space_sel4.h b/repos/base-sel4/src/include/base/internal/capability_space_sel4.h index 971c65eb2..a6ba21f4b 100644 --- a/repos/base-sel4/src/include/base/internal/capability_space_sel4.h +++ b/repos/base-sel4/src/include/base/internal/capability_space_sel4.h @@ -168,8 +168,8 @@ class Genode::Capability_space_sel4 }; Tree_managed_data _caps_data[NUM_CAPS]; - Avl_tree _tree; - Lock mutable _lock; + Avl_tree _tree { }; + Lock mutable _lock { }; /** * Calculate index into _caps_data for capability data object diff --git a/repos/base-sel4/src/include/base/internal/lock_helper.h b/repos/base-sel4/src/include/base/internal/lock_helper.h index 598ee2cdd..d45083335 100644 --- a/repos/base-sel4/src/include/base/internal/lock_helper.h +++ b/repos/base-sel4/src/include/base/internal/lock_helper.h @@ -25,7 +25,7 @@ static inline void thread_yield() { seL4_Yield(); } -static inline void thread_switch_to(Genode::Thread *thread) +static inline void thread_switch_to(Genode::Thread *) { Genode::warning(__FUNCTION__, " not implemented"); } diff --git a/repos/base-sel4/src/include/base/internal/native_utcb.h b/repos/base-sel4/src/include/base/internal/native_utcb.h index d4121bf98..0f6732be6 100644 --- a/repos/base-sel4/src/include/base/internal/native_utcb.h +++ b/repos/base-sel4/src/include/base/internal/native_utcb.h @@ -26,12 +26,15 @@ struct Genode::Native_utcb */ enum { IPC_BUFFER_SIZE = 4096 }; - union { + addr_t _raw[IPC_BUFFER_SIZE/sizeof(addr_t)]; - addr_t raw[IPC_BUFFER_SIZE/sizeof(addr_t)]; + Native_utcb() { }; - struct { addr_t ep_sel; addr_t lock_sel; }; - }; + addr_t ep_sel() const { return _raw[0]; } + addr_t lock_sel() const { return _raw[1]; } + + void ep_sel (addr_t sel) { _raw[0] = sel; } + void lock_sel(addr_t sel) { _raw[1] = sel; } }; #endif /* _INCLUDE__BASE__INTERNAL__NATIVE_UTCB_H_ */ diff --git a/repos/base-sel4/src/include/signal_source/client.h b/repos/base-sel4/src/include/signal_source/client.h index de86daffe..aed4ec5bb 100644 --- a/repos/base-sel4/src/include/signal_source/client.h +++ b/repos/base-sel4/src/include/signal_source/client.h @@ -15,28 +15,23 @@ #define _INCLUDE__SIGNAL_SOURCE__CLIENT_H_ #include +#include +#include #include -#include +namespace Genode { class Signal_source_client; } -#include -namespace Genode { - class Signal_source_client; -} class Genode::Signal_source_client : public Rpc_client { private: - Native_capability _notify; + Native_capability _notify { }; /** * Request notification object from signal-source server */ - void _init_notify() - { - _notify = call(); - } + void _init_notify() { _notify = call(); } public: diff --git a/repos/base-sel4/src/include/signal_source/rpc_object.h b/repos/base-sel4/src/include/signal_source/rpc_object.h index d7c0ba182..7aefdfcfb 100644 --- a/repos/base-sel4/src/include/signal_source/rpc_object.h +++ b/repos/base-sel4/src/include/signal_source/rpc_object.h @@ -25,7 +25,7 @@ struct Genode::Signal_source_rpc_object : Rpc_objectutcb().ep_sel; - native_thread().lock_sel = _stack->utcb().lock_sel; + native_thread().ep_sel = _stack->utcb().ep_sel(); + native_thread().lock_sel = _stack->utcb().lock_sel(); } } diff --git a/repos/base/include/base/affinity.h b/repos/base/include/base/affinity.h index 60cfab71a..fb6f4a04f 100644 --- a/repos/base/include/base/affinity.h +++ b/repos/base/include/base/affinity.h @@ -137,8 +137,8 @@ class Genode::Affinity private: - Space _space; - Location _location; + Space _space { }; + Location _location { }; public: diff --git a/repos/base/include/base/allocator.h b/repos/base/include/base/allocator.h index 788947cc0..1d1fde518 100644 --- a/repos/base/include/base/allocator.h +++ b/repos/base/include/base/allocator.h @@ -14,6 +14,7 @@ #ifndef _INCLUDE__BASE__ALLOCATOR_H_ #define _INCLUDE__BASE__ALLOCATOR_H_ +#include #include #include #include @@ -31,7 +32,7 @@ namespace Genode { /** * Deallocator interface */ -struct Genode::Deallocator +struct Genode::Deallocator : Interface { /** * Free block a previously allocated block diff --git a/repos/base/include/base/allocator_avl.h b/repos/base/include/base/allocator_avl.h index 951c91fc2..6cffcd0a6 100644 --- a/repos/base/include/base/allocator_avl.h +++ b/repos/base/include/base/allocator_avl.h @@ -49,17 +49,24 @@ class Genode::Allocator_avl_base : public Range_allocator static bool _sum_in_range(addr_t addr, addr_t offset) { return (~0UL - addr > offset); } + /* + * Noncopyable + */ + Allocator_avl_base(Allocator_avl_base const &); + Allocator_avl_base &operator = (Allocator_avl_base const &); + protected: class Block : public Avl_node { private: - addr_t _addr; /* base address */ - size_t _size; /* size of block */ - bool _used; /* block is in use */ - short _id; /* for debugging */ - size_t _max_avail; /* biggest free block size of subtree */ + addr_t _addr { 0 }; /* base address */ + size_t _size { 0 }; /* size of block */ + bool _used { false }; /* block is in use */ + short _id { 0 }; /* for debugging */ + size_t _max_avail { 0 }; /* biggest free block size of + sub tree */ /** * Request max_avail value of subtree @@ -85,6 +92,12 @@ class Genode::Allocator_avl_base : public Range_allocator (a - addr() + n <= avail()) && (a + n - 1 <= to); } + /* + * Noncopyable + */ + Block(Block const &); + Block &operator = (Block const &); + public: /** @@ -112,17 +125,15 @@ class Genode::Allocator_avl_base : public Range_allocator inline void used(bool used) { _used = used; } - enum { FREE = false, USED = true }; - /** * Constructor * * This constructor is called from meta-data allocator during * initialization of new meta-data blocks. */ - Block() : _addr(0), _size(0), _used(0), _max_avail(0) { } + Block(); /** * Constructor @@ -155,9 +166,9 @@ class Genode::Allocator_avl_base : public Range_allocator private: - Avl_tree _addr_tree; /* blocks sorted by base address */ - Allocator *_md_alloc; /* meta-data allocator */ - size_t _md_entry_size; /* size of block meta-data entry */ + Avl_tree _addr_tree { }; /* blocks sorted by base address */ + Allocator *_md_alloc { nullptr }; /* meta-data allocator */ + size_t _md_entry_size { 0 }; /* size of block meta-data entry */ /** * Alloc meta-data block diff --git a/repos/base/include/base/allocator_guard.h b/repos/base/include/base/allocator_guard.h index 8d7462e91..5d05937cc 100644 --- a/repos/base/include/base/allocator_guard.h +++ b/repos/base/include/base/allocator_guard.h @@ -33,6 +33,12 @@ class Genode::Allocator_guard : public Allocator size_t _amount; /* total amount */ size_t _consumed; /* already consumed bytes */ + /* + * Noncopyable + */ + Allocator_guard(Allocator_guard const &); + Allocator_guard &operator = (Allocator_guard const &); + public: Allocator_guard(Allocator *allocator, size_t amount) diff --git a/repos/base/include/base/attached_dataspace.h b/repos/base/include/base/attached_dataspace.h index 10ac0e770..460761a3f 100644 --- a/repos/base/include/base/attached_dataspace.h +++ b/repos/base/include/base/attached_dataspace.h @@ -44,6 +44,12 @@ class Genode::Attached_dataspace : Noncopyable throw Region_map::Invalid_dataspace(); } + /* + * Noncopyable + */ + Attached_dataspace(Attached_dataspace const &); + Attached_dataspace &operator = (Attached_dataspace const &); + public: /** diff --git a/repos/base/include/base/attached_io_mem_dataspace.h b/repos/base/include/base/attached_io_mem_dataspace.h index 99174d23b..fe6139230 100644 --- a/repos/base/include/base/attached_io_mem_dataspace.h +++ b/repos/base/include/base/attached_io_mem_dataspace.h @@ -31,6 +31,12 @@ class Genode::Attached_io_mem_dataspace { private: + /* + * Noncopyable + */ + Attached_io_mem_dataspace(Attached_io_mem_dataspace const &); + Attached_io_mem_dataspace &operator = (Attached_io_mem_dataspace const &); + Region_map &_env_rm; Io_mem_connection _mmio; Io_mem_dataspace_capability _ds; diff --git a/repos/base/include/base/attached_ram_dataspace.h b/repos/base/include/base/attached_ram_dataspace.h index 4aa2b99e0..851458df8 100644 --- a/repos/base/include/base/attached_ram_dataspace.h +++ b/repos/base/include/base/attached_ram_dataspace.h @@ -34,12 +34,12 @@ class Genode::Attached_ram_dataspace { private: - size_t _size; - Ram_allocator *_ram; - Region_map *_rm; - Ram_dataspace_capability _ds; + size_t _size = 0; + Ram_allocator *_ram = nullptr; + Region_map *_rm = nullptr; + Ram_dataspace_capability _ds { }; void *_local_addr = nullptr; - Cache_attribute const _cached; + Cache_attribute const _cached = CACHED; template static void _swap(T &v1, T &v2) { T tmp = v1; v1 = v2; v2 = tmp; } @@ -83,6 +83,12 @@ class Genode::Attached_ram_dataspace } } + /* + * Noncopyable + */ + Attached_ram_dataspace(Attached_ram_dataspace const &); + Attached_ram_dataspace &operator = (Attached_ram_dataspace const &); + public: /** diff --git a/repos/base/include/base/attached_rom_dataspace.h b/repos/base/include/base/attached_rom_dataspace.h index cbc1145fe..b16f7b45e 100644 --- a/repos/base/include/base/attached_rom_dataspace.h +++ b/repos/base/include/base/attached_rom_dataspace.h @@ -35,7 +35,7 @@ class Genode::Attached_rom_dataspace * always be valid once constructed, a 'Attached_rom_dataspace' has * to handle the validity of the dataspace. */ - Constructible _ds; + Constructible _ds { }; /** * Try to attach the ROM module, ignore invalid dataspaces diff --git a/repos/base/include/base/cancelable_lock.h b/repos/base/include/base/cancelable_lock.h index 304a1add3..3bcff6ef3 100644 --- a/repos/base/include/base/cancelable_lock.h +++ b/repos/base/include/base/cancelable_lock.h @@ -61,11 +61,12 @@ class Genode::Cancelable_lock * atomically. Hence, we use the additional spinlock here. */ - volatile int _spinlock_state; - volatile int _state; + volatile int _spinlock_state = 0; + volatile int _state = 0; - Applicant* volatile _last_applicant; - Applicant _owner; + Applicant * volatile _last_applicant = nullptr; + + Applicant _owner; public: diff --git a/repos/base/include/base/child.h b/repos/base/include/base/child.h index 6cf6e2ad5..df3adfe78 100644 --- a/repos/base/include/base/child.h +++ b/repos/base/include/base/child.h @@ -253,7 +253,7 @@ class Genode::Child : protected Rpc_object, { private: - struct Initial_thread_base + struct Initial_thread_base : Interface { /** * Start execution at specified instruction pointer @@ -304,16 +304,16 @@ class Genode::Child : protected Rpc_object, Capability_guard _parent_cap_guard; /* signal handlers registered by the child */ - Signal_context_capability _resource_avail_sigh; - Signal_context_capability _yield_sigh; - Signal_context_capability _session_sigh; + Signal_context_capability _resource_avail_sigh { }; + Signal_context_capability _yield_sigh { }; + Signal_context_capability _session_sigh { }; /* arguments fetched by the child in response to a yield signal */ - Lock _yield_request_lock; - Resource_args _yield_request_args; + Lock _yield_request_lock { }; + Resource_args _yield_request_args { }; /* sessions opened by the child */ - Id_space _id_space; + Id_space _id_space { }; /* allocator used for dynamically created session state objects */ Sliced_heap _session_md_alloc { _policy.ref_pd(), _local_rm }; @@ -337,7 +337,7 @@ class Genode::Child : protected Rpc_object, void _try_construct_env_dependent_members(); - Constructible _initial_thread; + Constructible _initial_thread { }; struct Process { @@ -350,7 +350,7 @@ class Genode::Child : protected Rpc_object, * Initial instruction pointer of the new process, as defined * in the header of the executable. */ - addr_t entry; + addr_t entry { 0 }; /** * Constructor parses the executable and sets up segment @@ -414,7 +414,7 @@ class Genode::Child : protected Rpc_object, ~Process(); }; - Constructible _process; + Constructible _process { }; /* * The child's environment sessions @@ -462,7 +462,7 @@ class Genode::Child : protected Rpc_object, /** * Session_state::Ready_callback */ - void session_ready(Session_state &session) override + void session_ready(Session_state &) override { _child._try_construct_env_dependent_members(); } @@ -511,9 +511,9 @@ class Genode::Child : protected Rpc_object, } }; - Constructible _env_service; + Constructible _env_service { }; - Constructible > _connection; + Constructible > _connection { }; /** * Construct session arguments with the child policy applied @@ -582,7 +582,7 @@ class Genode::Child : protected Rpc_object, Env_connection _log { *this, Env::log(), _policy.name() }; Env_connection _binary { *this, Env::binary(), _policy.binary_name() }; - Constructible > _linker; + Constructible > _linker { }; Dataspace_capability _linker_dataspace() { diff --git a/repos/base/include/base/connection.h b/repos/base/include/base/connection.h index 3214121e5..58f1c663e 100644 --- a/repos/base/include/base/connection.h +++ b/repos/base/include/base/connection.h @@ -25,13 +25,13 @@ namespace Genode { } -class Genode::Connection_base : public Noncopyable +class Genode::Connection_base : Noncopyable, Interface { protected: Env &_env; - Parent::Client _parent_client; + Parent::Client _parent_client { }; Id_space::Element const _id_space_element; @@ -91,7 +91,7 @@ class Genode::Connection : public Connection_base char _session_args[FORMAT_STRING_SIZE]; char _affinity_arg[sizeof(Affinity)]; - void _session(Parent &parent, + void _session(Parent &, Affinity const &affinity, const char *format_args, va_list list) { diff --git a/repos/base/include/base/entrypoint.h b/repos/base/include/base/entrypoint.h index 690c71b23..cf3b69d1c 100644 --- a/repos/base/include/base/entrypoint.h +++ b/repos/base/include/base/entrypoint.h @@ -20,7 +20,6 @@ #include #include - namespace Genode { class Startup; class Entrypoint; @@ -28,18 +27,18 @@ namespace Genode { } -class Genode::Entrypoint : Genode::Noncopyable +class Genode::Entrypoint : Noncopyable { public: /** * Functor for post signal-handler hook */ - struct Post_signal_hook { virtual void function() = 0; }; + struct Post_signal_hook : Interface { virtual void function() = 0; }; private: - struct Signal_proxy + struct Signal_proxy : Interface { GENODE_RPC(Rpc_signal, void, signal); GENODE_RPC_INTERFACE(Rpc_signal); @@ -76,13 +75,13 @@ class Genode::Entrypoint : Genode::Noncopyable bool const _signalling_initialized; - Reconstructible _sig_rec; + Reconstructible _sig_rec { }; - Lock _deferred_signals_mutex; - List> _deferred_signals; + Lock _deferred_signals_mutex { }; + List> _deferred_signals { }; void _handle_deferred_signals() { } - Constructible> _deferred_signal_handler; + Constructible> _deferred_signal_handler { }; bool _suspended = false; void (*_suspended_callback) () = nullptr; @@ -92,9 +91,9 @@ class Genode::Entrypoint : Genode::Noncopyable NONE = 0, ENTRYPOINT = 1, SIGNAL_PROXY = 2 }; - int _signal_recipient { NONE }; - Genode::Lock _signal_pending_lock; - Genode::Lock _signal_pending_ack_lock; + int _signal_recipient { NONE }; + Genode::Lock _signal_pending_lock { }; + Genode::Lock _signal_pending_ack_lock { }; Post_signal_hook *_post_signal_hook = nullptr; void _execute_post_signal_hook() @@ -112,7 +111,7 @@ class Genode::Entrypoint : Genode::Noncopyable * resume mechanism. */ void _handle_suspend() { _suspended = true; } - Constructible> _suspend_dispatcher; + Constructible> _suspend_dispatcher { }; void _dispatch_signal(Signal &sig); void _defer_signal(Signal &sig); @@ -120,16 +119,21 @@ class Genode::Entrypoint : Genode::Noncopyable void _process_incoming_signals(); bool _wait_and_dispatch_one_io_signal(bool dont_block); - Constructible _signal_proxy_thread; + Constructible _signal_proxy_thread { }; friend class Startup; - /** * Called by the startup code only */ Entrypoint(Env &env); + /* + * Noncopyable + */ + Entrypoint(Entrypoint const &); + Entrypoint &operator = (Entrypoint const &); + public: Entrypoint(Env &env, size_t stack_size, char const *name); diff --git a/repos/base/include/base/env.h b/repos/base/include/base/env.h index f8a992c47..96935a775 100644 --- a/repos/base/include/base/env.h +++ b/repos/base/include/base/env.h @@ -28,7 +28,7 @@ namespace Genode { struct Env; } -struct Genode::Env +struct Genode::Env : Interface { virtual Parent &parent() = 0; diff --git a/repos/base/include/base/heap.h b/repos/base/include/base/heap.h index 117460341..7088505af 100644 --- a/repos/base/include/base/heap.h +++ b/repos/base/include/base/heap.h @@ -41,6 +41,14 @@ class Genode::Heap : public Allocator class Dataspace : public List::Element { + private: + + /* + * Noncopyable + */ + Dataspace(Dataspace const &); + Dataspace &operator = (Dataspace const &); + public: Ram_dataspace_capability cap; @@ -55,28 +63,38 @@ class Genode::Heap : public Allocator * This structure exists only to make sure that the dataspaces are * destroyed after the AVL allocator. */ - struct Dataspace_pool : public List + class Dataspace_pool : public List { - Ram_allocator *ram_alloc; /* backing store */ - Region_map *region_map; + private: - Dataspace_pool(Ram_allocator *ram, Region_map *rm) - : ram_alloc(ram), region_map(rm) { } + /* + * Noncopyable + */ + Dataspace_pool(Dataspace_pool const &); + Dataspace_pool &operator = (Dataspace_pool const &); - ~Dataspace_pool(); + public: - void remove_and_free(Dataspace &); + Ram_allocator *ram_alloc; /* backing store */ + Region_map *region_map; - void reassign_resources(Ram_allocator *ram, Region_map *rm) { - ram_alloc = ram, region_map = rm; } + Dataspace_pool(Ram_allocator *ram, Region_map *rm) + : ram_alloc(ram), region_map(rm) { } + + ~Dataspace_pool(); + + void remove_and_free(Dataspace &); + + void reassign_resources(Ram_allocator *ram, Region_map *rm) { + ram_alloc = ram, region_map = rm; } }; - Lock _lock; + Lock _lock { }; Reconstructible _alloc; /* local allocator */ Dataspace_pool _ds_pool; /* list of dataspaces */ - size_t _quota_limit; - size_t _quota_used; - size_t _chunk_size; + size_t _quota_limit { 0 }; + size_t _quota_used { 0 }; + size_t _chunk_size { 0 }; /** * Allocate a new dataspace of the specified size @@ -165,11 +183,11 @@ class Genode::Sliced_heap : public Allocator { } }; - Ram_allocator &_ram_alloc; /* RAM allocator for backing store */ - Region_map &_region_map; /* region map of the address space */ - size_t _consumed; /* number of allocated bytes */ - List _blocks; /* list of allocated blocks */ - Lock _lock; /* serialize allocations */ + Ram_allocator &_ram_alloc; /* RAM allocator for backing store */ + Region_map &_region_map; /* region map of the address space */ + size_t _consumed = 0; /* number of allocated bytes */ + List _blocks { }; /* list of allocated blocks */ + Lock _lock { }; /* serialize allocations */ public: diff --git a/repos/base/include/base/id_space.h b/repos/base/include/base/id_space.h index 84c012caa..b7cb484d6 100644 --- a/repos/base/include/base/id_space.h +++ b/repos/base/include/base/id_space.h @@ -85,7 +85,7 @@ class Genode::Id_space : public Noncopyable _obj(obj), _id_space(id_space) { Lock::Guard guard(_id_space._lock); - _id = id_space._unused_id(*this); + _id = id_space._unused_id(); _id_space._elements.insert(this); } @@ -99,7 +99,7 @@ class Genode::Id_space : public Noncopyable _obj(obj), _id_space(id_space), _id(id) { Lock::Guard guard(_id_space._lock); - _id_space._check_conflict(*this, id); + _id_space._check_conflict(id); _id_space._elements.insert(this); } @@ -121,8 +121,8 @@ class Genode::Id_space : public Noncopyable private: - Lock mutable _lock; /* protect '_elements' and '_cnt' */ - Avl_tree _elements; + Lock mutable _lock { }; /* protect '_elements' and '_cnt' */ + Avl_tree _elements { }; unsigned long _cnt = 0; /** @@ -131,7 +131,7 @@ class Genode::Id_space : public Noncopyable * \return ID assigned to the element within the ID space * \throw Out_of_ids */ - Id _unused_id(Element &e) + Id _unused_id() { unsigned long _attempts = 0; for (; _attempts < ~0UL; _attempts++, _cnt++) { @@ -152,7 +152,7 @@ class Genode::Id_space : public Noncopyable * * \throw Conflicting_id */ - void _check_conflict(Element &e, Id id) + void _check_conflict(Id id) { if (_elements.first() && _elements.first()->_lookup(id)) throw Conflicting_id(); diff --git a/repos/base/include/base/ipc.h b/repos/base/include/base/ipc.h index 3175bff33..9d227a2b1 100644 --- a/repos/base/include/base/ipc.h +++ b/repos/base/include/base/ipc.h @@ -58,6 +58,12 @@ class Genode::Ipc_unmarshaller : Noncopyable char *_rcv_buf = (char *)_rcv_msg.data(); size_t const _rcv_buf_size = _rcv_msg.capacity(); + /* + * Noncopyable + */ + Ipc_unmarshaller(Ipc_unmarshaller const &); + Ipc_unmarshaller &operator = (Ipc_unmarshaller const &); + public: /** diff --git a/repos/base/include/base/ipc_msgbuf.h b/repos/base/include/base/ipc_msgbuf.h index eef048f91..459c0100e 100644 --- a/repos/base/include/base/ipc_msgbuf.h +++ b/repos/base/include/base/ipc_msgbuf.h @@ -30,7 +30,7 @@ class Genode::Msgbuf_base : Noncopyable { public: - enum { MAX_CAPS_PER_MSG = 4 }; + static constexpr Genode::size_t MAX_CAPS_PER_MSG = 4; private: @@ -74,6 +74,12 @@ class Genode::Msgbuf_base : Noncopyable word(i) = 0; } + /* + * Noncopyable + */ + Msgbuf_base(Msgbuf_base const &); + Msgbuf_base &operator = (Msgbuf_base const &); + protected: struct Headroom { long space[16]; }; @@ -230,7 +236,7 @@ struct Genode::Msgbuf : Msgbuf_base * This space is used on some platforms to prepend the message with a * protocol header. */ - Headroom headroom; + Headroom headroom { }; /** * Buffer for data payload diff --git a/repos/base/include/base/local_connection.h b/repos/base/include/base/local_connection.h index b47f7c3f3..1969e3a8f 100644 --- a/repos/base/include/base/local_connection.h +++ b/repos/base/include/base/local_connection.h @@ -35,7 +35,7 @@ struct Genode::Local_connection_base : Noncopyable protected: - Constructible _session_state; + Constructible _session_state { }; private: @@ -114,7 +114,7 @@ class Genode::Local_connection : Local_connection_base typedef typename CONNECTION::Session_type SESSION; - Constructible _client; + Constructible _client { }; public: diff --git a/repos/base/include/base/log.h b/repos/base/include/base/log.h index 180dfed14..9f07524b4 100644 --- a/repos/base/include/base/log.h +++ b/repos/base/include/base/log.h @@ -44,11 +44,13 @@ class Genode::Log private: - Lock _lock; - void _acquire(Type); - void _release(); + Lock _lock { }; + Output &_output; + void _acquire(Type); + void _release(); + public: Log(Output &output) : _output(output) { } diff --git a/repos/base/include/base/object_pool.h b/repos/base/include/base/object_pool.h index e79be2562..4e74e8186 100644 --- a/repos/base/include/base/object_pool.h +++ b/repos/base/include/base/object_pool.h @@ -33,16 +33,17 @@ namespace Genode { template class Object_pool; } * objects managed by one and the same object pool. */ template -class Genode::Object_pool +class Genode::Object_pool : Interface, Noncopyable { public: - class Entry : public Avl_node + class Entry : Avl_node { private: friend class Object_pool; friend class Avl_tree; + friend class Avl_node; struct Entry_lock : Weak_object, Noncopyable { @@ -53,7 +54,7 @@ class Genode::Object_pool Weak_object::lock_for_destruction(); } }; - Untyped_capability _cap; + Untyped_capability _cap { }; Entry_lock _lock { *this }; inline unsigned long _obj_id() { return _cap.local_name(); } @@ -93,8 +94,8 @@ class Genode::Object_pool private: - Avl_tree _tree; - Lock _lock; + Avl_tree _tree { }; + Lock _lock { }; protected: diff --git a/repos/base/include/base/output.h b/repos/base/include/base/output.h index 59fee57a0..119c79a9c 100644 --- a/repos/base/include/base/output.h +++ b/repos/base/include/base/output.h @@ -15,11 +15,12 @@ #define _INCLUDE__BASE__OUTPUT_H_ #include +#include namespace Genode { struct Output; } -struct Genode::Output +struct Genode::Output : Interface { /** * Output single character diff --git a/repos/base/include/base/quota_guard.h b/repos/base/include/base/quota_guard.h index 8f4379385..90963f976 100644 --- a/repos/base/include/base/quota_guard.h +++ b/repos/base/include/base/quota_guard.h @@ -132,7 +132,7 @@ class Genode::Quota_guard { private: - Quota_guard_untyped _guard; + Quota_guard_untyped _guard { }; public: diff --git a/repos/base/include/base/quota_transfer.h b/repos/base/include/base/quota_transfer.h index 6776135d7..eb511af33 100644 --- a/repos/base/include/base/quota_transfer.h +++ b/repos/base/include/base/quota_transfer.h @@ -46,7 +46,7 @@ class Genode::Quota_transfer class Quota_exceeded : Exception { }; - struct Account : Noncopyable + struct Account : Noncopyable, Interface { /** * Return capability used for transfers to the account @@ -68,7 +68,7 @@ class Genode::Quota_transfer * \throw Invalid_session * \throw Undefined_ref_account */ - virtual void transfer(Capability to, UNIT amount) { } + virtual void transfer(Capability, UNIT) { } /** * Try to transfer quota, ignoring possible exceptions diff --git a/repos/base/include/base/ram_allocator.h b/repos/base/include/base/ram_allocator.h index 1569f5afd..84baf7b8d 100644 --- a/repos/base/include/base/ram_allocator.h +++ b/repos/base/include/base/ram_allocator.h @@ -31,7 +31,7 @@ namespace Genode { } -struct Genode::Ram_allocator +struct Genode::Ram_allocator : Interface { /** * Allocate RAM dataspace diff --git a/repos/base/include/base/registry.h b/repos/base/include/base/registry.h index 643dbb023..ada4d227a 100644 --- a/repos/base/include/base/registry.h +++ b/repos/base/include/base/registry.h @@ -14,6 +14,7 @@ #ifndef _INCLUDE__BASE__REGISTRY_H_ #define _INCLUDE__BASE__REGISTRY_H_ +#include #include #include @@ -30,9 +31,10 @@ class Genode::Registry_base { private: - struct Notify { + struct Notify + { enum Keep { KEEP, DISCARD } keep; - void * thread; + void * const thread; Notify(Keep k, void *t) : keep(k), thread(t) { } }; @@ -50,13 +52,19 @@ class Genode::Registry_base /** * Protect '_reinsert_ptr' */ - Lock _lock; + Lock _lock { }; /* * Assigned by 'Registry::_for_each' */ Notify *_notify_ptr = nullptr; + /* + * Noncopyable + */ + Element(Element const &); + Element &operator = (Element const &); + protected: void * const _obj; @@ -70,8 +78,8 @@ class Genode::Registry_base protected: - Lock mutable _lock; /* protect '_elements' */ - List _elements; + Lock mutable _lock { }; /* protect '_elements' */ + List _elements { }; private: @@ -87,7 +95,7 @@ class Genode::Registry_base protected: - struct Untyped_functor { virtual void call(void *obj_ptr) = 0; }; + struct Untyped_functor : Interface { virtual void call(void *obj_ptr) = 0; }; void _for_each(Untyped_functor &); }; diff --git a/repos/base/include/base/rpc.h b/repos/base/include/base/rpc.h index ba1d05fee..db31fbfc2 100644 --- a/repos/base/include/base/rpc.h +++ b/repos/base/include/base/rpc.h @@ -48,7 +48,7 @@ (server, args, &SERVER::func_name); } \ \ static const char* name() { return #func_name; } \ - }; + } /** * Shortcut for 'GENODE_RPC_THROW' for an RPC that throws no exceptions diff --git a/repos/base/include/base/rpc_args.h b/repos/base/include/base/rpc_args.h index 9f86c0fef..16d1520c0 100644 --- a/repos/base/include/base/rpc_args.h +++ b/repos/base/include/base/rpc_args.h @@ -97,10 +97,11 @@ class Genode::Rpc_in_buffer : public Rpc_in_buffer_base */ Rpc_in_buffer() { } - void operator = (Rpc_in_buffer const &from) + Rpc_in_buffer &operator = (Rpc_in_buffer const &from) { _base = from.base(); _size = from.size(); + return *this; } /** diff --git a/repos/base/include/base/rpc_client.h b/repos/base/include/base/rpc_client.h index 0dd146f0d..f2406c7bd 100644 --- a/repos/base/include/base/rpc_client.h +++ b/repos/base/include/base/rpc_client.h @@ -174,13 +174,38 @@ namespace Genode { * simple wrapper in the line of 'return call(arguments...)'. */ template -struct Genode::Rpc_client : Capability, RPC_INTERFACE +class Genode::Rpc_client : public RPC_INTERFACE { - typedef RPC_INTERFACE Rpc_interface; + private: - Rpc_client(Capability const &cap) - : Capability(cap) { } + Capability _cap; + + public: + + typedef RPC_INTERFACE Rpc_interface; + + Rpc_client(Capability const &cap) : _cap(cap) { } + + template + typename IF::Ret_type call(ARGS &&...args) + { + return _cap.call(args...); + } + + template + typename IF::Ret_type call(ARGS &&...args) const + { + return _cap.call(args...); + } + + /** + * Return RPC capablity for client object + * + * \deprecated use 'rpc_cap' accessor instead + */ + operator Capability() const { return _cap; } + + Capability rpc_cap() const { return _cap; } }; - #endif /* _INCLUDE__BASE__RPC_CLIENT_H_ */ diff --git a/repos/base/include/base/rpc_server.h b/repos/base/include/base/rpc_server.h index dbe789785..2ebb8e8fc 100644 --- a/repos/base/include/base/rpc_server.h +++ b/repos/base/include/base/rpc_server.h @@ -80,7 +80,7 @@ class Genode::Rpc_dispatcher : public RPC_INTERFACE return args; } - Meta::Empty _read_args(Ipc_unmarshaller &msg, + Meta::Empty _read_args(Ipc_unmarshaller &, Meta::Overload_selector) { return Meta::Empty(); @@ -212,7 +212,7 @@ class Genode::Rpc_dispatcher : public RPC_INTERFACE /** * Handle corner case of having an RPC interface with no RPC functions */ - Rpc_exception_code _do_dispatch(Rpc_opcode opcode, + Rpc_exception_code _do_dispatch(Rpc_opcode, Ipc_unmarshaller &, Msgbuf_base &, Meta::Overload_selector >) { @@ -307,11 +307,11 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool * Prototype capability to derive capabilities for RPC objects * from. */ - Untyped_capability _cap; + Untyped_capability _cap { }; enum { SND_BUF_SIZE = 1024, RCV_BUF_SIZE = 1024 }; - Msgbuf _snd_buf; - Msgbuf _rcv_buf; + Msgbuf _snd_buf { }; + Msgbuf _rcv_buf { }; /** * Hook to let low-level thread init code access private members @@ -320,7 +320,7 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool */ static void _activation_entry(); - struct Exit + struct Exit : Genode::Interface { GENODE_RPC(Rpc_exit, void, _exit); GENODE_RPC_INTERFACE(Rpc_exit); @@ -337,13 +337,13 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool protected: - Native_capability _caller; - Lock _cap_valid; /* thread startup synchronization */ - Lock _delay_start; /* delay start of request dispatching */ - Lock _delay_exit; /* delay destructor until server settled */ - Pd_session &_pd_session; /* for creating capabilities */ - Exit_handler _exit_handler; - Capability _exit_cap; + Native_capability _caller { }; + Lock _cap_valid { }; /* thread startup synchronization */ + Lock _delay_start { }; /* delay start of request dispatching */ + Lock _delay_exit { }; /* delay destructor until server settled */ + Pd_session &_pd_session; /* for creating capabilities */ + Exit_handler _exit_handler { }; + Capability _exit_cap { }; /** * Access to kernel-specific part of the PD session interface @@ -351,7 +351,7 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool * Some kernels like NOVA need a special interface for creating RPC * object capabilities. */ - Capability _native_pd_cap; + Capability _native_pd_cap { }; /** * Back end used to associate RPC object with the entry point diff --git a/repos/base/include/base/semaphore.h b/repos/base/include/base/semaphore.h index 1ba0117a5..10178436c 100644 --- a/repos/base/include/base/semaphore.h +++ b/repos/base/include/base/semaphore.h @@ -26,7 +26,7 @@ class Genode::Semaphore protected: int _cnt; - Lock _meta_lock; + Lock _meta_lock { }; struct Element : Fifo::Element { @@ -36,7 +36,7 @@ class Genode::Semaphore void wake_up() { lock.unlock(); } }; - Fifo _queue; + Fifo _queue { }; public: diff --git a/repos/base/include/base/service.h b/repos/base/include/base/service.h index 65c2a673a..abe9cf565 100644 --- a/repos/base/include/base/service.h +++ b/repos/base/include/base/service.h @@ -109,7 +109,7 @@ class Genode::Local_service : public Service { public: - struct Factory + struct Factory : Interface { typedef Session_state::Args Args; @@ -346,7 +346,7 @@ class Genode::Async_service : public Service { public: - struct Wakeup { virtual void wakeup_async_service() = 0; }; + struct Wakeup : Interface { virtual void wakeup_async_service() = 0; }; private: @@ -421,7 +421,7 @@ class Genode::Child_service : public Async_service Id_space &server_id_space, Session_state::Factory &factory, Wakeup &wakeup, - Pd_session_capability ram, + Pd_session_capability, Pd_session_capability pd) : Async_service(name, server_id_space, factory, wakeup), _pd(pd) diff --git a/repos/base/include/base/session_object.h b/repos/base/include/base/session_object.h index 78943e211..b9d47e7a3 100644 --- a/repos/base/include/base/session_object.h +++ b/repos/base/include/base/session_object.h @@ -21,9 +21,9 @@ namespace Genode { template struct Session_object; } template -class Genode::Session_object : public Ram_quota_guard, - public Cap_quota_guard, - public Rpc_object +class Genode::Session_object : private Ram_quota_guard, + private Cap_quota_guard, + public Rpc_object { public: @@ -31,6 +31,13 @@ class Genode::Session_object : public Ram_quota_guard, typedef Session::Diag Diag; typedef Session::Resources Resources; + using Ram_quota_guard::withdraw; + using Cap_quota_guard::withdraw; + using Ram_quota_guard::replenish; + using Cap_quota_guard::replenish; + using Ram_quota_guard::upgrade; + using Cap_quota_guard::upgrade; + private: Rpc_entrypoint &_ep; @@ -41,6 +48,9 @@ class Genode::Session_object : public Ram_quota_guard, Label const _label; + Ram_quota_guard &_ram_quota_guard() { return *this; } + Cap_quota_guard &_cap_quota_guard() { return *this; } + public: /** diff --git a/repos/base/include/base/session_state.h b/repos/base/include/base/session_state.h index f3cc9a0c1..6edde1935 100644 --- a/repos/base/include/base/session_state.h +++ b/repos/base/include/base/session_state.h @@ -31,8 +31,7 @@ namespace Genode { } -class Genode::Session_state : public Parent::Client, public Parent::Server, - Noncopyable +class Genode::Session_state : public Parent::Client, public Parent::Server { public: @@ -41,12 +40,12 @@ class Genode::Session_state : public Parent::Client, public Parent::Server, typedef String<32> Name; typedef String<256> Args; - struct Ready_callback + struct Ready_callback : Interface { virtual void session_ready(Session_state &) = 0; }; - struct Closed_callback + struct Closed_callback : Interface { virtual void session_closed(Session_state &) = 0; }; @@ -69,14 +68,20 @@ class Genode::Session_state : public Parent::Client, public Parent::Server, Args _args; Affinity _affinity; + /* + * Noncopyable + */ + Session_state(Session_state const &); + Session_state &operator = (Session_state const &); + public: - Constructible::Element> id_at_server; + Constructible::Element> id_at_server { }; /* ID for session requests towards the parent */ - Constructible::Element> id_at_parent; + Constructible::Element> id_at_parent { }; - Parent::Client parent_client; + Parent::Client parent_client { }; enum Phase { CREATE_REQUESTED, SERVICE_DENIED, @@ -106,7 +111,7 @@ class Genode::Session_state : public Parent::Client, public Parent::Server, */ Session *local_ptr = nullptr; - Session_capability cap; + Session_capability cap { }; Ram_quota ram_upgrade { 0 }; Cap_quota cap_upgrade { 0 }; diff --git a/repos/base/include/base/shared_object.h b/repos/base/include/base/shared_object.h index 409224c3b..cf586a9d7 100644 --- a/repos/base/include/base/shared_object.h +++ b/repos/base/include/base/shared_object.h @@ -35,6 +35,12 @@ class Genode::Shared_object Allocator &_md_alloc; + /* + * Noncopyable + */ + Shared_object(Shared_object const &); + Shared_object &operator = (Shared_object const &); + public: class Invalid_rom_module : public Genode::Exception { }; @@ -102,10 +108,10 @@ class Genode::Shared_object struct Genode::Address_info { - char const *path; /* path of shared object */ - Genode::addr_t base; /* base of shared object */ - char const *name; /* name of symbol */ - Genode::addr_t addr; /* address of symbol */ + char const *path { nullptr }; /* path of shared object */ + Genode::addr_t base { 0 }; /* base of shared object */ + char const *name { nullptr }; /* name of symbol */ + Genode::addr_t addr { 0 }; /* address of symbol */ class Invalid_address : public Genode::Exception { }; diff --git a/repos/base/include/base/signal.h b/repos/base/include/base/signal.h index 9710f219c..f7522c64c 100644 --- a/repos/base/include/base/signal.h +++ b/repos/base/include/base/signal.h @@ -134,7 +134,7 @@ class Genode::Signal_transmitter { private: - Signal_context_capability _context; /* destination */ + Signal_context_capability _context { }; /* destination */ public: @@ -180,7 +180,7 @@ class Genode::Signal_transmitter * 'wait_and_dispatch_one_io_signal', which defers signals corresponding to * application-level contexts and dispatches only I/O-level signals. */ -class Genode::Signal_context +class Genode::Signal_context : Interface, Noncopyable { public: @@ -197,12 +197,12 @@ class Genode::Signal_context /** * List element in process-global registry */ - List_element _registry_le; + List_element _registry_le { this }; /** * List element in deferred application signal list */ - List_element _deferred_le; + List_element _deferred_le { this }; /** * Receiver to which the context is associated with @@ -210,14 +210,14 @@ class Genode::Signal_context * This member is initialized by the receiver when associating * the context with the receiver via the 'cap' method. */ - Signal_receiver *_receiver; + Signal_receiver *_receiver { nullptr }; - Lock _lock; /* protect '_curr_signal' */ - Signal::Data _curr_signal; /* most-currently received signal */ - bool _pending; /* current signal is valid */ - unsigned int _ref_cnt; /* number of references to this context */ - Lock _destroy_lock; /* prevent destruction while the - context is in use */ + Lock _lock { }; /* protect '_curr_signal' */ + Signal::Data _curr_signal { }; /* most-currently received signal */ + bool _pending { false }; /* current signal is valid */ + unsigned int _ref_cnt { 0 }; /* number of references to context */ + Lock _destroy_lock { }; /* prevent destruction while the + context is in use */ /** * Capability assigned to this context after being assocated with @@ -225,24 +225,25 @@ class Genode::Signal_context * capability in the 'Signal_context' for the mere reason to * properly destruct the context (see '_unsynchronized_dissolve'). */ - Signal_context_capability _cap; + Signal_context_capability _cap { }; friend class Signal; friend class Signal_receiver; friend class Signal_context_registry; + /* + * Noncopyable + */ + Signal_context &operator = (Signal_context const &); + Signal_context(Signal_context const &); + protected: Level _level = Level::App; public: - /** - * Constructor - */ - Signal_context() - : _registry_le(this), _deferred_le(this), _receiver(0), _pending(0), - _ref_cnt(0) { } + Signal_context() { } /** * Destructor @@ -326,19 +327,19 @@ class Genode::Signal_receiver : Noncopyable * Semaphore used to indicate that signal(s) are ready to be picked * up. This is needed for platforms other than 'base-hw' only. */ - Semaphore _signal_available; + Semaphore _signal_available { }; /** * Provides the kernel-object name via the 'dst' method. This is * needed for 'base-hw' only. */ - Capability _cap; + Capability _cap { }; /** * List of associated contexts */ - Lock _contexts_lock; - Context_ring _contexts; + Lock _contexts_lock { }; + Context_ring _contexts { }; /** * Helper to dissolve given context @@ -470,11 +471,11 @@ struct Genode::Signal_dispatcher_base : Signal_context * \param T type of signal-handling class */ template -class Genode::Signal_dispatcher : public Signal_dispatcher_base, - public Signal_context_capability +class Genode::Signal_dispatcher : public Signal_dispatcher_base { private: + Signal_context_capability _cap; T &obj; void (T::*member) (unsigned); Signal_receiver &sig_rec; @@ -492,7 +493,7 @@ class Genode::Signal_dispatcher : public Signal_dispatcher_base, Signal_dispatcher(Signal_receiver &sig_rec, T &obj, void (T::*member)(unsigned)) : - Signal_context_capability(sig_rec.manage(this)), + _cap(sig_rec.manage(this)), obj(obj), member(member), sig_rec(sig_rec) { } @@ -500,6 +501,8 @@ class Genode::Signal_dispatcher : public Signal_dispatcher_base, ~Signal_dispatcher() { sig_rec.dissolve(this); } void dispatch(unsigned num) override { (obj.*member)(num); } + + operator Capability() const { return _cap; } }; @@ -528,30 +531,43 @@ struct Genode::Io_signal_dispatcher : Signal_dispatcher * \param EP type of entrypoint handling signal RPC */ template -struct Genode::Signal_handler : Genode::Signal_dispatcher_base, - Genode::Signal_context_capability +class Genode::Signal_handler : public Signal_dispatcher_base { - EP &ep; - T &obj; - void (T::*member) (); + private: - /** - * Constructor - * - * \param ep entrypoint managing this signal RPC - * \param obj,member object and method to call when - * the signal occurs - */ - Signal_handler(EP &ep, T &obj, void (T::*member)()) - : Signal_context_capability(ep.manage(*this)), - ep(ep), obj(obj), member(member) { } + Signal_context_capability _cap; + EP &_ep; + T &_obj; + void (T::*_member) (); - ~Signal_handler() { ep.dissolve(*this); } + /* + * Noncopyable + */ + Signal_handler(Signal_handler const &); + Signal_handler &operator = (Signal_handler const &); - /** - * Interface of Signal_dispatcher_base - */ - void dispatch(unsigned num) override { (obj.*member)(); } + public: + + /** + * Constructor + * + * \param ep entrypoint managing this signal RPC + * \param obj,member object and method to call when + * the signal occurs + */ + Signal_handler(EP &ep, T &obj, void (T::*member)()) + : + _cap(ep.manage(*this)), _ep(ep), _obj(obj), _member(member) + { } + + ~Signal_handler() { _ep.dissolve(*this); } + + /** + * Interface of Signal_dispatcher_base + */ + void dispatch(unsigned) override { (_obj.*_member)(); } + + operator Capability() const { return _cap; } }; diff --git a/repos/base/include/base/slab.h b/repos/base/include/base/slab.h index 6954b4760..9aaa8e197 100644 --- a/repos/base/include/base/slab.h +++ b/repos/base/include/base/slab.h @@ -83,6 +83,12 @@ class Genode::Slab : public Allocator */ void _free(void *addr); + /* + * Noncopyable + */ + Slab(Slab const &); + Slab &operator = (Slab const &); + public: /** diff --git a/repos/base/include/base/snprintf.h b/repos/base/include/base/snprintf.h index c22c99c87..999dbe19e 100644 --- a/repos/base/include/base/snprintf.h +++ b/repos/base/include/base/snprintf.h @@ -41,7 +41,13 @@ class Genode::String_console : public Console char *_dst; size_t _dst_len; - size_t _w_offset; + size_t _w_offset { 0 }; + + /* + * Noncopyable + */ + String_console &operator = (String_console const &); + String_console(String_console const &); public: @@ -52,7 +58,7 @@ class Genode::String_console : public Console * \param dst_len size of 'dst' */ String_console(char *dst, size_t dst_len) - : _dst(dst), _dst_len(dst_len), _w_offset(0) + : _dst(dst), _dst_len(dst_len) { _dst[0] = 0; } /** diff --git a/repos/base/include/base/synced_allocator.h b/repos/base/include/base/synced_allocator.h index 87d048a9e..bf168ed7d 100644 --- a/repos/base/include/base/synced_allocator.h +++ b/repos/base/include/base/synced_allocator.h @@ -36,7 +36,7 @@ class Genode::Synced_allocator : public Allocator { private: - Lock _lock; + Lock _lock { }; ALLOC _alloc; Synced_interface _synced_object; diff --git a/repos/base/include/base/synced_interface.h b/repos/base/include/base/synced_interface.h index 474fb079e..ed1348e01 100644 --- a/repos/base/include/base/synced_interface.h +++ b/repos/base/include/base/synced_interface.h @@ -53,10 +53,15 @@ class Genode::Synced_interface friend class Synced_interface; + Guard &operator = (Guard const &); + public: ~Guard() { _lock.unlock(); } + Guard(Guard const &other) + : _lock(other._lock), _interface(other._interface) { } + IF *operator -> () { return _interface; } }; diff --git a/repos/base/include/base/thread.h b/repos/base/include/base/thread.h index 13c843593..9e5d2980b 100644 --- a/repos/base/include/base/thread.h +++ b/repos/base/include/base/thread.h @@ -89,6 +89,12 @@ class Genode::Thread */ void _deinit_platform_thread(); + /* + * Noncopyable + */ + Thread(Thread const &); + Thread &operator = (Thread const &); + protected: /** @@ -96,7 +102,7 @@ class Genode::Thread * * Used if thread creation involves core's CPU service. */ - Thread_capability _thread_cap; + Thread_capability _thread_cap { }; /** * Pointer to cpu session used for this thread @@ -138,7 +144,7 @@ class Genode::Thread private: - Trace::Logger _trace_logger; + Trace::Logger _trace_logger { }; /** * Return 'Trace::Logger' instance of calling thread diff --git a/repos/base/include/base/trace/logger.h b/repos/base/include/base/trace/logger.h index f958d9baa..f5ffe2cf6 100644 --- a/repos/base/include/base/trace/logger.h +++ b/repos/base/include/base/trace/logger.h @@ -32,19 +32,24 @@ struct Genode::Trace::Logger { private: - Thread_capability thread_cap; - Cpu_session *cpu; - Control *control; - bool enabled; - unsigned policy_version; - Policy_module *policy_module; - Buffer *buffer; - size_t max_event_size; - - bool pending_init; + Thread_capability thread_cap { }; + Cpu_session *cpu { nullptr }; + Control *control { nullptr }; + bool enabled { false }; + unsigned policy_version { 0 }; + Policy_module *policy_module { 0 }; + Buffer *buffer { nullptr }; + size_t max_event_size { 0 }; + bool pending_init { false }; bool _evaluate_control(); + /* + * Noncopyable + */ + Logger(Logger const &); + Logger &operator = (Logger const &); + public: Logger(); diff --git a/repos/base/include/base/trace/types.h b/repos/base/include/base/trace/types.h index 4bbf86bd0..cb198bb08 100644 --- a/repos/base/include/base/trace/types.h +++ b/repos/base/include/base/trace/types.h @@ -108,16 +108,16 @@ class Genode::Trace::Subject_info private: - Session_label _session_label; - Thread_name _thread_name; - State _state; - Policy_id _policy_id; - Execution_time _execution_time; - Affinity::Location _affinity; + Session_label _session_label { }; + Thread_name _thread_name { }; + State _state { INVALID }; + Policy_id _policy_id { 0 }; + Execution_time _execution_time { 0 }; + Affinity::Location _affinity { }; public: - Subject_info() : _state(INVALID) { } + Subject_info() { } Subject_info(Session_label const &session_label, Thread_name const &thread_name, diff --git a/repos/base/include/base/weak_ptr.h b/repos/base/include/base/weak_ptr.h index 588d42931..dca659f31 100644 --- a/repos/base/include/base/weak_ptr.h +++ b/repos/base/include/base/weak_ptr.h @@ -42,8 +42,9 @@ class Genode::Weak_ptr_base : public Genode::List::Element friend class Weak_object_base; friend class Locked_ptr_base; - Lock mutable _lock; - Weak_object_base *_obj; + Lock mutable _lock { }; + + Weak_object_base *_obj { nullptr }; /* * This lock is used to synchronize destruction of a weak pointer @@ -54,6 +55,8 @@ class Genode::Weak_ptr_base : public Genode::List::Element inline void _adopt(Weak_object_base *obj); inline void _disassociate(); + Weak_ptr_base(Weak_ptr_base const &); + protected: explicit inline Weak_ptr_base(Weak_object_base *obj); @@ -63,14 +66,14 @@ class Genode::Weak_ptr_base : public Genode::List::Element /** * Default constructor, produces invalid pointer */ - inline Weak_ptr_base(); + Weak_ptr_base() { } inline ~Weak_ptr_base(); /** * Assignment operator */ - inline void operator = (Weak_ptr_base const &other); + inline Weak_ptr_base &operator = (Weak_ptr_base const &other); /** * Test for equality @@ -106,8 +109,8 @@ class Genode::Weak_object_base /** * List of weak pointers currently pointing to the object */ - Lock _list_lock; - List _list; + Lock _list_lock { }; + List _list { }; /** * Buffers dequeued weak pointer that get invalidated currently @@ -117,7 +120,7 @@ class Genode::Weak_object_base /** * Lock to synchronize access to object */ - Lock _lock; + Lock _lock { }; protected: @@ -221,9 +224,17 @@ class Genode::Weak_object_base class Genode::Locked_ptr_base { + private: + + /* + * Noncopyable + */ + Locked_ptr_base(Locked_ptr_base const &); + Locked_ptr_base &operator = (Locked_ptr_base const &); + protected: - Weak_object_base *curr; + Weak_object_base *curr = nullptr; /** * Constructor @@ -268,9 +279,10 @@ struct Genode::Weak_ptr : Genode::Weak_ptr_base /** * Assignment operator */ - inline void operator = (Weak_ptr const &other) + inline Weak_ptr &operator = (Weak_ptr const &other) { *static_cast(this) = other; + return *this; } }; @@ -387,20 +399,19 @@ Genode::Weak_ptr_base::Weak_ptr_base(Genode::Weak_object_base *obj) } -Genode::Weak_ptr_base::Weak_ptr_base() : _obj(nullptr) { } - - -void Genode::Weak_ptr_base::operator = (Weak_ptr_base const &other) +Genode::Weak_ptr_base & +Genode::Weak_ptr_base::operator = (Weak_ptr_base const &other) { /* self assignment */ if (&other == this) - return; + return *this; _disassociate(); { Lock::Guard guard(other._lock); _adopt(other._obj); } + return *this; } diff --git a/repos/base/include/cpu_session/cpu_session.h b/repos/base/include/cpu_session/cpu_session.h index 0f44b7c77..aff047bbe 100644 --- a/repos/base/include/cpu_session/cpu_session.h +++ b/repos/base/include/cpu_session/cpu_session.h @@ -219,7 +219,7 @@ struct Genode::Cpu_session : Session /** * Common base class of kernel-specific CPU interfaces */ - struct Native_cpu { }; + struct Native_cpu : Interface { }; /** * Return capability to kernel-specific CPU operations diff --git a/repos/base/include/cpu_thread/cpu_thread.h b/repos/base/include/cpu_thread/cpu_thread.h index 3cb70e377..e0c23fd7b 100644 --- a/repos/base/include/cpu_thread/cpu_thread.h +++ b/repos/base/include/cpu_thread/cpu_thread.h @@ -24,7 +24,7 @@ namespace Genode { struct Cpu_thread; } -struct Genode::Cpu_thread +struct Genode::Cpu_thread : Interface { class State_access_failed : public Exception { }; diff --git a/repos/base/include/dataspace/dataspace.h b/repos/base/include/dataspace/dataspace.h index 51381d6ac..295df0744 100644 --- a/repos/base/include/dataspace/dataspace.h +++ b/repos/base/include/dataspace/dataspace.h @@ -20,7 +20,7 @@ namespace Genode { struct Dataspace; } -struct Genode::Dataspace +struct Genode::Dataspace : Interface { virtual ~Dataspace() { } diff --git a/repos/base/include/deprecated/env.h b/repos/base/include/deprecated/env.h index a692afbe9..cd7576593 100644 --- a/repos/base/include/deprecated/env.h +++ b/repos/base/include/deprecated/env.h @@ -61,7 +61,7 @@ namespace Genode { * class allows the component to interact with its environment. It is * initialized at the startup of the component. */ -struct Genode::Env_deprecated +struct Genode::Env_deprecated : Interface { /** * Communication channel to our parent diff --git a/repos/base/include/drivers/uart/x86_pc.h b/repos/base/include/drivers/uart/x86_pc.h index 4b5466ade..8e2e84bef 100644 --- a/repos/base/include/drivers/uart/x86_pc.h +++ b/repos/base/include/drivers/uart/x86_pc.h @@ -56,7 +56,7 @@ class Genode::X86_uart public: - X86_uart(addr_t const port, unsigned const clock, + X86_uart(addr_t const port, unsigned /* clock */, unsigned const baud_rate) : _port(port) { diff --git a/repos/base/include/io_mem_session/connection.h b/repos/base/include/io_mem_session/connection.h index a52c26cba..0f02ac5c5 100644 --- a/repos/base/include/io_mem_session/connection.h +++ b/repos/base/include/io_mem_session/connection.h @@ -27,7 +27,7 @@ struct Genode::Io_mem_connection : Connection, Io_mem_session_cl * * \noapi */ - Capability _session(Parent &parent, addr_t base, size_t size, + Capability _session(Parent &, addr_t base, size_t size, bool write_combined) { return session("cap_quota=%u, ram_quota=6K, base=0x%p, size=0x%lx, wc=%s", diff --git a/repos/base/include/irq_session/connection.h b/repos/base/include/irq_session/connection.h index e2485aac1..684fa3743 100644 --- a/repos/base/include/irq_session/connection.h +++ b/repos/base/include/irq_session/connection.h @@ -26,7 +26,7 @@ struct Genode::Irq_connection : Connection, Irq_session_client * * \noapi */ - Capability _session(Parent &parent, + Capability _session(Parent &, unsigned irq, Irq_session::Trigger trigger, Irq_session::Polarity polarity, diff --git a/repos/base/include/parent/parent.h b/repos/base/include/parent/parent.h index c030db28d..b0d758584 100644 --- a/repos/base/include/parent/parent.h +++ b/repos/base/include/parent/parent.h @@ -57,8 +57,8 @@ class Genode::Parent typedef Rpc_in_buffer<160> Session_args; typedef Rpc_in_buffer<160> Upgrade_args; - struct Client { typedef Id_space::Id Id; }; - struct Server { typedef Id_space::Id Id; }; + struct Client : Interface { typedef Id_space::Id Id; }; + struct Server : Interface { typedef Id_space::Id Id; }; /** * Predefined session IDs corresponding to the environment sessions diff --git a/repos/base/include/pd_session/pd_session.h b/repos/base/include/pd_session/pd_session.h index 5e4e714d0..380e37bd8 100644 --- a/repos/base/include/pd_session/pd_session.h +++ b/repos/base/include/pd_session/pd_session.h @@ -291,7 +291,7 @@ struct Genode::Pd_session : Session, Ram_allocator /** * Common base class of kernel-specific PD interfaces */ - struct Native_pd { }; + struct Native_pd : Interface { }; /** * Return capability to kernel-specific PD operations diff --git a/repos/base/include/region_map/client.h b/repos/base/include/region_map/client.h index a069ed65b..911723e9b 100644 --- a/repos/base/include/region_map/client.h +++ b/repos/base/include/region_map/client.h @@ -35,7 +35,7 @@ class Genode::Region_map_client : public Rpc_client * * On all other base platforms, this member variable remains unused. */ - Dataspace_capability _rm_ds_cap; + Dataspace_capability _rm_ds_cap { }; public: diff --git a/repos/base/include/region_map/region_map.h b/repos/base/include/region_map/region_map.h index 370c37fab..5afa9d7d6 100644 --- a/repos/base/include/region_map/region_map.h +++ b/repos/base/include/region_map/region_map.h @@ -24,7 +24,7 @@ namespace Genode { struct Region_map; } -struct Genode::Region_map +struct Genode::Region_map : Interface { /** * State of region map diff --git a/repos/base/include/rom_session/connection.h b/repos/base/include/rom_session/connection.h index 77f9f1ea3..0a07208b3 100644 --- a/repos/base/include/rom_session/connection.h +++ b/repos/base/include/rom_session/connection.h @@ -32,7 +32,7 @@ class Genode::Rom_connection : public Connection, private: - Rom_session_capability _session(Parent &parent, char const *label) + Rom_session_capability _session(Parent &, char const *label) { return session("ram_quota=%ld, cap_quota=%ld, label=\"%s\"", RAM_QUOTA, CAP_QUOTA, label); diff --git a/repos/base/include/root/component.h b/repos/base/include/root/component.h index 6b4d6298b..e1038b28e 100644 --- a/repos/base/include/root/component.h +++ b/repos/base/include/root/component.h @@ -203,6 +203,12 @@ class Genode::Root_component : public Rpc_object >, return *s; } + /* + * Noncopyable + */ + Root_component(Root_component const &); + Root_component &operator = (Root_component const &); + protected: /** @@ -233,7 +239,7 @@ class Genode::Root_component : public Rpc_object >, return _create_session(args); } - virtual SESSION_TYPE *_create_session(const char *args) + virtual SESSION_TYPE *_create_session(const char *) { throw Service_denied(); } diff --git a/repos/base/include/spec/arm/cpu/cpu_state.h b/repos/base/include/spec/arm/cpu/cpu_state.h index 2fc531df0..438898007 100644 --- a/repos/base/include/spec/arm/cpu/cpu_state.h +++ b/repos/base/include/spec/arm/cpu/cpu_state.h @@ -47,13 +47,16 @@ struct Genode::Cpu_state /** * Registers */ - addr_t r0, r1, r2, r3, r4, r5, r6, - r7, r8, r9, r10, r11, r12; /* general purpose register 0..12 */ - addr_t sp; /* stack pointer */ - addr_t lr; /* link register */ - addr_t ip; /* instruction pointer */ - addr_t cpsr; /* current program status register */ - addr_t cpu_exception; /* last hardware exception */ + struct + { + addr_t r0, r1, r2, r3, r4, r5, r6, + r7, r8, r9, r10, r11, r12; /* general purpose register 0..12 */ + addr_t sp; /* stack pointer */ + addr_t lr; /* link register */ + addr_t ip; /* instruction pointer */ + addr_t cpsr; /* current program status register */ + addr_t cpu_exception; /* last hardware exception */ + }; }; diff --git a/repos/base/include/trace_session/client.h b/repos/base/include/trace_session/client.h index 478632308..dc12f3388 100644 --- a/repos/base/include/trace_session/client.h +++ b/repos/base/include/trace_session/client.h @@ -29,23 +29,33 @@ struct Genode::Trace::Session_client : Genode::Rpc_client()) - { } + /* + * Noncopyable + */ + Argument_buffer(Argument_buffer const &); + Argument_buffer &operator = (Argument_buffer const &); - ~Argument_buffer() - { - rm.detach(base); - } + public: + + Region_map &rm; + char *base; + size_t size; + + Argument_buffer(Region_map &rm, Dataspace_capability ds) + : + rm(rm), + base(rm.attach(ds)), + size(ds.call()) + { } + + ~Argument_buffer() + { + rm.detach(base); + } }; Argument_buffer _argument_buffer; diff --git a/repos/base/include/util/avl_tree.h b/repos/base/include/util/avl_tree.h index 6f74e6ec4..b5800b95b 100644 --- a/repos/base/include/util/avl_tree.h +++ b/repos/base/include/util/avl_tree.h @@ -202,7 +202,7 @@ class Genode::Avl_tree : Avl_node static_cast(node)->recompute(); } - } _policy; + } _policy { }; public: diff --git a/repos/base/include/util/bit_allocator.h b/repos/base/include/util/bit_allocator.h index 258a76672..38e87f621 100644 --- a/repos/base/include/util/bit_allocator.h +++ b/repos/base/include/util/bit_allocator.h @@ -34,8 +34,8 @@ class Genode::Bit_allocator using Array = Bit_array; - addr_t _next; - Array _array; + addr_t _next = 0; + Array _array { }; /** * Reserve consecutive number of bits @@ -53,9 +53,8 @@ class Genode::Bit_allocator class Out_of_indices : Exception {}; - Bit_allocator() : _next(0) { - _reserve(BITS, BITS_ALIGNED - BITS); } - Bit_allocator(const Bit_allocator & o) : _next(0), _array(o._array) { } + Bit_allocator() { _reserve(BITS, BITS_ALIGNED - BITS); } + Bit_allocator(const Bit_allocator & o) : _array(o._array) { } addr_t alloc(size_t const num_log2 = 0) { diff --git a/repos/base/include/util/flex_iterator.h b/repos/base/include/util/flex_iterator.h index 477277de9..e8613ae63 100644 --- a/repos/base/include/util/flex_iterator.h +++ b/repos/base/include/util/flex_iterator.h @@ -26,11 +26,11 @@ namespace Genode { struct Genode::Flexpage { - addr_t addr; - addr_t hotspot; - size_t log2_order; + addr_t addr = ~0UL; + addr_t hotspot = 0; + size_t log2_order = 0; - Flexpage() : addr(~0UL), hotspot(0), log2_order(0) { } + Flexpage() { } Flexpage(addr_t a, addr_t h, size_t o) : addr(a), hotspot(h), log2_order(o) { } @@ -43,9 +43,9 @@ class Genode::Flexpage_iterator { private: - addr_t _src_start, _src_size; - addr_t _dst_start, _dst_size; - addr_t _hotspot, _offset; + addr_t _src_start = 0, _src_size = 0; + addr_t _dst_start = 0, _dst_size = 0; + addr_t _hotspot = 0, _offset = 0; /** * Find least significant set bit in value diff --git a/repos/base/include/util/interface.h b/repos/base/include/util/interface.h new file mode 100644 index 000000000..47634f8c1 --- /dev/null +++ b/repos/base/include/util/interface.h @@ -0,0 +1,22 @@ +/* + * \brief Common base class of abstract base classes + * \author Norman Feske + * \date 2017-12-21 + * + * The 'Interface' class relieves abstract base classes from manually + * implementing a virtual destructor. + */ + +/* + * Copyright (C) 2017 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + +#ifndef _INCLUDE__UTIL__INTERFACE_H_ +#define _INCLUDE__UTIL__INTERFACE_H_ + +namespace Genode { struct Interface { virtual ~Interface() { }; }; } + +#endif /* _INCLUDE__UTIL__INTERFACE_H_ */ diff --git a/repos/base/include/util/reconstructible.h b/repos/base/include/util/reconstructible.h index 43341aa9c..771ff09b3 100644 --- a/repos/base/include/util/reconstructible.h +++ b/repos/base/include/util/reconstructible.h @@ -162,7 +162,7 @@ template struct Genode::Constructible : Reconstructible { template - Constructible(ARGS &&... args) + Constructible(ARGS &&...) : Reconstructible((typename Reconstructible::Lazy *)nullptr) { } diff --git a/repos/base/include/util/register_set.h b/repos/base/include/util/register_set.h index 6b1b5a69c..554c0814e 100644 --- a/repos/base/include/util/register_set.h +++ b/repos/base/include/util/register_set.h @@ -17,6 +17,7 @@ /* Genode includes */ #include #include +#include #include namespace Genode { @@ -673,7 +674,7 @@ class Genode::Register_set : Noncopyable /** * Interface for delaying the execution of a calling thread */ - struct Delayer + struct Delayer : Interface { /** * Delay execution of the caller for 'us' microseconds diff --git a/repos/base/include/util/string.h b/repos/base/include/util/string.h index 17f5059d1..38ab4a159 100644 --- a/repos/base/include/util/string.h +++ b/repos/base/include/util/string.h @@ -579,42 +579,52 @@ class Genode::String /** * Number of chars contained in '_buf' including the terminating null */ - size_t _len; + size_t _len { 0 }; /** * Output facility that targets a character buffer */ - struct Local_output : Output + class Local_output : public Output { - char * const _buf; + private: - size_t _num_chars = 0; + /* + * Noncopyable + */ + Local_output(Local_output const &); + Local_output &operator = (Local_output const &); - /** - * Return true if '_buf' can fit at least one additional 'char'. - */ - bool _capacity_left() const { return CAPACITY - _num_chars - 1; } + public: - void _append(char c) { _buf[_num_chars++] = c; } + char * const _buf; - Local_output(char *buf) : _buf(buf) { } + size_t _num_chars = 0; - size_t num_chars() const { return _num_chars; } + /** + * Return true if '_buf' can fit at least one additional 'char'. + */ + bool _capacity_left() const { return CAPACITY - _num_chars - 1; } - void out_char(char c) override { if (_capacity_left()) _append(c); } + void _append(char c) { _buf[_num_chars++] = c; } - void out_string(char const *str, size_t n) override - { - while (n-- > 0 && _capacity_left() && *str) - _append(*str++); - } + Local_output(char *buf) : _buf(buf) { } + + size_t num_chars() const { return _num_chars; } + + void out_char(char c) override { if (_capacity_left()) _append(c); } + + void out_string(char const *str, size_t n) override + { + while (n-- > 0 && _capacity_left() && *str) + _append(*str++); + } }; public: constexpr static size_t size() { return CAPACITY; } - String() : _len(0) { } + String() { } /** * Constructor diff --git a/repos/base/include/util/xml_node.h b/repos/base/include/util/xml_node.h index d61b58fb4..75f2fd745 100644 --- a/repos/base/include/util/xml_node.h +++ b/repos/base/include/util/xml_node.h @@ -223,9 +223,9 @@ class Genode::Xml_node private: - Token _token; - Token _name; - Type _type; + Token _token { }; + Token _name { }; + Type _type { INVALID }; public: @@ -243,7 +243,7 @@ class Genode::Xml_node * # '/' for marking an empty-element tag (if tag is no end tag) * # Closing '>' tag delimiter */ - Tag(Token start) : _token(start), _type(INVALID) + Tag(Token start) : _token(start) { Type supposed_type = START; @@ -294,7 +294,7 @@ class Genode::Xml_node /** * Default constructor produces invalid Tag */ - Tag() : _type(INVALID) { } + Tag() { } /** * Return type of tag @@ -343,8 +343,8 @@ class Genode::Xml_node { private: - Token _next; /* token following the comment */ - bool _valid; /* true if comment is well formed */ + Token _next { }; /* token following the comment */ + bool _valid { false }; /* true if comment is well formed */ public: @@ -353,7 +353,7 @@ class Genode::Xml_node * * \param start first token of the comment tag */ - Comment(Token t) : _valid(false) + Comment(Token t) { /* check for comment start */ if (!t.matches("