Follow practices suggested by "Effective C++"

The patch adjust the code of the base, base-<kernel>, 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
This commit is contained in:
Norman Feske
2017-12-21 15:42:15 +01:00
committed by Christian Helmuth
parent 2a33d9aa76
commit eba9c15746
763 changed files with 4936 additions and 3288 deletions

View File

@ -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; }

View File

@ -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;

View File

@ -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<Pd> core_pd;
addr_t core_elf_addr;

View File

@ -29,7 +29,7 @@ class Cpu_counter
{
private:
Hw::Spin_lock _lock;
Hw::Spin_lock _lock { };
volatile int _value = 0;
public:

View File

@ -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()

View File

@ -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)

View File

@ -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)

View File

@ -33,8 +33,7 @@ namespace Board {
}
template <typename E, unsigned B, unsigned S>
void Sv39::Level_x_translation_table<E, B, S>::_translation_added(addr_t addr,
size_t size)
void Sv39::Level_x_translation_table<E, B, S>::_translation_added(addr_t, size_t)
{ }
#endif /* _SRC__BOOTSTRAP__SPEC__RISCV__BOARD_H_ */

View File

@ -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()

View File

@ -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_ */

View File

@ -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; }

View File

@ -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)

View File

@ -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) ;

View File

@ -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; }

View File

@ -21,22 +21,29 @@
#include <kernel/irq.h>
namespace Genode {
class Irq_session_component;
}
namespace Genode { class Irq_session_component; }
class Genode::Irq_session_component : public Rpc_object<Irq_session>,
public List<Irq_session_component>::Element
class Genode::Irq_session_component : public Rpc_object<Irq_session>,
private List<Irq_session_component>::Element
{
private:
friend class List<Irq_session_component>;
/*
* 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<Irq_session>,
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 };

View File

@ -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(); }
}

View File

@ -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:

View File

@ -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<Cpu_domain_update>;
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_ */

View File

@ -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;

View File

@ -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

View File

@ -39,7 +39,7 @@ namespace Kernel
using Ipc_node_queue = Kernel::Fifo<Ipc_node>;
}
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<Ipc_node>;
friend class Genode::Fifo<Ipc_node>;
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_ */

View File

@ -47,8 +47,11 @@ namespace Genode
}
class Kernel::Irq : public Genode::Avl_node<Irq>
class Kernel::Irq : Genode::Avl_node<Irq>
{
friend class Genode::Avl_tree<Irq>;
friend class Genode::Avl_node<Irq>;
public:
struct Pool : Genode::Avl_tree<Irq>

View File

@ -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) { }

View File

@ -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 <typename T>
class Kernel::Core_object : public T, public Kernel::Core_object_identity<T>
class Kernel::Core_object : public T, Kernel::Core_object_identity<T>
{
public:
template <typename... ARGS>
Core_object(ARGS &&... args)
: T(args...), Core_object_identity<T>(*static_cast<T*>(this)) { }
using Kernel::Core_object_identity<T>::core_capid;
using Kernel::Core_object_identity<T>::capid;
};
#endif /* _CORE__KERNEL__OBJECT_H_ */

View File

@ -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

View File

@ -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<Signal_handler> 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<Signal_context> Fifo_element;
Fifo_element _deliver_fe;
@ -243,9 +261,9 @@ class Kernel::Signal_receiver : public Kernel::Object
template <typename T> class Fifo : public Genode::Fifo<T> { };
Fifo<Signal_handler::Fifo_element> _handlers;
Fifo<Signal_context::Fifo_element> _deliver;
Fifo<Signal_context::Fifo_element> _contexts;
Fifo<Signal_handler::Fifo_element> _handlers { };
Fifo<Signal_context::Fifo_element> _deliver { };
Fifo<Signal_context::Fifo_element> _contexts { };
/**
* Recognize that context 'c' has submits to deliver

View File

@ -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;

View File

@ -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<Timeout>::Element
class Kernel::Timeout : Genode::List<Timeout>::Element
{
friend class Timer;
friend class Genode::List<Timeout>;
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:

View File

@ -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;

View File

@ -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); }

View File

@ -44,7 +44,7 @@ class Genode::Kernel_object
protected:
Untyped_capability _cap;
Untyped_capability _cap { };
public:

View File

@ -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<Pager_object>::Entry,
public Genode::Kernel_object<Kernel::Signal_context>
class Genode::Pager_object : private Object_pool<Pager_object>::Entry,
private Genode::Kernel_object<Kernel::Signal_context>
{
friend class Pager_entrypoint;
friend class Object_pool<Pager_object>;
private:
@ -186,13 +188,15 @@ class Genode::Pager_object : public Object_pool<Pager_object>::Entry,
Cpu_session_capability cpu_session_cap() const { return _cpu_session_cap; }
Thread_capability thread_cap() const { return _thread_cap; }
using Object_pool<Pager_object>::Entry::cap;
};
class Genode::Pager_entrypoint : public Object_pool<Pager_object>,
public Thread_deprecated<PAGER_EP_STACK_SIZE>,
public Kernel_object<Kernel::Signal_receiver>,
public Ipc_pager
class Genode::Pager_entrypoint : public Object_pool<Pager_object>,
public Thread_deprecated<PAGER_EP_STACK_SIZE>,
private Kernel_object<Kernel::Signal_receiver>,
private Ipc_pager
{
public:

View File

@ -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()); }

View File

@ -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();

View File

@ -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<Kernel::Pd>(true, (Page_table*)translation_table_phys(), this),
_label(label)

View File

@ -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<DEFAULT_TRANSLATION_TABLE_MAX>;
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<Kernel::Pd>
class Genode::Platform_pd : public Hw::Address_space,
private Cap_space,
private Kernel_object<Kernel::Pd>
{
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; }
};

View File

@ -43,15 +43,21 @@ namespace Genode {
*/
class Platform_thread : public Kernel_object<Kernel::Thread>
{
/*
* Noncopyable
*/
Platform_thread(Platform_thread const &);
Platform_thread &operator = (Platform_thread const &);
enum { LABEL_MAX_LEN = 32 };
Platform_pd * _pd;
Weak_ptr<Address_space> _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> _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

View File

@ -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)
{

View File

@ -43,7 +43,7 @@ class Genode::Rpc_cap_factory
{
using Identity = Kernel::Core_object_identity<Kernel::Thread>;
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<Kobject> _list;
Lock _lock;
List<Kobject> _list { };
Lock _lock { };
public:

View File

@ -42,9 +42,9 @@ class Genode::Signal_broker
Allocator &_md_alloc;
Slab<Signal_source_component> _sources_slab { &_md_alloc };
Signal_source_pool _sources;
Signal_source_pool _sources { };
Slab<Signal_context_component> _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

View File

@ -32,9 +32,13 @@ namespace Genode {
}
struct Genode::Signal_context_component : Kernel_object<Kernel::Signal_context>,
Signal_context_pool::Entry
struct Genode::Signal_context_component : private Kernel_object<Kernel::Signal_context>,
public Signal_context_pool::Entry
{
friend class Object_pool<Signal_context_component>;
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<Kernel::Signal_context>,
};
struct Genode::Signal_source_component : Kernel_object<Kernel::Signal_receiver>,
Signal_source_pool::Entry
struct Genode::Signal_source_component : private Kernel_object<Kernel::Signal_receiver>,
public Signal_source_pool::Entry
{
friend class Object_pool<Signal_source_component>;
friend class Signal_context_component;
using Signal_source_pool::Entry::cap;
Signal_source_component()
:
Kernel_object<Kernel::Signal_receiver>(true),

View File

@ -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;

View File

@ -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;
}

View File

@ -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) {

View File

@ -29,17 +29,22 @@ namespace Genode {
class Vm_session_component;
}
class Genode::Vm_session_component
: public Genode::Rpc_object<Genode::Vm_session>,
public Kernel_object<Kernel::Vm>
class Genode::Vm_session_component : public Genode::Rpc_object<Genode::Vm_session>,
private Kernel_object<Kernel::Vm>
{
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"); }
};

View File

@ -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

View File

@ -31,20 +31,25 @@ namespace Genode {
class Vm_session_component;
}
class Genode::Vm_session_component
: public Genode::Rpc_object<Genode::Vm_session>,
public Kernel_object<Kernel::Vm>
class Genode::Vm_session_component : public Genode::Rpc_object<Genode::Vm_session>,
private Kernel_object<Kernel::Vm>
{
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<Kernel::DEFAULT_TRANSLATION_TABLE_MAX>;
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;

View File

@ -26,7 +26,7 @@ class Genode::Cpu : public Arm_v7_cpu
{
protected:
Fpu _fpu;
Fpu _fpu { };
public:

View File

@ -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;

View File

@ -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);

View File

@ -15,5 +15,5 @@
#include <kernel/cpu.h>
#include <hw/memory_map.h>
void Kernel::Cpu::init(Kernel::Pic &pic) {
void Kernel::Cpu::init(Kernel::Pic &) {
Stvec::write(Hw::Mm::supervisor_exception_vector().base); }

View File

@ -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() { }
};

View File

@ -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; }

View File

@ -18,8 +18,9 @@
#include <cpu.h>
template <typename E, unsigned B, unsigned S>
void Sv39::Level_x_translation_table<E, B, S>::_translation_added(addr_t addr,
size_t size) {
Genode::Cpu::sfence(); }
void Sv39::Level_x_translation_table<E, B, S>::_translation_added(addr_t, size_t)
{
Genode::Cpu::sfence();
}
#endif /* _CORE__SPEC__RISCV__TRANSLATION_TABLE_H_ */

View File

@ -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

View File

@ -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_ */

View File

@ -66,4 +66,4 @@ void Kernel::Vm::proceed(Cpu & cpu)
}
void Kernel::Vm::inject_irq(unsigned irq) { }
void Kernel::Vm::inject_irq(unsigned) { }

View File

@ -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) { }

View File

@ -31,14 +31,15 @@ namespace Genode {
class Genode::Vm_session_component
: public Genode::Rpc_object<Genode::Vm_session>,
public Kernel_object<Kernel::Vm>
private Kernel_object<Kernel::Vm>
{
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_ */

View File

@ -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);

View File

@ -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; }

View File

@ -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

View File

@ -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();
}

View File

@ -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<Header *> (this); }
Header const &_header() const { return *reinterpret_cast<Header const *>(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(),

View File

@ -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();

View File

@ -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;

View File

@ -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 <typename TABLE> 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<TABLE_SIZE>::Array<COUNT>::Allocator
using Bit_allocator = Genode::Bit_allocator<COUNT>;
using Array = Page_table_allocator<TABLE_SIZE>::Array<COUNT>;
Bit_allocator _free_tables;
Bit_allocator _free_tables { };
unsigned _alloc()
{

View File

@ -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_ */

View File

@ -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

View File

@ -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; }
};

View File

@ -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)
{

View File

@ -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);

View File

@ -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 };

View File

@ -49,7 +49,7 @@ struct Sync_root : public Root_component<Session_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(); }

View File

@ -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
{

View File

@ -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<Item> list;
Double_list_typed<Item> list { };
char items[nr_of_items][sizeof(Item)];
Data()