base: avoid implicit conversions

This patch is a prerequisite for compiling the code with
the warnings -Wconversion enabled.

Issue #23
This commit is contained in:
Norman Feske
2021-12-02 11:21:14 +01:00
parent c79a59655d
commit 03047009b1
189 changed files with 947 additions and 819 deletions

View File

@ -6,6 +6,9 @@ FIASCO_SRC = $(L4_SRC_DIR)/kernel/fiasco
KERNEL_BUILD_OUTPUT_FILTER = 2>&1 | sed "s/^/ [fiasco] /" KERNEL_BUILD_OUTPUT_FILTER = 2>&1 | sed "s/^/ [fiasco] /"
KERNEL_CXXFLAGS = -std=gnu++98 -fno-delete-null-pointer-checks $(CXXWARN) \
-Wno-address-of-packed-member
$(FIASCO_BUILD_DIR): $(FIASCO_BUILD_DIR):
$(VERBOSE_MK) set -o pipefail; \ $(VERBOSE_MK) set -o pipefail; \
MAKEFLAGS= $(MAKE) SYSTEM_TARGET="$(CROSS_DEV_PREFIX)" \ MAKEFLAGS= $(MAKE) SYSTEM_TARGET="$(CROSS_DEV_PREFIX)" \
@ -21,7 +24,7 @@ $(FIASCO_BUILD_DIR):
$(FIASCO): $(FIASCO_BUILD_DIR) $(FIASCO): $(FIASCO_BUILD_DIR)
$(VERBOSE_MK) set -o pipefail; \ $(VERBOSE_MK) set -o pipefail; \
MAKEFLAGS= CFLAGS="-std=gnu89 $(CWARN)" \ MAKEFLAGS= CFLAGS="-std=gnu89 $(CWARN)" \
CXXFLAGS="-std=gnu++98 -fno-delete-null-pointer-checks $(CXXWARN)" \ CXXFLAGS="$(KERNEL_CXXFLAGS)" \
$(MAKE) SYSTEM_TARGET="$(CROSS_DEV_PREFIX)" \ $(MAKE) SYSTEM_TARGET="$(CROSS_DEV_PREFIX)" \
$(VERBOSE_DIR) -C $(FIASCO_BUILD_DIR) \ $(VERBOSE_DIR) -C $(FIASCO_BUILD_DIR) \
$(KERNEL_BUILD_OUTPUT_FILTER) $(KERNEL_BUILD_OUTPUT_FILTER)

View File

@ -46,6 +46,7 @@ class Genode::Platform_pd : public Address_space
enum { enum {
VERSION_BITS = 10, VERSION_BITS = 10,
VERSION_MASK = (1 << VERSION_BITS) - 1,
PD_FIRST = 0x10, PD_FIRST = 0x10,
PD_MAX = (1 << 11) - 1, /* leave 0x7ff free for L4_INVALID_ID */ PD_MAX = (1 << 11) - 1, /* leave 0x7ff free for L4_INVALID_ID */
PD_VERSION_MAX = (1 << 10) - 1, PD_VERSION_MAX = (1 << 10) - 1,
@ -101,7 +102,7 @@ class Genode::Platform_pd : public Address_space
unsigned version : VERSION_BITS; unsigned version : VERSION_BITS;
Pd_alloc(bool r, bool f, unsigned v) Pd_alloc(bool r, bool f, unsigned v)
: reserved(r), free(f), version(v) { } : reserved(r), free(f), version(v & VERSION_MASK) { }
Pd_alloc() : reserved(0), free(0), version(0) { } Pd_alloc() : reserved(0), free(0), version(0) { }
}; };

View File

@ -58,10 +58,13 @@ void Platform_pd::init()
void Platform_pd::_create_pd(bool syscall) void Platform_pd::_create_pd(bool syscall)
{ {
enum { TASK_ID_MASK = (1 << 11) - 1,
VERSION_LOW_MASK = (1 << 10) - 1 };
l4_threadid_t l4t = l4_myself(); l4_threadid_t l4t = l4_myself();
l4t.id.task = _pd_id; l4t.id.task = _pd_id & TASK_ID_MASK;
l4t.id.lthread = 0; l4t.id.lthread = 0;
l4t.id.version_low = _version; l4t.id.version_low = _version & VERSION_LOW_MASK;
l4_taskid_t nt; l4_taskid_t nt;
if (syscall) if (syscall)
@ -203,8 +206,10 @@ bool Platform_pd::bind_thread(Platform_thread &thread)
} }
thread_id = t; thread_id = t;
enum { LTHREAD_MASK = (1 << 7) - 1 };
l4_thread_id = _l4_task_id; l4_thread_id = _l4_task_id;
l4_thread_id.id.lthread = thread_id; l4_thread_id.id.lthread = thread_id & LTHREAD_MASK;
/* finally inform thread about binding */ /* finally inform thread about binding */
thread.bind(thread_id, l4_thread_id, *this); thread.bind(thread_id, l4_thread_id, *this);

View File

@ -15,6 +15,10 @@
#define _INCLUDE__FIASCO__SYSCALL_H_ #define _INCLUDE__FIASCO__SYSCALL_H_
namespace Fiasco { namespace Fiasco {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#include <l4/sys/types.h> #include <l4/sys/types.h>
#include <l4/sys/kdebug.h> #include <l4/sys/kdebug.h>
#include <l4/sys/ipc.h> #include <l4/sys/ipc.h>
@ -24,6 +28,8 @@ namespace Fiasco {
#include <l4/sys/ktrace.h> #include <l4/sys/ktrace.h>
#include <l4/sys/syscalls.h> #include <l4/sys/syscalls.h>
#include <l4/sigma0/sigma0.h> #include <l4/sigma0/sigma0.h>
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
} }
#endif /* _INCLUDE__FIASCO__SYSCALL_H_ */ #endif /* _INCLUDE__FIASCO__SYSCALL_H_ */

View File

@ -32,9 +32,9 @@ class Msg_header
private: private:
/* kernel-defined message header */ /* kernel-defined message header */
l4_fpage_t rcv_fpage; /* unused */ l4_fpage_t _rcv_fpage; /* unused */
l4_msgdope_t size_dope; l4_msgdope_t _size_dope;
l4_msgdope_t send_dope; l4_msgdope_t _send_dope;
public: public:
@ -52,6 +52,8 @@ class Msg_header
enum { MAX_CAPS_PER_MSG = Msgbuf_base::MAX_CAPS_PER_MSG }; enum { MAX_CAPS_PER_MSG = Msgbuf_base::MAX_CAPS_PER_MSG };
enum { SIZE_DOPE_MASK = 0x3ffff };
l4_threadid_t _cap_tid [MAX_CAPS_PER_MSG]; l4_threadid_t _cap_tid [MAX_CAPS_PER_MSG];
unsigned long _cap_local_name [MAX_CAPS_PER_MSG]; unsigned long _cap_local_name [MAX_CAPS_PER_MSG];
@ -68,7 +70,7 @@ class Msg_header
public: public:
void *msg_start() { return &rcv_fpage; } void *msg_start() { return &_rcv_fpage; }
/** /**
* Load header fields according to send-message buffer * Load header fields according to send-message buffer
@ -79,7 +81,8 @@ class Msg_header
num_caps = min((unsigned)MAX_CAPS_PER_MSG, snd_msg.used_caps()); num_caps = min((unsigned)MAX_CAPS_PER_MSG, snd_msg.used_caps());
size_t const snd_words = snd_msg.data_size()/sizeof(l4_umword_t); size_t const snd_words = snd_msg.data_size()/sizeof(l4_umword_t);
send_dope = L4_IPC_DOPE(_num_msg_words(snd_words), 0);
_send_dope = L4_IPC_DOPE(_num_msg_words(snd_words) & SIZE_DOPE_MASK, 0);
/* reset _cap_tid and _cap_local_name */ /* reset _cap_tid and _cap_local_name */
for (unsigned i = 0; i < MAX_CAPS_PER_MSG; i++) { for (unsigned i = 0; i < MAX_CAPS_PER_MSG; i++) {
@ -107,7 +110,7 @@ class Msg_header
{ {
size_t const rcv_max_words = rcv_msg.capacity()/sizeof(l4_umword_t); size_t const rcv_max_words = rcv_msg.capacity()/sizeof(l4_umword_t);
size_dope = L4_IPC_DOPE(_num_msg_words(rcv_max_words), 0); _size_dope = L4_IPC_DOPE(_num_msg_words(rcv_max_words) & SIZE_DOPE_MASK, 0);
} }
/** /**

View File

@ -14,6 +14,9 @@
#ifndef _INCLUDE__FOC__SYSCALL_H_ #ifndef _INCLUDE__FOC__SYSCALL_H_
#define _INCLUDE__FOC__SYSCALL_H_ #define _INCLUDE__FOC__SYSCALL_H_
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
namespace Foc { namespace Foc {
#include <l4/sys/types.h> #include <l4/sys/types.h>
#include <l4/sys/kip> #include <l4/sys/kip>
@ -33,4 +36,6 @@ namespace Foc {
#include <l4/sigma0/sigma0.h> #include <l4/sigma0/sigma0.h>
} }
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
#endif /* _INCLUDE__FOC__SYSCALL_H_ */ #endif /* _INCLUDE__FOC__SYSCALL_H_ */

View File

@ -26,7 +26,7 @@ namespace Genode { struct Foc_thread_state; }
struct Genode::Foc_thread_state : Thread_state struct Genode::Foc_thread_state : Thread_state
{ {
Foc::l4_cap_idx_t kcap; /* thread's gate cap in its PD */ Foc::l4_cap_idx_t kcap; /* thread's gate cap in its PD */
int id; /* ID of gate capability */ uint16_t id; /* ID of gate capability */
addr_t utcb; /* thread's UTCB in its PD */ addr_t utcb; /* thread's UTCB in its PD */
/** /**

View File

@ -25,6 +25,12 @@ namespace Genode { class Cap_id_allocator; }
class Genode::Cap_id_allocator class Genode::Cap_id_allocator
{ {
public:
using id_t = uint16_t;
enum { ID_MASK = 0xffff };
private: private:
enum { enum {
@ -44,8 +50,8 @@ class Genode::Cap_id_allocator
Cap_id_allocator(Allocator &); Cap_id_allocator(Allocator &);
unsigned long alloc(); id_t alloc();
void free(unsigned long id); void free(id_t id);
}; };
#endif /* _CORE__INCLUDE__CAP_ID_ALLOC_H_ */ #endif /* _CORE__INCLUDE__CAP_ID_ALLOC_H_ */

View File

@ -38,7 +38,7 @@ class Genode::Irq_object
Irq_session::Polarity _polarity; /* interrupt polarity */ Irq_session::Polarity _polarity; /* interrupt polarity */
unsigned _irq; unsigned _irq;
addr_t _msi_addr; uint64_t _msi_addr;
addr_t _msi_data; addr_t _msi_data;
Signal_context_capability _sig_cap { }; Signal_context_capability _sig_cap { };
@ -53,8 +53,8 @@ class Genode::Irq_object
Irq_session::Trigger trigger() const { return _trigger; } Irq_session::Trigger trigger() const { return _trigger; }
Irq_session::Polarity polarity() const { return _polarity; } Irq_session::Polarity polarity() const { return _polarity; }
Genode::addr_t msi_address() const { return _msi_addr; } uint64_t msi_address() const { return _msi_addr; }
Genode::addr_t msi_value() const { return _msi_data; } addr_t msi_value() const { return _msi_data; }
void sigh(Genode::Signal_context_capability cap) { _sig_cap = cap; } void sigh(Genode::Signal_context_capability cap) { _sig_cap = cap; }
void notify() { Genode::Signal_transmitter(_sig_cap).submit(1); } void notify() { Genode::Signal_transmitter(_sig_cap).submit(1); }

View File

@ -45,7 +45,7 @@ namespace Genode {
using namespace Foc; using namespace Foc;
l4_fpage_t snd_fpage = l4_fpage(from_addr + offset, l4_fpage_t snd_fpage = l4_fpage(from_addr + offset,
page_size_log2, L4_FPAGE_RW); (unsigned)page_size_log2, L4_FPAGE_RW);
if (l4_msgtag_has_error(l4_task_map(L4_BASE_TASK_CAP, if (l4_msgtag_has_error(l4_task_map(L4_BASE_TASK_CAP,
L4_BASE_TASK_CAP, L4_BASE_TASK_CAP,
@ -95,13 +95,13 @@ namespace Genode {
if (can_use_super_page(from_addr + offset, size)) if (can_use_super_page(from_addr + offset, size))
page_size_log2 = get_super_page_size_log2(); page_size_log2 = get_super_page_size_log2();
l4_utcb_mr()->mr[1] = l4_fpage(from_addr + offset, l4_utcb_mr()->mr[1] = l4_fpage(from_addr + offset,
page_size_log2, L4_FPAGE_RWX).raw; (unsigned)page_size_log2, L4_FPAGE_RWX).raw;
/* open receive window for mapping */ /* open receive window for mapping */
l4_utcb_br()->bdr = 0; l4_utcb_br()->bdr = 0;
l4_utcb_br()->br[0] = L4_ITEM_MAP; l4_utcb_br()->br[0] = L4_ITEM_MAP;
l4_utcb_br()->br[1] = l4_fpage((addr_t)to_addr + offset, l4_utcb_br()->br[1] = l4_fpage((addr_t)to_addr + offset,
page_size_log2, L4_FPAGE_RWX).raw; (unsigned)page_size_log2, L4_FPAGE_RWX).raw;
l4_msgtag_t tag = l4_msgtag(L4_PROTO_SIGMA0, 2, 0, 0); l4_msgtag_t tag = l4_msgtag(L4_PROTO_SIGMA0, 2, 0, 0);
tag = l4_ipc_call(L4_BASE_PAGER_CAP, l4_utcb(), tag, L4_IPC_NEVER); tag = l4_ipc_call(L4_BASE_PAGER_CAP, l4_utcb(), tag, L4_IPC_NEVER);

View File

@ -34,7 +34,7 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
: get_page_size_log2(); : get_page_size_log2();
/* find appropriate region for mapping */ /* find appropriate region for mapping */
return platform().region_alloc().alloc_aligned(size, alignment).convert<addr_t>( return platform().region_alloc().alloc_aligned(size, (unsigned)alignment).convert<addr_t>(
[&] (void *local_base) { [&] (void *local_base) {
if (!map_local_io(base, (addr_t)local_base, size >> get_page_size_log2())) { if (!map_local_io(base, (addr_t)local_base, size >> get_page_size_log2())) {

View File

@ -86,7 +86,7 @@ void Ipc_pager::wait_for_fault()
do { do {
_tag = l4_ipc_wait(l4_utcb(), &label, L4_IPC_NEVER); _tag = l4_ipc_wait(l4_utcb(), &label, L4_IPC_NEVER);
int err = l4_ipc_error(_tag, l4_utcb()); l4_umword_t err = l4_ipc_error(_tag, l4_utcb());
if (!err) { if (!err) {
_parse(label); _parse(label);
return; return;
@ -121,7 +121,7 @@ void Ipc_pager::reply_and_wait_for_fault()
}; };
l4_fpage_t const fpage = l4_fpage(_reply_mapping.src_addr, l4_fpage_t const fpage = l4_fpage(_reply_mapping.src_addr,
_reply_mapping.size_log2, (unsigned)_reply_mapping.size_log2,
rights(_reply_mapping.writeable, rights(_reply_mapping.writeable,
_reply_mapping.executable)); _reply_mapping.executable));
@ -129,7 +129,7 @@ void Ipc_pager::reply_and_wait_for_fault()
_tag = l4_ipc_send_and_wait(_last.kcap, l4_utcb(), snd_tag, _tag = l4_ipc_send_and_wait(_last.kcap, l4_utcb(), snd_tag,
&label, L4_IPC_SEND_TIMEOUT_0); &label, L4_IPC_SEND_TIMEOUT_0);
int const err = l4_ipc_error(_tag, l4_utcb()); l4_umword_t const err = l4_ipc_error(_tag, l4_utcb());
if (err) { if (err) {
error("Ipc error ", err, " in pagefault from ", Hex(label & ~0x3)); error("Ipc error ", err, " in pagefault from ", Hex(label & ~0x3));
wait_for_fault(); wait_for_fault();

View File

@ -139,7 +139,7 @@ void Irq_object::ack_irq()
{ {
using namespace Foc; using namespace Foc;
int err; l4_umword_t err;
l4_msgtag_t tag = l4_irq_unmask(_capability()); l4_msgtag_t tag = l4_irq_unmask(_capability());
if ((err = l4_ipc_error(tag, l4_utcb()))) if ((err = l4_ipc_error(tag, l4_utcb())))
error("IRQ unmask: ", err); error("IRQ unmask: ", err);
@ -148,7 +148,7 @@ void Irq_object::ack_irq()
Irq_object::Irq_object() Irq_object::Irq_object()
: :
_cap(cap_map().insert(platform_specific().cap_id_alloc().alloc())), _cap(cap_map().insert((Cap_index::id_t)platform_specific().cap_id_alloc().alloc())),
_trigger(Irq_session::TRIGGER_UNCHANGED), _trigger(Irq_session::TRIGGER_UNCHANGED),
_polarity(Irq_session::POLARITY_UNCHANGED), _polarity(Irq_session::POLARITY_UNCHANGED),
_irq(~0U), _msi_addr(0), _msi_data(0) _irq(~0U), _msi_addr(0), _msi_data(0)
@ -170,7 +170,7 @@ Irq_object::~Irq_object()
if (l4_error(l4_irq_detach(_capability()))) if (l4_error(l4_irq_detach(_capability())))
error("cannot detach IRQ"); error("cannot detach IRQ");
if (l4_error(l4_icu_unbind(L4_BASE_ICU_CAP, irq, _capability()))) if (l4_error(l4_icu_unbind(L4_BASE_ICU_CAP, (unsigned)irq, _capability())))
error("cannot unbind IRQ"); error("cannot unbind IRQ");
cap_map().remove(_cap); cap_map().remove(_cap);
@ -184,7 +184,7 @@ Irq_object::~Irq_object()
Irq_session_component::Irq_session_component(Range_allocator &irq_alloc, Irq_session_component::Irq_session_component(Range_allocator &irq_alloc,
const char *args) const char *args)
: :
_irq_number(Arg_string::find_arg(args, "irq_number").long_value(-1)), _irq_number((unsigned)Arg_string::find_arg(args, "irq_number").long_value(-1)),
_irq_alloc(irq_alloc), _irq_object() _irq_alloc(irq_alloc), _irq_object()
{ {
long const msi = Arg_string::find_arg(args, "device_config_phys").long_value(0); long const msi = Arg_string::find_arg(args, "device_config_phys").long_value(0);
@ -252,7 +252,7 @@ Irq_session::Info Irq_session_component::info()
return { return {
.type = Genode::Irq_session::Info::Type::MSI, .type = Genode::Irq_session::Info::Type::MSI,
.address = _irq_object.msi_address(), .address = (addr_t)_irq_object.msi_address(),
.value = _irq_object.msi_value() .value = _irq_object.msi_value()
}; };
} }
@ -269,7 +269,7 @@ void Interrupt_handler::entry()
{ {
using namespace Foc; using namespace Foc;
int err; l4_umword_t err;
l4_msgtag_t tag; l4_msgtag_t tag;
l4_umword_t label; l4_umword_t label;

View File

@ -293,14 +293,14 @@ void Platform::_setup_mem_alloc()
for ( ; beg < end; beg += L4_PAGESIZE) (void)(*beg); for ( ; beg < end; beg += L4_PAGESIZE) (void)(*beg);
/* request pages of known page size starting with largest */ /* request pages of known page size starting with largest */
size_t const log2_sizes[] = { L4_LOG2_SUPERPAGESIZE, L4_LOG2_PAGESIZE }; unsigned const log2_sizes[] = { L4_LOG2_SUPERPAGESIZE, L4_LOG2_PAGESIZE };
for (unsigned i = 0; i < sizeof(log2_sizes)/sizeof(*log2_sizes); ++i) { for (unsigned i = 0; i < sizeof(log2_sizes)/sizeof(*log2_sizes); ++i) {
size_t const log2_size = log2_sizes[i]; unsigned const log2_size = log2_sizes[i];
size_t const size = 1UL << log2_size; size_t const size = 1UL << log2_size;
int err = 0; Foc::l4_umword_t err = 0;
addr_t addr = 0; addr_t addr = 0;
Region region; Region region;
/* request any page of current size from sigma0 */ /* request any page of current size from sigma0 */

View File

@ -122,12 +122,13 @@ void Platform_pd::flush(addr_t, size_t size, Core_local_addr core_local)
static Native_capability debug_cap() static Native_capability debug_cap()
{ {
unsigned long const id = platform_specific().cap_id_alloc().alloc(); Cap_index::id_t const id = platform_specific().cap_id_alloc().alloc();
static Cap_index * idx = cap_map().insert(id, DEBUG_CAP); static Cap_index * idx = cap_map().insert(id, DEBUG_CAP);
static Native_capability debug_cap(reinterpret_cast<Core_cap_index*>(idx)); static Native_capability debug_cap(reinterpret_cast<Core_cap_index*>(idx));
return debug_cap; return debug_cap;
} }
Platform_pd::Platform_pd(Core_cap_index &ci) Platform_pd::Platform_pd(Core_cap_index &ci)
: :
_task(Native_capability(&ci), TASK_CAP) _task(Native_capability(&ci), TASK_CAP)

View File

@ -211,7 +211,7 @@ Foc_thread_state Platform_thread::state()
s = _pager_obj->state.state; s = _pager_obj->state.state;
s.kcap = _gate.remote; s.kcap = _gate.remote;
s.id = _gate.local.local_name(); s.id = (uint16_t)_gate.local.local_name();
s.utcb = _utcb; s.utcb = _utcb;
return s; return s;

View File

@ -49,7 +49,7 @@ Cap_index_allocator &Genode::cap_idx_alloc()
Core_cap_index *Cap_mapping::_get_cap() Core_cap_index *Cap_mapping::_get_cap()
{ {
int const id = platform_specific().cap_id_alloc().alloc(); Cap_index::id_t const id = platform_specific().cap_id_alloc().alloc();
return static_cast<Core_cap_index*>(cap_map().insert(id)); return static_cast<Core_cap_index*>(cap_map().insert(id));
} }
@ -104,7 +104,7 @@ Native_capability Rpc_cap_factory::alloc(Native_capability ep)
/* /*
* Allocate new id, and ipc-gate and set id as gate-label * Allocate new id, and ipc-gate and set id as gate-label
*/ */
unsigned long const id = platform_specific().cap_id_alloc().alloc(); Cap_index::id_t const id = platform_specific().cap_id_alloc().alloc();
Core_cap_index *idx = static_cast<Core_cap_index*>(cap_map().insert(id)); Core_cap_index *idx = static_cast<Core_cap_index*>(cap_map().insert(id));
if (!idx) { if (!idx) {
@ -194,17 +194,21 @@ Cap_id_allocator::Cap_id_allocator(Allocator &alloc)
} }
unsigned long Cap_id_allocator::alloc() Cap_id_allocator::id_t Cap_id_allocator::alloc()
{ {
Mutex::Guard lock_guard(_mutex); Mutex::Guard lock_guard(_mutex);
return _id_alloc.try_alloc(CAP_ID_OFFSET).convert<unsigned long>( return _id_alloc.try_alloc(CAP_ID_OFFSET).convert<id_t>(
[&] (void *id) { return (unsigned long)id; },
[&] (Range_allocator::Alloc_error) -> unsigned long { throw Out_of_ids(); }); [&] (void *id) -> id_t {
return (addr_t)id & ID_MASK; },
[&] (Range_allocator::Alloc_error) -> id_t {
throw Out_of_ids(); });
} }
void Cap_id_allocator::free(unsigned long id) void Cap_id_allocator::free(id_t id)
{ {
Mutex::Guard lock_guard(_mutex); Mutex::Guard lock_guard(_mutex);

View File

@ -41,7 +41,7 @@ void Signal_source_component::submit(Signal_context_component &context,
unsigned long cnt) unsigned long cnt)
{ {
/* enqueue signal to context */ /* enqueue signal to context */
context.increment_signal_cnt(cnt); context.increment_signal_cnt((int)cnt);
if (!context.enqueued()) { if (!context.enqueued()) {
_signal_queue.enqueue(context); _signal_queue.enqueue(context);

View File

@ -49,7 +49,7 @@ Vcpu::Vcpu(Rpc_entrypoint &ep,
} }
try { try {
unsigned const vcpu_id = _vcpu_ids.alloc(); unsigned const vcpu_id = (unsigned)_vcpu_ids.alloc();
_task_index_client = thread.setup_vcpu(vcpu_id, task_cap, recall_cap(), _task_index_client = thread.setup_vcpu(vcpu_id, task_cap, recall_cap(),
_foc_vcpu_state); _foc_vcpu_state);
if (_task_index_client == Foc::L4_INVALID_CAP) { if (_task_index_client == Foc::L4_INVALID_CAP) {
@ -76,7 +76,7 @@ Vcpu::~Vcpu()
} }
if (_foc_vcpu_state) { if (_foc_vcpu_state) {
unsigned const vcpu_id = ((addr_t)_foc_vcpu_state - addr_t const vcpu_id = ((addr_t)_foc_vcpu_state -
Platform::VCPU_VIRT_EXT_START) / L4_PAGESIZE; Platform::VCPU_VIRT_EXT_START) / L4_PAGESIZE;
_vcpu_ids.free(vcpu_id); _vcpu_ids.free(vcpu_id);
} }
@ -187,7 +187,7 @@ void Vm_session_component::_attach_vm_memory(Dataspace_component &dsc,
Flexpage page = flex.page(); Flexpage page = flex.page();
while (page.valid()) { while (page.valid()) {
l4_fpage_t fp = l4_fpage(page.addr, page.log2_order, flags); l4_fpage_t fp = l4_fpage(page.addr, (unsigned)page.log2_order, flags);
l4_msgtag_t msg = l4_task_map(_task_vcpu.local.data()->kcap(), l4_msgtag_t msg = l4_task_map(_task_vcpu.local.data()->kcap(),
L4_BASE_TASK_CAP, fp, L4_BASE_TASK_CAP, fp,
l4_map_obj_control(page.hotspot, l4_map_obj_control(page.hotspot,
@ -210,7 +210,7 @@ void Vm_session_component::_detach_vm_memory(addr_t guest_phys, size_t size)
using namespace Foc; using namespace Foc;
l4_task_unmap(_task_vcpu.local.data()->kcap(), l4_task_unmap(_task_vcpu.local.data()->kcap(),
l4_fpage(page.addr, page.log2_order, L4_FPAGE_RWX), l4_fpage(page.addr, (unsigned)page.log2_order, L4_FPAGE_RWX),
L4_FP_ALL_SPACES); L4_FP_ALL_SPACES);
page = flex.page(); page = flex.page();

View File

@ -190,7 +190,7 @@ class Genode::Capability_map : private Noncopyable
* \param id the global capability id * \param id the global capability id
* \return pointer of Cap_index when found, otherwise zero * \return pointer of Cap_index when found, otherwise zero
*/ */
Cap_index* find(int id); Cap_index* find(Cap_index::id_t id);
/** /**
* Create and insert a new Cap_index with a specific capability id * Create and insert a new Cap_index with a specific capability id
@ -203,7 +203,7 @@ class Genode::Capability_map : private Noncopyable
* \return pointer to the new Cap_index object, or zero * \return pointer to the new Cap_index object, or zero
* when allocation failed * when allocation failed
*/ */
Cap_index* insert(int id); Cap_index* insert(Cap_index::id_t id);
/** /**
@ -217,7 +217,7 @@ class Genode::Capability_map : private Noncopyable
* \return pointer to the new Cap_index object, or zero * \return pointer to the new Cap_index object, or zero
* when allocation failed * when allocation failed
*/ */
Cap_index* insert(int id, addr_t kcap); Cap_index* insert(Cap_index::id_t id, addr_t kcap);
/** /**
* Create and insert a new Cap_index with a specific capability id * Create and insert a new Cap_index with a specific capability id
@ -236,7 +236,7 @@ class Genode::Capability_map : private Noncopyable
* with the same id exists and it's kernel-object * with the same id exists and it's kernel-object
* differs to the one given by kcap * differs to the one given by kcap
*/ */
Cap_index *insert_map(int id, addr_t kcap); Cap_index *insert_map(Cap_index::id_t id, addr_t kcap);
/** /**
* Remove (resp. invalidate) a Cap_index object * Remove (resp. invalidate) a Cap_index object

View File

@ -28,13 +28,17 @@
*/ */
class Genode::Native_capability::Data : public Avl_node<Data> class Genode::Native_capability::Data : public Avl_node<Data>
{ {
public:
using id_t = uint16_t;
private: private:
constexpr static uint16_t INVALID_ID = ~0; constexpr static uint16_t INVALID_ID = ~0;
constexpr static uint16_t UNUSED = 0; constexpr static uint16_t UNUSED = 0;
uint8_t _ref_cnt; /* reference counter */ uint8_t _ref_cnt; /* reference counter */
uint16_t _id; /* global capability id */ id_t _id; /* global capability id */
public: public:
@ -56,7 +60,7 @@ class Genode::Native_capability::Data : public Avl_node<Data>
************************/ ************************/
bool higher(Data *n); bool higher(Data *n);
Data *find_by_id(uint16_t id); Data *find_by_id(id_t id);
}; };
#endif /* _INCLUDE__BASE__INTERNAL__CAPABILITY_DATA_H_ */ #endif /* _INCLUDE__BASE__INTERNAL__CAPABILITY_DATA_H_ */

View File

@ -30,7 +30,7 @@ namespace Genode {
static inline Parent_capability parent_cap() static inline Parent_capability parent_cap()
{ {
unsigned long const local_name = _parent_cap; Cap_index::id_t const local_name = (Cap_index::id_t)_parent_cap;
static Cap_index *i = cap_map().insert(local_name, Foc::PARENT_CAP); static Cap_index *i = cap_map().insert(local_name, Foc::PARENT_CAP);
/* /*

View File

@ -104,7 +104,7 @@ uint8_t Cap_index::dec()
** Capability_map class ** ** Capability_map class **
****************************/ ****************************/
Cap_index* Capability_map::find(int id) Cap_index* Capability_map::find(Cap_index::id_t id)
{ {
Lock_guard<Spin_lock> guard(_lock); Lock_guard<Spin_lock> guard(_lock);
@ -112,7 +112,7 @@ Cap_index* Capability_map::find(int id)
} }
Cap_index* Capability_map::insert(int id) Cap_index* Capability_map::insert(Cap_index::id_t id)
{ {
Lock_guard<Spin_lock> guard(_lock); Lock_guard<Spin_lock> guard(_lock);
@ -128,7 +128,7 @@ Cap_index* Capability_map::insert(int id)
} }
Cap_index* Capability_map::insert(int id, addr_t kcap) Cap_index* Capability_map::insert(Cap_index::id_t id, addr_t kcap)
{ {
Lock_guard<Spin_lock> guard(_lock); Lock_guard<Spin_lock> guard(_lock);
@ -146,7 +146,7 @@ Cap_index* Capability_map::insert(int id, addr_t kcap)
} }
Cap_index* Capability_map::insert_map(int id, addr_t kcap) Cap_index* Capability_map::insert_map(Cap_index::id_t id, addr_t kcap)
{ {
using namespace Foc; using namespace Foc;

View File

@ -49,13 +49,13 @@ enum Debug { DEBUG_MSG = 1 };
static inline bool ipc_error(l4_msgtag_t tag, bool print) static inline bool ipc_error(l4_msgtag_t tag, bool print)
{ {
int const ipc_error = l4_ipc_error(tag, l4_utcb()); Foc::l4_umword_t const ipc_error = l4_ipc_error(tag, l4_utcb());
if (ipc_error && print) raw("Ipc error: ", ipc_error, " occurred!"); if (ipc_error && print) raw("Ipc error: ", ipc_error, " occurred!");
return ipc_error; return ipc_error;
} }
static constexpr unsigned long INVALID_BADGE = ~0UL; static constexpr Cap_index::id_t INVALID_BADGE = 0xffff;
/** /**
@ -63,9 +63,9 @@ static constexpr unsigned long INVALID_BADGE = ~0UL;
*/ */
struct Cap_info struct Cap_info
{ {
bool valid = false; bool valid = false;
unsigned long sel = 0; unsigned long sel = 0;
unsigned long badge = 0; Cap_index::id_t badge = 0;
}; };
@ -74,9 +74,9 @@ struct Cap_info
* *
* \return protocol word (local name or exception code) * \return protocol word (local name or exception code)
*/ */
static unsigned long extract_msg_from_utcb(l4_msgtag_t tag, static int extract_msg_from_utcb(l4_msgtag_t tag,
Receive_window &rcv_window, Receive_window &rcv_window,
Msgbuf_base &rcv_msg) Msgbuf_base &rcv_msg)
{ {
unsigned num_msg_words = l4_msgtag_words(tag); unsigned num_msg_words = l4_msgtag_words(tag);
@ -90,7 +90,7 @@ static unsigned long extract_msg_from_utcb(l4_msgtag_t tag,
unsigned long const protocol_word = *msg_words++; unsigned long const protocol_word = *msg_words++;
/* read number of capability arguments from second message word */ /* read number of capability arguments from second message word */
size_t const num_caps = min(*msg_words, Msgbuf_base::MAX_CAPS_PER_MSG); unsigned const num_caps = (unsigned)min(*msg_words, Msgbuf_base::MAX_CAPS_PER_MSG);
msg_words++; msg_words++;
num_msg_words -= 2; num_msg_words -= 2;
@ -114,7 +114,7 @@ static unsigned long extract_msg_from_utcb(l4_msgtag_t tag,
for (unsigned i = 0, sel_idx = 0; i < num_caps; i++) { for (unsigned i = 0, sel_idx = 0; i < num_caps; i++) {
unsigned long const badge = *msg_words++; Cap_index::id_t const badge = (Cap_index::id_t)(*msg_words++);
if (badge == INVALID_BADGE) if (badge == INVALID_BADGE)
continue; continue;
@ -135,7 +135,7 @@ static unsigned long extract_msg_from_utcb(l4_msgtag_t tag,
if ((num_msg_words)*sizeof(l4_mword_t) > rcv_msg.capacity()) { if ((num_msg_words)*sizeof(l4_mword_t) > rcv_msg.capacity()) {
if (DEBUG_MSG) if (DEBUG_MSG)
raw("receive message buffer too small"); raw("receive message buffer too small");
num_msg_words = rcv_msg.capacity()/sizeof(l4_mword_t); num_msg_words = (unsigned)(rcv_msg.capacity()/sizeof(l4_mword_t));
} }
/* read message payload beginning from the second UTCB message register */ /* read message payload beginning from the second UTCB message register */
@ -160,7 +160,7 @@ static unsigned long extract_msg_from_utcb(l4_msgtag_t tag,
} }
} }
return protocol_word; return (int)protocol_word;
} }
@ -175,8 +175,8 @@ static l4_msgtag_t copy_msgbuf_to_utcb(Msgbuf_base &snd_msg,
unsigned long protocol_word) unsigned long protocol_word)
{ {
unsigned const num_data_words = snd_msg.data_size() / sizeof(l4_mword_t); unsigned const num_data_words = (unsigned)(snd_msg.data_size() / sizeof(l4_mword_t));
unsigned const num_caps = snd_msg.used_caps(); unsigned const num_caps = (unsigned)snd_msg.used_caps();
/* validate capabilities present in the message buffer */ /* validate capabilities present in the message buffer */
for (unsigned i = 0; i < num_caps; i++) { for (unsigned i = 0; i < num_caps; i++) {
@ -201,7 +201,7 @@ static l4_msgtag_t copy_msgbuf_to_utcb(Msgbuf_base &snd_msg,
Native_capability const &cap = snd_msg.cap(i); Native_capability const &cap = snd_msg.cap(i);
if (cap.valid()) { if (cap.valid()) {
caps[i].valid = true; caps[i].valid = true;
caps[i].badge = cap.local_name(); caps[i].badge = (Cap_index::id_t)cap.local_name();
caps[i].sel = cap.data()->kcap(); caps[i].sel = cap.data()->kcap();
} }
} }

View File

@ -29,9 +29,12 @@
#include <foc/native_capability.h> #include <foc/native_capability.h>
namespace Foc { namespace Foc {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#include <l4/sys/vcpu.h> #include <l4/sys/vcpu.h>
#include <l4/sys/__vm-svm.h> #include <l4/sys/__vm-svm.h>
#include <l4/sys/__vm-vmx.h> #include <l4/sys/__vm-vmx.h>
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
} }
using namespace Genode; using namespace Genode;
@ -218,9 +221,9 @@ struct Foc_vcpu : Thread, Noncopyable
CR0_PG = 0 /* 1U << 31 - not needed in case of UG */ CR0_PG = 0 /* 1U << 31 - not needed in case of UG */
}; };
addr_t const _cr0_mask { CR0_NM | CR0_CD }; addr_t const _cr0_mask { CR0_NM | CR0_CD };
addr_t const vmcb_ctrl0 { CTRL0_IO | CTRL0_MSR }; uint32_t const vmcb_ctrl0 { CTRL0_IO | CTRL0_MSR };
addr_t const vmcb_ctrl1 { 0 }; uint32_t const vmcb_ctrl1 { 0 };
addr_t vmcb_cr0_shadow { 0 }; addr_t vmcb_cr0_shadow { 0 };
addr_t vmcb_cr4_shadow { 0 }; addr_t vmcb_cr4_shadow { 0 };
@ -481,7 +484,7 @@ struct Foc_vcpu : Thread, Noncopyable
* Convert to AMD (and Genode) format comprising 16 bits. * Convert to AMD (and Genode) format comprising 16 bits.
*/ */
uint16_t _convert_ar_16(addr_t value) { uint16_t _convert_ar_16(addr_t value) {
return ((value & 0x1f000) >> 4) | (value & 0xff); } return (uint16_t)(((value & 0x1f000) >> 4) | (value & 0xff)); }
void _read_intel_state(Vcpu_state &state, void *vmcs, void _read_intel_state(Vcpu_state &state, void *vmcs,
Foc::l4_vcpu_state_t *vcpu) Foc::l4_vcpu_state_t *vcpu)
@ -495,18 +498,15 @@ struct Foc_vcpu : Thread, Noncopyable
state.di.charge(vcpu->r.di); state.di.charge(vcpu->r.di);
state.si.charge(vcpu->r.si); state.si.charge(vcpu->r.si);
state.flags.charge(Foc::l4_vm_vmx_read(vmcs, Vmcs::FLAGS)); state.flags .charge((addr_t)Foc::l4_vm_vmx_read(vmcs, Vmcs::FLAGS));
state.sp .charge((addr_t)Foc::l4_vm_vmx_read(vmcs, Vmcs::SP));
state.sp.charge(Foc::l4_vm_vmx_read(vmcs, Vmcs::SP)); state.ip .charge((addr_t)Foc::l4_vm_vmx_read(vmcs, Vmcs::IP));
state.ip_len.charge((addr_t)Foc::l4_vm_vmx_read(vmcs, Vmcs::INST_LEN));
state.ip.charge(Foc::l4_vm_vmx_read(vmcs, Vmcs::IP)); state.dr7 .charge((addr_t)Foc::l4_vm_vmx_read(vmcs, Vmcs::DR7));
state.ip_len.charge(Foc::l4_vm_vmx_read(vmcs, Vmcs::INST_LEN));
state.dr7.charge(Foc::l4_vm_vmx_read(vmcs, Vmcs::DR7));
#ifdef __x86_64__ #ifdef __x86_64__
state.r8.charge(vcpu->r.r8); state.r8 .charge(vcpu->r.r8);
state.r9.charge(vcpu->r.r9); state.r9 .charge(vcpu->r.r9);
state.r10.charge(vcpu->r.r10); state.r10.charge(vcpu->r.r10);
state.r11.charge(vcpu->r.r11); state.r11.charge(vcpu->r.r11);
state.r12.charge(vcpu->r.r12); state.r12.charge(vcpu->r.r12);
@ -516,21 +516,25 @@ struct Foc_vcpu : Thread, Noncopyable
#endif #endif
{ {
addr_t const cr0 = Foc::l4_vm_vmx_read(vmcs, Vmcs::CR0); addr_t const cr0 = (addr_t)Foc::l4_vm_vmx_read(vmcs, Vmcs::CR0);
addr_t const cr0_shadow = Foc::l4_vm_vmx_read(vmcs, Vmcs::CR0_SHADOW); addr_t const cr0_shadow = (addr_t)Foc::l4_vm_vmx_read(vmcs, Vmcs::CR0_SHADOW);
state.cr0.charge((cr0 & ~vmcs_cr0_mask) | (cr0_shadow & vmcs_cr0_mask)); state.cr0.charge((cr0 & ~vmcs_cr0_mask) | (cr0_shadow & vmcs_cr0_mask));
if (state.cr0.value() != cr0_shadow) if (state.cr0.value() != cr0_shadow)
Foc::l4_vm_vmx_write(vmcs, Vmcs::CR0_SHADOW, state.cr0.value()); Foc::l4_vm_vmx_write(vmcs, Vmcs::CR0_SHADOW, state.cr0.value());
} }
unsigned const cr2 = Foc::l4_vm_vmx_get_cr2_index(vmcs); unsigned const cr2 = Foc::l4_vm_vmx_get_cr2_index(vmcs);
state.cr2.charge(Foc::l4_vm_vmx_read(vmcs, cr2)); state.cr2.charge((addr_t)Foc::l4_vm_vmx_read(vmcs, cr2));
state.cr3.charge(Foc::l4_vm_vmx_read(vmcs, Vmcs::CR3)); state.cr3.charge((addr_t)Foc::l4_vm_vmx_read(vmcs, Vmcs::CR3));
{ {
addr_t const cr4 = Foc::l4_vm_vmx_read(vmcs, Vmcs::CR4); addr_t const cr4 = (addr_t)Foc::l4_vm_vmx_read(vmcs, Vmcs::CR4);
addr_t const cr4_shadow = Foc::l4_vm_vmx_read(vmcs, Vmcs::CR4_SHADOW); addr_t const cr4_shadow = (addr_t)Foc::l4_vm_vmx_read(vmcs, Vmcs::CR4_SHADOW);
state.cr4.charge((cr4 & ~vmcs_cr4_mask) | (cr4_shadow & vmcs_cr4_mask)); state.cr4.charge((cr4 & ~vmcs_cr4_mask) | (cr4_shadow & vmcs_cr4_mask));
if (state.cr4.value() != cr4_shadow) if (state.cr4.value() != cr4_shadow)
Foc::l4_vm_vmx_write(vmcs, Vmcs::CR4_SHADOW, Foc::l4_vm_vmx_write(vmcs, Vmcs::CR4_SHADOW,
state.cr4.value()); state.cr4.value());
@ -545,7 +549,7 @@ struct Foc_vcpu : Thread, Noncopyable
{ {
Segment cs { l4_vm_vmx_read_16(vmcs, Vmcs::CS_SEL), Segment cs { l4_vm_vmx_read_16(vmcs, Vmcs::CS_SEL),
_convert_ar_16(l4_vm_vmx_read(vmcs, Vmcs::CS_AR)), _convert_ar_16((addr_t)l4_vm_vmx_read(vmcs, Vmcs::CS_AR)),
l4_vm_vmx_read_32(vmcs, Vmcs::CS_LIMIT), l4_vm_vmx_read_32(vmcs, Vmcs::CS_LIMIT),
l4_vm_vmx_read_nat(vmcs, Vmcs::CS_BASE) }; l4_vm_vmx_read_nat(vmcs, Vmcs::CS_BASE) };
@ -554,7 +558,7 @@ struct Foc_vcpu : Thread, Noncopyable
{ {
Segment ss { l4_vm_vmx_read_16(vmcs, Vmcs::SS_SEL), Segment ss { l4_vm_vmx_read_16(vmcs, Vmcs::SS_SEL),
_convert_ar_16(l4_vm_vmx_read(vmcs, Vmcs::SS_AR)), _convert_ar_16((addr_t)l4_vm_vmx_read(vmcs, Vmcs::SS_AR)),
l4_vm_vmx_read_32(vmcs, Vmcs::SS_LIMIT), l4_vm_vmx_read_32(vmcs, Vmcs::SS_LIMIT),
l4_vm_vmx_read_nat(vmcs, Vmcs::SS_BASE) }; l4_vm_vmx_read_nat(vmcs, Vmcs::SS_BASE) };
@ -563,7 +567,7 @@ struct Foc_vcpu : Thread, Noncopyable
{ {
Segment es { l4_vm_vmx_read_16(vmcs, Vmcs::ES_SEL), Segment es { l4_vm_vmx_read_16(vmcs, Vmcs::ES_SEL),
_convert_ar_16(l4_vm_vmx_read(vmcs, Vmcs::ES_AR)), _convert_ar_16((addr_t)l4_vm_vmx_read(vmcs, Vmcs::ES_AR)),
l4_vm_vmx_read_32(vmcs, Vmcs::ES_LIMIT), l4_vm_vmx_read_32(vmcs, Vmcs::ES_LIMIT),
l4_vm_vmx_read_nat(vmcs, Vmcs::ES_BASE) }; l4_vm_vmx_read_nat(vmcs, Vmcs::ES_BASE) };
@ -572,7 +576,7 @@ struct Foc_vcpu : Thread, Noncopyable
{ {
Segment ds { l4_vm_vmx_read_16(vmcs, Vmcs::DS_SEL), Segment ds { l4_vm_vmx_read_16(vmcs, Vmcs::DS_SEL),
_convert_ar_16(l4_vm_vmx_read(vmcs, Vmcs::DS_AR)), _convert_ar_16((addr_t)l4_vm_vmx_read(vmcs, Vmcs::DS_AR)),
l4_vm_vmx_read_32(vmcs, Vmcs::DS_LIMIT), l4_vm_vmx_read_32(vmcs, Vmcs::DS_LIMIT),
l4_vm_vmx_read_nat(vmcs, Vmcs::DS_BASE) }; l4_vm_vmx_read_nat(vmcs, Vmcs::DS_BASE) };
@ -581,7 +585,7 @@ struct Foc_vcpu : Thread, Noncopyable
{ {
Segment fs { l4_vm_vmx_read_16(vmcs, Vmcs::FS_SEL), Segment fs { l4_vm_vmx_read_16(vmcs, Vmcs::FS_SEL),
_convert_ar_16(l4_vm_vmx_read(vmcs, Vmcs::FS_AR)), _convert_ar_16((addr_t)l4_vm_vmx_read(vmcs, Vmcs::FS_AR)),
l4_vm_vmx_read_32(vmcs, Vmcs::FS_LIMIT), l4_vm_vmx_read_32(vmcs, Vmcs::FS_LIMIT),
l4_vm_vmx_read_nat(vmcs, Vmcs::FS_BASE) }; l4_vm_vmx_read_nat(vmcs, Vmcs::FS_BASE) };
@ -590,7 +594,7 @@ struct Foc_vcpu : Thread, Noncopyable
{ {
Segment gs { l4_vm_vmx_read_16(vmcs, Vmcs::GS_SEL), Segment gs { l4_vm_vmx_read_16(vmcs, Vmcs::GS_SEL),
_convert_ar_16(l4_vm_vmx_read(vmcs, Vmcs::GS_AR)), _convert_ar_16((addr_t)l4_vm_vmx_read(vmcs, Vmcs::GS_AR)),
l4_vm_vmx_read_32(vmcs, Vmcs::GS_LIMIT), l4_vm_vmx_read_32(vmcs, Vmcs::GS_LIMIT),
l4_vm_vmx_read_nat(vmcs, Vmcs::GS_BASE) }; l4_vm_vmx_read_nat(vmcs, Vmcs::GS_BASE) };
@ -599,7 +603,7 @@ struct Foc_vcpu : Thread, Noncopyable
{ {
Segment tr { l4_vm_vmx_read_16(vmcs, Vmcs::TR_SEL), Segment tr { l4_vm_vmx_read_16(vmcs, Vmcs::TR_SEL),
_convert_ar_16(l4_vm_vmx_read(vmcs, Vmcs::TR_AR)), _convert_ar_16((addr_t)l4_vm_vmx_read(vmcs, Vmcs::TR_AR)),
l4_vm_vmx_read_32(vmcs, Vmcs::TR_LIMIT), l4_vm_vmx_read_32(vmcs, Vmcs::TR_LIMIT),
l4_vm_vmx_read_nat(vmcs, Vmcs::TR_BASE) }; l4_vm_vmx_read_nat(vmcs, Vmcs::TR_BASE) };
@ -608,7 +612,7 @@ struct Foc_vcpu : Thread, Noncopyable
{ {
Segment ldtr { l4_vm_vmx_read_16(vmcs, Vmcs::LDTR_SEL), Segment ldtr { l4_vm_vmx_read_16(vmcs, Vmcs::LDTR_SEL),
_convert_ar_16(l4_vm_vmx_read(vmcs, Vmcs::LDTR_AR)), _convert_ar_16((addr_t)l4_vm_vmx_read(vmcs, Vmcs::LDTR_AR)),
l4_vm_vmx_read_32(vmcs, Vmcs::LDTR_LIMIT), l4_vm_vmx_read_32(vmcs, Vmcs::LDTR_LIMIT),
l4_vm_vmx_read_nat(vmcs, Vmcs::LDTR_BASE) }; l4_vm_vmx_read_nat(vmcs, Vmcs::LDTR_BASE) };
@ -621,35 +625,35 @@ struct Foc_vcpu : Thread, Noncopyable
state.idtr.charge(Range{.limit = l4_vm_vmx_read_32(vmcs, Vmcs::IDTR_LIMIT), state.idtr.charge(Range{.limit = l4_vm_vmx_read_32(vmcs, Vmcs::IDTR_LIMIT),
.base = l4_vm_vmx_read_nat(vmcs, Vmcs::IDTR_BASE)}); .base = l4_vm_vmx_read_nat(vmcs, Vmcs::IDTR_BASE)});
state.sysenter_cs.charge(l4_vm_vmx_read(vmcs, Vmcs::SYSENTER_CS)); state.sysenter_cs.charge((addr_t)l4_vm_vmx_read(vmcs, Vmcs::SYSENTER_CS));
state.sysenter_sp.charge(l4_vm_vmx_read(vmcs, Vmcs::SYSENTER_SP)); state.sysenter_sp.charge((addr_t)l4_vm_vmx_read(vmcs, Vmcs::SYSENTER_SP));
state.sysenter_ip.charge(l4_vm_vmx_read(vmcs, Vmcs::SYSENTER_IP)); state.sysenter_ip.charge((addr_t)l4_vm_vmx_read(vmcs, Vmcs::SYSENTER_IP));
state.qual_primary.charge(l4_vm_vmx_read(vmcs, Vmcs::EXIT_QUAL)); state.qual_primary .charge(l4_vm_vmx_read(vmcs, Vmcs::EXIT_QUAL));
state.qual_secondary.charge(l4_vm_vmx_read(vmcs, Vmcs::GUEST_PHYS)); state.qual_secondary.charge(l4_vm_vmx_read(vmcs, Vmcs::GUEST_PHYS));
state.ctrl_primary.charge(l4_vm_vmx_read(vmcs, Vmcs::CTRL_0)); state.ctrl_primary .charge((uint32_t)l4_vm_vmx_read(vmcs, Vmcs::CTRL_0));
state.ctrl_secondary.charge(l4_vm_vmx_read(vmcs, Vmcs::CTRL_1)); state.ctrl_secondary.charge((uint32_t)l4_vm_vmx_read(vmcs, Vmcs::CTRL_1));
if (state.exit_reason == INTEL_EXIT_INVALID || if (state.exit_reason == INTEL_EXIT_INVALID ||
state.exit_reason == VMEXIT_PAUSED) state.exit_reason == VMEXIT_PAUSED)
{ {
state.inj_info.charge(l4_vm_vmx_read(vmcs, Vmcs::INTR_INFO)); state.inj_info .charge((uint32_t)l4_vm_vmx_read(vmcs, Vmcs::INTR_INFO));
state.inj_error.charge(l4_vm_vmx_read(vmcs, Vmcs::INTR_ERROR)); state.inj_error.charge((uint32_t)l4_vm_vmx_read(vmcs, Vmcs::INTR_ERROR));
} else { } else {
state.inj_info.charge(l4_vm_vmx_read(vmcs, Vmcs::IDT_INFO)); state.inj_info .charge((uint32_t)l4_vm_vmx_read(vmcs, Vmcs::IDT_INFO));
state.inj_error.charge(l4_vm_vmx_read(vmcs, Vmcs::IDT_ERROR)); state.inj_error.charge((uint32_t)l4_vm_vmx_read(vmcs, Vmcs::IDT_ERROR));
} }
state.intr_state.charge(l4_vm_vmx_read(vmcs, Vmcs::STATE_INTR)); state.intr_state.charge((uint32_t)l4_vm_vmx_read(vmcs, Vmcs::STATE_INTR));
state.actv_state.charge(l4_vm_vmx_read(vmcs, Vmcs::STATE_ACTV)); state.actv_state.charge((uint32_t)l4_vm_vmx_read(vmcs, Vmcs::STATE_ACTV));
state.tsc.charge(Trace::timestamp()); state.tsc.charge(Trace::timestamp());
state.tsc_offset.charge(_tsc_offset); state.tsc_offset.charge(_tsc_offset);
state.efer.charge(l4_vm_vmx_read(vmcs, Vmcs::EFER)); state.efer.charge((addr_t)l4_vm_vmx_read(vmcs, Vmcs::EFER));
state.star.charge(l4_vm_vmx_read(vmcs, Vmcs::MSR_STAR)); state.star .charge(l4_vm_vmx_read(vmcs, Vmcs::MSR_STAR));
state.lstar.charge(l4_vm_vmx_read(vmcs, Vmcs::MSR_LSTAR)); state.lstar.charge(l4_vm_vmx_read(vmcs, Vmcs::MSR_LSTAR));
state.cstar.charge(l4_vm_vmx_read(vmcs, Vmcs::MSR_CSTAR)); state.cstar.charge(l4_vm_vmx_read(vmcs, Vmcs::MSR_CSTAR));
state.fmask.charge(l4_vm_vmx_read(vmcs, Vmcs::MSR_FMASK)); state.fmask.charge(l4_vm_vmx_read(vmcs, Vmcs::MSR_FMASK));
@ -665,7 +669,7 @@ struct Foc_vcpu : Thread, Noncopyable
void _read_amd_state(Vcpu_state &state, Foc::l4_vm_svm_vmcb_t *vmcb, void _read_amd_state(Vcpu_state &state, Foc::l4_vm_svm_vmcb_t *vmcb,
Foc::l4_vcpu_state_t * const vcpu) Foc::l4_vcpu_state_t * const vcpu)
{ {
state.ax.charge(vmcb->state_save_area.rax); state.ax.charge((addr_t)vmcb->state_save_area.rax);
state.cx.charge(vcpu->r.cx); state.cx.charge(vcpu->r.cx);
state.dx.charge(vcpu->r.dx); state.dx.charge(vcpu->r.dx);
state.bx.charge(vcpu->r.bx); state.bx.charge(vcpu->r.bx);
@ -674,18 +678,18 @@ struct Foc_vcpu : Thread, Noncopyable
state.si.charge(vcpu->r.si); state.si.charge(vcpu->r.si);
state.bp.charge(vcpu->r.bp); state.bp.charge(vcpu->r.bp);
state.flags.charge(vmcb->state_save_area.rflags); state.flags.charge((addr_t)vmcb->state_save_area.rflags);
state.sp.charge(vmcb->state_save_area.rsp); state.sp.charge((addr_t)vmcb->state_save_area.rsp);
state.ip.charge(vmcb->state_save_area.rip); state.ip.charge((addr_t)vmcb->state_save_area.rip);
state.ip_len.charge(0); /* unsupported on AMD */ state.ip_len.charge(0); /* unsupported on AMD */
state.dr7.charge(vmcb->state_save_area.dr7); state.dr7.charge((addr_t)vmcb->state_save_area.dr7);
#ifdef __x86_64__ #ifdef __x86_64__
state.r8.charge(vcpu->r.r8); state.r8 .charge(vcpu->r.r8);
state.r9.charge(vcpu->r.r9); state.r9 .charge(vcpu->r.r9);
state.r10.charge(vcpu->r.r10); state.r10.charge(vcpu->r.r10);
state.r11.charge(vcpu->r.r11); state.r11.charge(vcpu->r.r11);
state.r12.charge(vcpu->r.r12); state.r12.charge(vcpu->r.r12);
@ -695,15 +699,15 @@ struct Foc_vcpu : Thread, Noncopyable
#endif #endif
{ {
addr_t const cr0 = vmcb->state_save_area.cr0; addr_t const cr0 = (addr_t)vmcb->state_save_area.cr0;
state.cr0.charge((cr0 & ~vmcb_cr0_mask) | (vmcb_cr0_shadow & vmcb_cr0_mask)); state.cr0.charge((cr0 & ~vmcb_cr0_mask) | (vmcb_cr0_shadow & vmcb_cr0_mask));
if (state.cr0.value() != vmcb_cr0_shadow) if (state.cr0.value() != vmcb_cr0_shadow)
vmcb_cr0_shadow = state.cr0.value(); vmcb_cr0_shadow = state.cr0.value();
} }
state.cr2.charge(vmcb->state_save_area.cr2); state.cr2.charge((addr_t)vmcb->state_save_area.cr2);
state.cr3.charge(vmcb->state_save_area.cr3); state.cr3.charge((addr_t)vmcb->state_save_area.cr3);
{ {
addr_t const cr4 = vmcb->state_save_area.cr4; addr_t const cr4 = (addr_t)vmcb->state_save_area.cr4;
state.cr4.charge((cr4 & ~vmcb_cr4_mask) | (vmcb_cr4_shadow & vmcb_cr4_mask)); state.cr4.charge((cr4 & ~vmcb_cr4_mask) | (vmcb_cr4_shadow & vmcb_cr4_mask));
if (state.cr4.value() != vmcb_cr4_shadow) if (state.cr4.value() != vmcb_cr4_shadow)
vmcb_cr4_shadow = state.cr4.value(); vmcb_cr4_shadow = state.cr4.value();
@ -712,44 +716,44 @@ struct Foc_vcpu : Thread, Noncopyable
typedef Vcpu_state::Segment Segment; typedef Vcpu_state::Segment Segment;
state.cs.charge(Segment{vmcb->state_save_area.cs.selector, state.cs.charge(Segment{vmcb->state_save_area.cs.selector,
vmcb->state_save_area.cs.attrib, vmcb->state_save_area.cs.attrib,
vmcb->state_save_area.cs.limit, vmcb->state_save_area.cs.limit,
(addr_t)vmcb->state_save_area.cs.base}); (addr_t)vmcb->state_save_area.cs.base});
state.ss.charge(Segment{vmcb->state_save_area.ss.selector, state.ss.charge(Segment{vmcb->state_save_area.ss.selector,
vmcb->state_save_area.ss.attrib, vmcb->state_save_area.ss.attrib,
vmcb->state_save_area.ss.limit, vmcb->state_save_area.ss.limit,
(addr_t)vmcb->state_save_area.ss.base}); (addr_t)vmcb->state_save_area.ss.base});
state.es.charge(Segment{vmcb->state_save_area.es.selector, state.es.charge(Segment{vmcb->state_save_area.es.selector,
vmcb->state_save_area.es.attrib, vmcb->state_save_area.es.attrib,
vmcb->state_save_area.es.limit, vmcb->state_save_area.es.limit,
(addr_t)vmcb->state_save_area.es.base}); (addr_t)vmcb->state_save_area.es.base});
state.ds.charge(Segment{vmcb->state_save_area.ds.selector, state.ds.charge(Segment{vmcb->state_save_area.ds.selector,
vmcb->state_save_area.ds.attrib, vmcb->state_save_area.ds.attrib,
vmcb->state_save_area.ds.limit, vmcb->state_save_area.ds.limit,
(addr_t)vmcb->state_save_area.ds.base}); (addr_t)vmcb->state_save_area.ds.base});
state.fs.charge(Segment{vmcb->state_save_area.fs.selector, state.fs.charge(Segment{vmcb->state_save_area.fs.selector,
vmcb->state_save_area.fs.attrib, vmcb->state_save_area.fs.attrib,
vmcb->state_save_area.fs.limit, vmcb->state_save_area.fs.limit,
(addr_t)vmcb->state_save_area.fs.base}); (addr_t)vmcb->state_save_area.fs.base});
state.gs.charge(Segment{vmcb->state_save_area.gs.selector, state.gs.charge(Segment{vmcb->state_save_area.gs.selector,
vmcb->state_save_area.gs.attrib, vmcb->state_save_area.gs.attrib,
vmcb->state_save_area.gs.limit, vmcb->state_save_area.gs.limit,
(addr_t)vmcb->state_save_area.gs.base}); (addr_t)vmcb->state_save_area.gs.base});
state.tr.charge(Segment{vmcb->state_save_area.tr.selector, state.tr.charge(Segment{vmcb->state_save_area.tr.selector,
vmcb->state_save_area.tr.attrib, vmcb->state_save_area.tr.attrib,
vmcb->state_save_area.tr.limit, vmcb->state_save_area.tr.limit,
(addr_t)vmcb->state_save_area.tr.base}); (addr_t)vmcb->state_save_area.tr.base});
state.ldtr.charge(Segment{vmcb->state_save_area.ldtr.selector, state.ldtr.charge(Segment{vmcb->state_save_area.ldtr.selector,
vmcb->state_save_area.ldtr.attrib, vmcb->state_save_area.ldtr.attrib,
vmcb->state_save_area.ldtr.limit, vmcb->state_save_area.ldtr.limit,
(addr_t)vmcb->state_save_area.ldtr.base}); (addr_t)vmcb->state_save_area.ldtr.base});
typedef Vcpu_state::Range Range; typedef Vcpu_state::Range Range;
@ -759,11 +763,11 @@ struct Foc_vcpu : Thread, Noncopyable
state.idtr.charge(Range{.limit = vmcb->state_save_area.idtr.limit, state.idtr.charge(Range{.limit = vmcb->state_save_area.idtr.limit,
.base = (addr_t)vmcb->state_save_area.idtr.base }); .base = (addr_t)vmcb->state_save_area.idtr.base });
state.sysenter_cs.charge(vmcb->state_save_area.sysenter_cs); state.sysenter_cs.charge((addr_t)vmcb->state_save_area.sysenter_cs);
state.sysenter_sp.charge(vmcb->state_save_area.sysenter_esp); state.sysenter_sp.charge((addr_t)vmcb->state_save_area.sysenter_esp);
state.sysenter_ip.charge(vmcb->state_save_area.sysenter_eip); state.sysenter_ip.charge((addr_t)vmcb->state_save_area.sysenter_eip);
state.qual_primary.charge(vmcb->control_area.exitinfo1); state.qual_primary .charge(vmcb->control_area.exitinfo1);
state.qual_secondary.charge(vmcb->control_area.exitinfo2); state.qual_secondary.charge(vmcb->control_area.exitinfo2);
uint32_t inj_info = 0; uint32_t inj_info = 0;
@ -771,22 +775,22 @@ struct Foc_vcpu : Thread, Noncopyable
if (state.exit_reason == AMD_EXIT_INVALID || if (state.exit_reason == AMD_EXIT_INVALID ||
state.exit_reason == VMEXIT_PAUSED) state.exit_reason == VMEXIT_PAUSED)
{ {
inj_info = vmcb->control_area.eventinj; inj_info = (uint32_t)vmcb->control_area.eventinj;
inj_error = vmcb->control_area.eventinj >> 32; inj_error = (uint32_t)(vmcb->control_area.eventinj >> 32);
} else { } else {
inj_info = vmcb->control_area.exitintinfo; inj_info = (uint32_t)vmcb->control_area.exitintinfo;
inj_error = vmcb->control_area.exitintinfo >> 32; inj_error = (uint32_t)(vmcb->control_area.exitintinfo >> 32);
} }
state.inj_info.charge(inj_info); state.inj_info .charge(inj_info);
state.inj_error.charge(inj_error); state.inj_error.charge(inj_error);
state.intr_state.charge(vmcb->control_area.interrupt_shadow); state.intr_state.charge((uint32_t)vmcb->control_area.interrupt_shadow);
state.actv_state.charge(0); state.actv_state.charge(0);
state.tsc.charge(Trace::timestamp()); state.tsc.charge(Trace::timestamp());
state.tsc_offset.charge(_tsc_offset); state.tsc_offset.charge(_tsc_offset);
state.efer.charge(vmcb->state_save_area.efer); state.efer.charge((addr_t)vmcb->state_save_area.efer);
if (state.pdpte_0.charged() || state.pdpte_1.charged() || if (state.pdpte_0.charged() || state.pdpte_1.charged() ||
state.pdpte_2.charged() || state.pdpte_3.charged()) { state.pdpte_2.charged() || state.pdpte_3.charged()) {
@ -894,9 +898,9 @@ struct Foc_vcpu : Thread, Noncopyable
} }
if (state.inj_info.charged() || state.inj_error.charged()) { if (state.inj_info.charged() || state.inj_error.charged()) {
addr_t ctrl_0 = state.ctrl_primary.charged() ? uint32_t ctrl_0 = state.ctrl_primary.charged()
state.ctrl_primary.value() : ? (uint32_t)state.ctrl_primary.value()
Foc::l4_vm_vmx_read(vmcs, Vmcs::CTRL_0); : (uint32_t)Foc::l4_vm_vmx_read(vmcs, Vmcs::CTRL_0);
if (state.inj_info.value() & 0x2000) if (state.inj_info.value() & 0x2000)
warning("unimplemented ", state.inj_info.value() & 0x1000, " ", warning("unimplemented ", state.inj_info.value() & 0x1000, " ",

View File

@ -38,7 +38,8 @@ Main::Main(Env &env)
Foc::l4_cap_idx_t tid = Capability_space::kcap(env.pd_session_cap()); Foc::l4_cap_idx_t tid = Capability_space::kcap(env.pd_session_cap());
/* try the first 1000 local name IDs */ /* try the first 1000 local name IDs */
for (int local_name = 0; local_name < COUNT; local_name++, idx++) { using id_t = Native_capability::Data::id_t;
for (id_t local_name = 0; local_name < COUNT; local_name++, idx++) {
idx->id(local_name); idx->id(local_name);
l4_task_map(L4_BASE_TASK_CAP, L4_BASE_TASK_CAP, l4_task_map(L4_BASE_TASK_CAP, L4_BASE_TASK_CAP,
l4_obj_fpage(tid, 0, L4_FPAGE_RWX), l4_obj_fpage(tid, 0, L4_FPAGE_RWX),

View File

@ -97,7 +97,7 @@ namespace Kernel {
*/ */
inline int timeout(timeout_t const duration_us, capid_t const sigid) inline int timeout(timeout_t const duration_us, capid_t const sigid)
{ {
return call(call_id_timeout(), duration_us, sigid); return (int)call(call_id_timeout(), duration_us, sigid);
} }
@ -230,7 +230,7 @@ namespace Kernel {
*/ */
inline int send_request_msg(capid_t const thread_id, unsigned rcv_caps) inline int send_request_msg(capid_t const thread_id, unsigned rcv_caps)
{ {
return call(call_id_send_request_msg(), thread_id, rcv_caps); return (int)call(call_id_send_request_msg(), thread_id, rcv_caps);
} }
@ -248,7 +248,7 @@ namespace Kernel {
*/ */
inline int await_request_msg(unsigned rcv_caps) inline int await_request_msg(unsigned rcv_caps)
{ {
return call(call_id_await_request_msg(), rcv_caps); return (int)call(call_id_await_request_msg(), rcv_caps);
} }
@ -266,7 +266,7 @@ namespace Kernel {
*/ */
inline int send_reply_msg(unsigned rcv_caps, bool const await_request_msg) inline int send_reply_msg(unsigned rcv_caps, bool const await_request_msg)
{ {
return call(call_id_send_reply_msg(), rcv_caps, await_request_msg); return (int)call(call_id_send_reply_msg(), rcv_caps, await_request_msg);
} }
@ -302,7 +302,7 @@ namespace Kernel {
*/ */
inline int await_signal(capid_t const receiver_id) inline int await_signal(capid_t const receiver_id)
{ {
return call(call_id_await_signal(), receiver_id); return (int)call(call_id_await_signal(), receiver_id);
} }
@ -320,7 +320,7 @@ namespace Kernel {
*/ */
inline int pending_signal(capid_t const receiver_id) inline int pending_signal(capid_t const receiver_id)
{ {
return call(call_id_pending_signal(), receiver_id); return (int)call(call_id_pending_signal(), receiver_id);
} }
@ -352,7 +352,7 @@ namespace Kernel {
*/ */
inline int submit_signal(capid_t const context, unsigned const num) inline int submit_signal(capid_t const context, unsigned const num)
{ {
return call(call_id_submit_signal(), context, num); return (int)call(call_id_submit_signal(), context, num);
} }
@ -377,7 +377,7 @@ namespace Kernel {
*/ */
inline int kill_signal_context(capid_t const context) inline int kill_signal_context(capid_t const context)
{ {
return call(call_id_kill_signal_context(), context); return (int)call(call_id_kill_signal_context(), context);
} }
/** /**

View File

@ -38,3 +38,5 @@ vpath hw/% $(BASE_HW_DIR)/src/lib
vpath lib/base/% $(BASE_HW_DIR)/src vpath lib/base/% $(BASE_HW_DIR)/src
vpath lib/base/% $(BASE_DIR)/src vpath lib/base/% $(BASE_DIR)/src
vpath lib/startup/% $(BASE_DIR)/src vpath lib/startup/% $(BASE_DIR)/src
CC_CXX_WARN_STRICT_CONVERSION =

View File

@ -14,3 +14,5 @@ SRC_CC += spec/arm/bcm2835_system_timer.cc
# include less specific configuration # include less specific configuration
include $(call select_from_repositories,lib/mk/spec/arm_v6/core-hw.inc) include $(call select_from_repositories,lib/mk/spec/arm_v6/core-hw.inc)
CC_CXX_WARN_STRICT_CONVERSION =

View File

@ -1,16 +1,8 @@
#
# \brief Build config for Genodes core process
# \author Stefan Kalkowski
# \author Martin Stein
# \date 2012-10-24
#
# add include paths
REP_INC_DIR += src/core/board/imx53_qsb REP_INC_DIR += src/core/board/imx53_qsb
SRC_CC += spec/arm/imx_epit.cc SRC_CC += spec/arm/imx_epit.cc
SRC_CC += spec/arm/imx_tzic.cc SRC_CC += spec/arm/imx_tzic.cc
# include less specific configuration
include $(call select_from_repositories,lib/mk/spec/cortex_a8/core-hw.inc) include $(call select_from_repositories,lib/mk/spec/cortex_a8/core-hw.inc)
CC_CXX_WARN_STRICT_CONVERSION =

View File

@ -11,4 +11,3 @@ SRC_S += spec/arm_v7/trustzone/exception_vector.s
# include less specific configuration # include less specific configuration
include $(call select_from_repositories,lib/mk/spec/arm_v7/core-hw-imx53_qsb.inc) include $(call select_from_repositories,lib/mk/spec/arm_v7/core-hw-imx53_qsb.inc)

View File

@ -11,3 +11,5 @@ SRC_CC += spec/arm/kernel/lock.cc
# include less specific configuration # include less specific configuration
include $(call select_from_repositories,lib/mk/spec/arm_v7/core-hw.inc) include $(call select_from_repositories,lib/mk/spec/arm_v7/core-hw.inc)
CC_CXX_WARN_STRICT_CONVERSION =

View File

@ -15,3 +15,5 @@ SRC_CC += kernel/cpu_mp.cc
# include less specific configuration # include less specific configuration
include $(call select_from_repositories,lib/mk/spec/arm_v7/core-hw.inc) include $(call select_from_repositories,lib/mk/spec/arm_v7/core-hw.inc)
CC_CXX_WARN_STRICT_CONVERSION =

View File

@ -31,8 +31,9 @@ void * Platform::Ram_allocator::alloc_aligned(size_t size, unsigned align)
{ {
using namespace Genode; using namespace Genode;
return Base::alloc_aligned(Hw::round_page(size), align = max(align, (unsigned)get_page_size_log2());
max(align, get_page_size_log2())).convert<void *>(
return Base::alloc_aligned(Hw::round_page(size), align).convert<void *>(
[&] (void *ptr) { return ptr; }, [&] (void *ptr) { return ptr; },
[&] (Ram_allocator::Alloc_error e) -> void * [&] (Ram_allocator::Alloc_error e) -> void *

View File

@ -307,7 +307,7 @@ unsigned Bootstrap::Platform::enable_mmu()
/* skip the SMP when ACPI parsing did not reveal the number of CPUs */ /* skip the SMP when ACPI parsing did not reveal the number of CPUs */
if (board.cpus <= 1) if (board.cpus <= 1)
return cpu_id; return (unsigned)cpu_id;
Lapic lapic(board.core_mmio.virt_addr(Hw::Cpu_memory_map::lapic_phys_base())); Lapic lapic(board.core_mmio.virt_addr(Hw::Cpu_memory_map::lapic_phys_base()));
@ -317,7 +317,7 @@ unsigned Bootstrap::Platform::enable_mmu()
if (!Cpu::IA32_apic_base::Bsp::get(lapic_msr)) if (!Cpu::IA32_apic_base::Bsp::get(lapic_msr))
/* AP - done */ /* AP - done */
return cpu_id; return (unsigned)cpu_id;
/* BSP - we're primary CPU - wake now all other CPUs */ /* BSP - we're primary CPU - wake now all other CPUs */
@ -329,7 +329,7 @@ unsigned Bootstrap::Platform::enable_mmu()
/* debates ongoing whether the second SIPI is still required */ /* debates ongoing whether the second SIPI is still required */
ipi_to_all(lapic, AP_BOOT_CODE_PAGE >> 12, Lapic::Icr_low::Delivery_mode::SIPI); ipi_to_all(lapic, AP_BOOT_CODE_PAGE >> 12, Lapic::Icr_low::Delivery_mode::SIPI);
return cpu_id; return (unsigned)cpu_id;
} }

View File

@ -66,7 +66,7 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
using namespace Hw; using namespace Hw;
/* map the dataspace's physical pages to corresponding virtual addresses */ /* map the dataspace's physical pages to corresponding virtual addresses */
unsigned num_pages = page_rounded_size >> get_page_size_log2(); unsigned num_pages = (unsigned)(page_rounded_size >> get_page_size_log2());
Page_flags const flags { (writeable && ds.writable()) ? RW : RO, Page_flags const flags { (writeable && ds.writable()) ? RW : RO,
NO_EXEC, KERN, GLOBAL, NO_EXEC, KERN, GLOBAL,
ds.io_mem() ? DEVICE : RAM, ds.io_mem() ? DEVICE : RAM,

View File

@ -28,7 +28,7 @@ using namespace Genode;
unsigned Irq_session_component::_find_irq_number(const char * const args) unsigned Irq_session_component::_find_irq_number(const char * const args)
{ {
return Arg_string::find_arg(args, "irq_number").long_value(-1); return (unsigned)Arg_string::find_arg(args, "irq_number").long_value(-1);
} }
@ -64,7 +64,8 @@ Irq_session_component::~Irq_session_component()
Irq_session_component::Irq_session_component(Range_allocator &irq_alloc, Irq_session_component::Irq_session_component(Range_allocator &irq_alloc,
const char * const args) const char * const args)
: :
_irq_args(args), _irq_number(Platform::irq(_irq_args.irq_number())), _irq_args(args),
_irq_number((unsigned)Platform::irq(_irq_args.irq_number())),
_irq_alloc(irq_alloc), _kobj(), _is_msi(false), _address(0), _value(0) _irq_alloc(irq_alloc), _kobj(), _is_msi(false), _address(0), _value(0)
{ {
long const mmconf = long const mmconf =

View File

@ -132,8 +132,8 @@ namespace Kernel {
inline int start_thread(Thread & thread, unsigned const cpu_id, inline int start_thread(Thread & thread, unsigned const cpu_id,
Pd & pd, Native_utcb & utcb) Pd & pd, Native_utcb & utcb)
{ {
return call(call_id_start_thread(), (Call_arg)&thread, cpu_id, return (int)call(call_id_start_thread(), (Call_arg)&thread, cpu_id,
(Call_arg)&pd, (Call_arg)&utcb); (Call_arg)&pd, (Call_arg)&utcb);
} }

View File

@ -121,8 +121,8 @@ class Kernel::Cpu : public Genode::Cpu, private Irq::Pool, private Timeout
Inter_processor_work_list _local_work_list {}; Inter_processor_work_list _local_work_list {};
void _arch_init(); void _arch_init();
unsigned _quota() const { return _timer.us_to_ticks(cpu_quota_us); } unsigned _quota() const { return (unsigned)_timer.us_to_ticks(cpu_quota_us); }
unsigned _fill() const { return _timer.us_to_ticks(cpu_fill_us); } unsigned _fill() const { return (unsigned)_timer.us_to_ticks(cpu_fill_us); }
public: public:

View File

@ -188,8 +188,8 @@ class Kernel::User_irq : public Kernel::Irq
Genode::Irq_session::Polarity polarity, Genode::Irq_session::Polarity polarity,
capid_t sig) capid_t sig)
{ {
return call(call_id_new_irq(), (Call_arg)&irq, nr, return (capid_t)call(call_id_new_irq(), (Call_arg)&irq, nr,
(trigger << 2) | polarity, sig); (trigger << 2) | polarity, sig);
} }
/** /**

View File

@ -195,7 +195,7 @@ void Object_identity_reference::invalidate()
Object_identity_reference::Object_identity_reference(Object_identity *oi, Object_identity_reference::Object_identity_reference(Object_identity *oi,
Pd &pd) Pd &pd)
: :
_capid(pd.capid_alloc().alloc()), _identity(oi), _pd(pd), _in_utcbs(0) _capid((capid_t)pd.capid_alloc().alloc()), _identity(oi), _pd(pd), _in_utcbs(0)
{ {
if (_identity) if (_identity)
_identity->insert(this); _identity->insert(this);

View File

@ -250,7 +250,7 @@ class Kernel::Core_object_identity : public Object_identity,
static capid_t syscall_create(Genode::Constructible<Core_object_identity<T>> & t, static capid_t syscall_create(Genode::Constructible<Core_object_identity<T>> & t,
capid_t const cap) { capid_t const cap) {
return call(call_id_new_obj(), (Call_arg)&t, (Call_arg)cap); } return (capid_t)call(call_id_new_obj(), (Call_arg)&t, (Call_arg)cap); }
static void syscall_destroy(Genode::Constructible<Core_object_identity<T>> & t) { static void syscall_destroy(Genode::Constructible<Core_object_identity<T>> & t) {
call(call_id_delete_obj(), (Call_arg)&t); } call(call_id_delete_obj(), (Call_arg)&t); }

View File

@ -72,7 +72,7 @@ class Kernel::Pd
_platform_pd(platform_pd), _platform_pd(platform_pd),
mmu_regs((addr_t)&table, addr_space_id_alloc) mmu_regs((addr_t)&table, addr_space_id_alloc)
{ {
capid_t invalid = _capid_alloc.alloc(); capid_t invalid = (capid_t)_capid_alloc.alloc();
assert(invalid == cap_id_invalid()); assert(invalid == cap_id_invalid());
} }
@ -86,8 +86,8 @@ class Kernel::Pd
Hw::Page_table &tt, Hw::Page_table &tt,
Genode::Platform_pd &pd) Genode::Platform_pd &pd)
{ {
return call(call_id_new_pd(), (Call_arg)&p, return (capid_t)call(call_id_new_pd(), (Call_arg)&p,
(Call_arg)&tt, (Call_arg)&pd); (Call_arg)&tt, (Call_arg)&pd);
} }
static void syscall_destroy(Genode::Kernel_object<Pd> & p) { static void syscall_destroy(Genode::Kernel_object<Pd> & p) {

View File

@ -203,8 +203,8 @@ class Kernel::Signal_context
Signal_receiver & receiver, Signal_receiver & receiver,
addr_t const imprint) addr_t const imprint)
{ {
return call(call_id_new_signal_context(), (Call_arg)&c, return (capid_t)call(call_id_new_signal_context(), (Call_arg)&c,
(Call_arg)&receiver, (Call_arg)imprint); (Call_arg)&receiver, (Call_arg)imprint);
} }
/** /**
@ -283,7 +283,7 @@ class Kernel::Signal_receiver
* \retval capability id of the new kernel object * \retval capability id of the new kernel object
*/ */
static capid_t syscall_create(Genode::Kernel_object<Signal_receiver> &r) { static capid_t syscall_create(Genode::Kernel_object<Signal_receiver> &r) {
return call(call_id_new_signal_receiver(), (Call_arg)&r); } return (capid_t)call(call_id_new_signal_receiver(), (Call_arg)&r); }
/** /**
* Syscall to destruct a signal receiver * Syscall to destruct a signal receiver

View File

@ -90,7 +90,7 @@ void Thread::_ipc_free_recv_caps()
void Thread::_ipc_init(Genode::Native_utcb &utcb, Thread &starter) void Thread::_ipc_init(Genode::Native_utcb &utcb, Thread &starter)
{ {
_utcb = &utcb; _utcb = &utcb;
_ipc_alloc_recv_caps(starter._utcb->cap_cnt()); _ipc_alloc_recv_caps((unsigned)(starter._utcb->cap_cnt()));
ipc_copy_msg(starter); ipc_copy_msg(starter);
} }
@ -311,14 +311,14 @@ size_t Thread::_core_to_kernel_quota(size_t const quota) const
void Thread::_call_thread_quota() void Thread::_call_thread_quota()
{ {
Thread * const thread = (Thread *)user_arg_1(); Thread * const thread = (Thread *)user_arg_1();
thread->Cpu_job::quota(_core_to_kernel_quota(user_arg_2())); thread->Cpu_job::quota((unsigned)(_core_to_kernel_quota(user_arg_2())));
} }
void Thread::_call_start_thread() void Thread::_call_start_thread()
{ {
/* lookup CPU */ /* lookup CPU */
Cpu & cpu = _cpu_pool.cpu(user_arg_2()); Cpu & cpu = _cpu_pool.cpu((unsigned)user_arg_2());
user_arg_0(0); user_arg_0(0);
Thread &thread = *(Thread*)user_arg_1(); Thread &thread = *(Thread*)user_arg_1();
@ -362,7 +362,7 @@ void Thread::_call_stop_thread()
void Thread::_call_restart_thread() void Thread::_call_restart_thread()
{ {
Thread *thread_ptr = pd().cap_tree().find<Thread>(user_arg_1()); Thread *thread_ptr = pd().cap_tree().find<Thread>((capid_t)user_arg_1());
if (!thread_ptr) if (!thread_ptr)
return; return;
@ -450,7 +450,7 @@ void Thread::_call_delete_thread()
void Thread::_call_await_request_msg() void Thread::_call_await_request_msg()
{ {
if (_ipc_node.can_await_request()) { if (_ipc_node.can_await_request()) {
_ipc_alloc_recv_caps(user_arg_1()); _ipc_alloc_recv_caps((unsigned)user_arg_1());
_ipc_node.await_request(); _ipc_node.await_request();
if (_ipc_node.awaits_request()) { if (_ipc_node.awaits_request()) {
_become_inactive(AWAITS_IPC); _become_inactive(AWAITS_IPC);
@ -467,7 +467,7 @@ void Thread::_call_await_request_msg()
void Thread::_call_timeout() void Thread::_call_timeout()
{ {
Timer & t = _cpu->timer(); Timer & t = _cpu->timer();
_timeout_sigid = user_arg_2(); _timeout_sigid = (Kernel::capid_t)user_arg_2();
t.set_timeout(this, t.us_to_ticks(user_arg_1())); t.set_timeout(this, t.us_to_ticks(user_arg_1()));
} }
@ -499,7 +499,7 @@ void Thread::timeout_triggered()
void Thread::_call_send_request_msg() void Thread::_call_send_request_msg()
{ {
Object_identity_reference * oir = pd().cap_tree().find(user_arg_1()); Object_identity_reference * oir = pd().cap_tree().find((capid_t)user_arg_1());
Thread * const dst = (oir) ? oir->object<Thread>() : nullptr; Thread * const dst = (oir) ? oir->object<Thread>() : nullptr;
if (!dst) { if (!dst) {
Genode::raw(*this, ": cannot send to unknown recipient ", Genode::raw(*this, ": cannot send to unknown recipient ",
@ -513,7 +513,7 @@ void Thread::_call_send_request_msg()
if (!_ipc_node.can_send_request()) { if (!_ipc_node.can_send_request()) {
Genode::raw("IPC send request: bad state"); Genode::raw("IPC send request: bad state");
} else { } else {
_ipc_alloc_recv_caps(user_arg_2()); _ipc_alloc_recv_caps((unsigned)user_arg_2());
_ipc_capid = oir ? oir->capid() : cap_id_invalid(); _ipc_capid = oir ? oir->capid() : cap_id_invalid();
_ipc_node.send_request(dst->_ipc_node, help); _ipc_node.send_request(dst->_ipc_node, help);
} }
@ -536,7 +536,7 @@ void Thread::_call_pager()
{ {
/* override event route */ /* override event route */
Thread &thread = *(Thread *)user_arg_1(); Thread &thread = *(Thread *)user_arg_1();
thread._pager = pd().cap_tree().find<Signal_context>(user_arg_2()); thread._pager = pd().cap_tree().find<Signal_context>((Kernel::capid_t)user_arg_2());
} }
@ -552,7 +552,7 @@ void Thread::_call_await_signal()
return; return;
} }
/* lookup receiver */ /* lookup receiver */
Signal_receiver * const r = pd().cap_tree().find<Signal_receiver>(user_arg_1()); Signal_receiver * const r = pd().cap_tree().find<Signal_receiver>((Kernel::capid_t)user_arg_1());
if (!r) { if (!r) {
Genode::raw(*this, ": cannot await, unknown signal receiver ", Genode::raw(*this, ": cannot await, unknown signal receiver ",
(unsigned)user_arg_1()); (unsigned)user_arg_1());
@ -573,7 +573,7 @@ void Thread::_call_await_signal()
void Thread::_call_pending_signal() void Thread::_call_pending_signal()
{ {
/* lookup receiver */ /* lookup receiver */
Signal_receiver * const r = pd().cap_tree().find<Signal_receiver>(user_arg_1()); Signal_receiver * const r = pd().cap_tree().find<Signal_receiver>((Kernel::capid_t)user_arg_1());
if (!r) { if (!r) {
Genode::raw(*this, ": cannot await, unknown signal receiver ", Genode::raw(*this, ": cannot await, unknown signal receiver ",
(unsigned)user_arg_1()); (unsigned)user_arg_1());
@ -601,7 +601,7 @@ void Thread::_call_pending_signal()
void Thread::_call_cancel_next_await_signal() void Thread::_call_cancel_next_await_signal()
{ {
/* kill the caller if the capability of the target thread is invalid */ /* kill the caller if the capability of the target thread is invalid */
Thread * const thread = pd().cap_tree().find<Thread>(user_arg_1()); Thread * const thread = pd().cap_tree().find<Thread>((Kernel::capid_t)user_arg_1());
if (!thread || (&pd() != &thread->pd())) { if (!thread || (&pd() != &thread->pd())) {
raw(*this, ": failed to lookup thread ", (unsigned)user_arg_1()); raw(*this, ": failed to lookup thread ", (unsigned)user_arg_1());
_die(); _die();
@ -620,7 +620,7 @@ void Thread::_call_cancel_next_await_signal()
void Thread::_call_submit_signal() void Thread::_call_submit_signal()
{ {
/* lookup signal context */ /* lookup signal context */
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_1()); Signal_context * const c = pd().cap_tree().find<Signal_context>((Kernel::capid_t)user_arg_1());
if(!c) { if(!c) {
/* cannot submit unknown signal context */ /* cannot submit unknown signal context */
user_arg_0(-1); user_arg_0(-1);
@ -628,12 +628,12 @@ void Thread::_call_submit_signal()
} }
/* trigger signal context */ /* trigger signal context */
if (!c->can_submit(user_arg_2())) { if (!c->can_submit((unsigned)user_arg_2())) {
Genode::raw("failed to submit signal context"); Genode::raw("failed to submit signal context");
user_arg_0(-1); user_arg_0(-1);
return; return;
} }
c->submit(user_arg_2()); c->submit((unsigned)user_arg_2());
user_arg_0(0); user_arg_0(0);
} }
@ -641,7 +641,7 @@ void Thread::_call_submit_signal()
void Thread::_call_ack_signal() void Thread::_call_ack_signal()
{ {
/* lookup signal context */ /* lookup signal context */
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_1()); Signal_context * const c = pd().cap_tree().find<Signal_context>((Kernel::capid_t)user_arg_1());
if (!c) { if (!c) {
Genode::raw(*this, ": cannot ack unknown signal context"); Genode::raw(*this, ": cannot ack unknown signal context");
return; return;
@ -655,7 +655,7 @@ void Thread::_call_ack_signal()
void Thread::_call_kill_signal_context() void Thread::_call_kill_signal_context()
{ {
/* lookup signal context */ /* lookup signal context */
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_1()); Signal_context * const c = pd().cap_tree().find<Signal_context>((Kernel::capid_t)user_arg_1());
if (!c) { if (!c) {
Genode::raw(*this, ": cannot kill unknown signal context"); Genode::raw(*this, ": cannot kill unknown signal context");
user_arg_0(-1); user_arg_0(-1);
@ -674,7 +674,7 @@ void Thread::_call_kill_signal_context()
void Thread::_call_new_irq() void Thread::_call_new_irq()
{ {
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_4()); Signal_context * const c = pd().cap_tree().find<Signal_context>((Kernel::capid_t)user_arg_4());
if (!c) { if (!c) {
Genode::raw(*this, ": invalid signal context for interrupt"); Genode::raw(*this, ": invalid signal context for interrupt");
user_arg_0(-1); user_arg_0(-1);
@ -699,7 +699,7 @@ void Thread::_call_ack_irq() {
void Thread::_call_new_obj() void Thread::_call_new_obj()
{ {
/* lookup thread */ /* lookup thread */
Object_identity_reference * ref = pd().cap_tree().find(user_arg_2()); Object_identity_reference * ref = pd().cap_tree().find((Kernel::capid_t)user_arg_2());
Thread * thread = ref ? ref->object<Thread>() : nullptr; Thread * thread = ref ? ref->object<Thread>() : nullptr;
if (!thread || if (!thread ||
(static_cast<Core_object<Thread>*>(thread)->capid() != ref->capid())) { (static_cast<Core_object<Thread>*>(thread)->capid() != ref->capid())) {
@ -726,14 +726,14 @@ void Thread::_call_delete_obj()
void Thread::_call_ack_cap() void Thread::_call_ack_cap()
{ {
Object_identity_reference * oir = pd().cap_tree().find(user_arg_1()); Object_identity_reference * oir = pd().cap_tree().find((Kernel::capid_t)user_arg_1());
if (oir) oir->remove_from_utcb(); if (oir) oir->remove_from_utcb();
} }
void Thread::_call_delete_cap() void Thread::_call_delete_cap()
{ {
Object_identity_reference * oir = pd().cap_tree().find(user_arg_1()); Object_identity_reference * oir = pd().cap_tree().find((Kernel::capid_t)user_arg_1());
if (!oir) return; if (!oir) return;
if (oir->in_utcb()) return; if (oir->in_utcb()) return;
@ -766,7 +766,7 @@ void Thread::_call()
try { try {
/* switch over unrestricted kernel calls */ /* switch over unrestricted kernel calls */
unsigned const call_id = user_arg_0(); unsigned const call_id = (unsigned)user_arg_0();
switch (call_id) { switch (call_id) {
case call_id_cache_coherent_region(): _call_cache_coherent_region(); return; case call_id_cache_coherent_region(): _call_cache_coherent_region(); return;
case call_id_cache_clean_inv_region(): _call_cache_clean_invalidate_data_region(); return; case call_id_cache_clean_inv_region(): _call_cache_clean_invalidate_data_region(); return;

View File

@ -356,8 +356,9 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout
size_t const quota, size_t const quota,
char const * const label) char const * const label)
{ {
return call(call_id_new_thread(), (Call_arg)&t, (Call_arg)priority, return (capid_t)call(call_id_new_thread(), (Call_arg)&t,
(Call_arg)quota, (Call_arg)label); (Call_arg)priority, (Call_arg)quota,
(Call_arg)label);
} }
/** /**
@ -371,8 +372,8 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout
static capid_t syscall_create(Genode::Kernel_object<Thread> & t, static capid_t syscall_create(Genode::Kernel_object<Thread> & t,
char const * const label) char const * const label)
{ {
return call(call_id_new_core_thread(), (Call_arg)&t, return (capid_t)call(call_id_new_core_thread(), (Call_arg)&t,
(Call_arg)label); (Call_arg)label);
} }
/** /**

View File

@ -101,8 +101,8 @@ class Kernel::Vm : private Kernel::Object, public Cpu_job
capid_t const signal_context_id, capid_t const signal_context_id,
Identity & id) Identity & id)
{ {
return call(call_id_new_vm(), (Call_arg)&vm, (Call_arg)cpu, return (capid_t)call(call_id_new_vm(), (Call_arg)&vm, (Call_arg)cpu,
(Call_arg)state, (Call_arg)&id, signal_context_id); (Call_arg)state, (Call_arg)&id, signal_context_id);
} }
/** /**

View File

@ -19,7 +19,7 @@
void Kernel::Thread::_call_new_vm() void Kernel::Thread::_call_new_vm()
{ {
Signal_context * context = Signal_context * context =
pd().cap_tree().find<Signal_context>(user_arg_5()); pd().cap_tree().find<Signal_context>((capid_t)user_arg_5());
if (!context) { if (!context) {
user_arg_0(cap_id_invalid()); user_arg_0(cap_id_invalid());
return; return;
@ -36,7 +36,7 @@ void Kernel::Thread::_call_delete_vm() { _call_delete<Vm>(); }
void Kernel::Thread::_call_run_vm() void Kernel::Thread::_call_run_vm()
{ {
Object_identity_reference * ref = pd().cap_tree().find(user_arg_1()); Object_identity_reference * ref = pd().cap_tree().find((capid_t)user_arg_1());
Vm * vm = ref ? ref->object<Vm>() : nullptr; Vm * vm = ref ? ref->object<Vm>() : nullptr;
if (!vm) { if (!vm) {
@ -52,7 +52,7 @@ void Kernel::Thread::_call_run_vm()
void Kernel::Thread::_call_pause_vm() void Kernel::Thread::_call_pause_vm()
{ {
Object_identity_reference * ref = pd().cap_tree().find(user_arg_1()); Object_identity_reference * ref = pd().cap_tree().find((capid_t)user_arg_1());
Vm * vm = ref ? ref->object<Vm>() : nullptr; Vm * vm = ref ? ref->object<Vm>() : nullptr;
if (!vm) { if (!vm) {

View File

@ -300,11 +300,9 @@ Platform::Platform()
** Support for core memory management ** ** Support for core memory management **
****************************************/ ****************************************/
bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr, bool Mapped_mem_allocator::_map_local(addr_t virt, addr_t phys, size_t size) {
unsigned size) { return ::map_local(phys, virt, size / get_page_size()); }
return ::map_local(phys_addr, virt_addr, size / get_page_size()); }
bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t, bool Mapped_mem_allocator::_unmap_local(addr_t virt, addr_t, size_t size) {
unsigned size) { return ::unmap_local(virt, size / get_page_size()); }
return ::unmap_local(virt_addr, size / get_page_size()); }

View File

@ -54,7 +54,7 @@ Platform_thread::~Platform_thread()
void Platform_thread::quota(size_t const quota) void Platform_thread::quota(size_t const quota)
{ {
_quota = quota; _quota = (unsigned)quota;
Kernel::thread_quota(*_kobj, quota); Kernel::thread_quota(*_kobj, quota);
} }
@ -97,7 +97,7 @@ Platform_thread::Platform_thread(size_t const quota,
_pager(nullptr), _pager(nullptr),
_utcb_pd_addr((Native_utcb *)utcb), _utcb_pd_addr((Native_utcb *)utcb),
_priority(_scale_priority(virt_prio)), _priority(_scale_priority(virt_prio)),
_quota(quota), _quota((unsigned)quota),
_main_thread(false), _main_thread(false),
_location(location), _location(location),
_kobj(_kobj.CALLED_FROM_CORE, _priority, _quota, _label.string()) _kobj(_kobj.CALLED_FROM_CORE, _priority, _quota, _label.string())

View File

@ -71,7 +71,7 @@ struct Genode::Arm_cpu : public Hw::Arm_cpu
~Mmu_context(); ~Mmu_context();
uint8_t id() { return cidr; } uint8_t id() { return (uint8_t)cidr; }
}; };
/** /**

View File

@ -24,7 +24,7 @@ unsigned Timer::interrupt_id() const { return Board::TIMER_IRQ; }
unsigned long Board::Timer::_freq() { return Genode::Cpu::Cntfrq::read(); } unsigned long Board::Timer::_freq() { return Genode::Cpu::Cntfrq::read(); }
Board::Timer::Timer(unsigned) : ticks_per_ms(_freq() / 1000) Board::Timer::Timer(unsigned) : ticks_per_ms((unsigned)(_freq() / 1000))
{ {
Cpu::Cntp_ctl::access_t ctl = 0; Cpu::Cntp_ctl::access_t ctl = 0;
Cpu::Cntp_ctl::Enable::set(ctl, 1); Cpu::Cntp_ctl::Enable::set(ctl, 1);
@ -35,7 +35,7 @@ Board::Timer::Timer(unsigned) : ticks_per_ms(_freq() / 1000)
void Timer::_start_one_shot(time_t const ticks) void Timer::_start_one_shot(time_t const ticks)
{ {
_device.last_time = Cpu::Cntpct::read(); _device.last_time = Cpu::Cntpct::read();
Cpu::Cntp_tval::write(ticks); Cpu::Cntp_tval::write((Cpu::Cntp_tval::access_t)ticks);
Cpu::Cntp_ctl::access_t ctl = Cpu::Cntp_ctl::read(); Cpu::Cntp_ctl::access_t ctl = Cpu::Cntp_ctl::read();
Cpu::Cntp_ctl::Istatus::set(ctl, 0); Cpu::Cntp_ctl::Istatus::set(ctl, 0);
Cpu::Cntp_ctl::write(ctl); Cpu::Cntp_ctl::write(ctl);

View File

@ -96,7 +96,7 @@ static Vmid_allocator &alloc()
allocator = unmanaged_singleton<Vmid_allocator>(); allocator = unmanaged_singleton<Vmid_allocator>();
/* reserve VM ID 0 for the hypervisor */ /* reserve VM ID 0 for the hypervisor */
unsigned id = allocator->alloc(); addr_t id = allocator->alloc();
assert (id == 0); assert (id == 0);
} }
return *allocator; return *allocator;

View File

@ -96,7 +96,7 @@ struct Genode::Cpu : Hw::Arm_64_cpu
~Mmu_context(); ~Mmu_context();
Genode::uint16_t id() { Genode::uint16_t id() {
return Ttbr::Asid::get(ttbr); } return Ttbr::Asid::get(ttbr) & 0xffff; }
}; };
void switch_to(Context&, Mmu_context &); void switch_to(Context&, Mmu_context &);

View File

@ -47,7 +47,7 @@ Mmu_context(addr_t page_table_base,
Mmu_context::~Mmu_context() Mmu_context::~Mmu_context()
{ {
unsigned asid = Satp::Asid::get(satp); unsigned asid = (uint16_t)Satp::Asid::get(satp); /* ASID is 16 bit */
Cpu::invalidate_tlb_by_pid(asid); Cpu::invalidate_tlb_by_pid(asid);
_addr_space_id_alloc.free(asid); _addr_space_id_alloc.free(asid);
} }

View File

@ -130,7 +130,9 @@ unsigned Genode::Cpu::executing_id()
void * const stack_ptr = nullptr; void * const stack_ptr = nullptr;
addr_t const stack_addr = reinterpret_cast<addr_t>(&stack_ptr); addr_t const stack_addr = reinterpret_cast<addr_t>(&stack_ptr);
addr_t const stack_base = reinterpret_cast<addr_t>(&kernel_stack); addr_t const stack_base = reinterpret_cast<addr_t>(&kernel_stack);
unsigned const cpu_id = (stack_addr - stack_base) / kernel_stack_size;
unsigned const cpu_id = (unsigned)((stack_addr - stack_base) / kernel_stack_size);
return cpu_id; return cpu_id;
} }

View File

@ -212,7 +212,7 @@ void Global_interrupt_controller::_update_irt_entry(unsigned irq)
Irte::Trg::set(irte, _irq_mode[irq].trigger_mode); Irte::Trg::set(irte, _irq_mode[irq].trigger_mode);
write<Ioregsel>(IOREDTBL + 2 * irq); write<Ioregsel>(IOREDTBL + 2 * irq);
write<Iowin>(irte); write<Iowin>((Iowin::access_t)(irte));
} }
@ -251,9 +251,9 @@ Global_interrupt_controller::Global_interrupt_controller()
if (i < _irte_count) { if (i < _irte_count) {
Irte::access_t irte = _create_irt_entry(i); Irte::access_t irte = _create_irt_entry(i);
write<Ioregsel>(IOREDTBL + 2 * i + 1); write<Ioregsel>(IOREDTBL + 2 * i + 1);
write<Iowin>(irte >> Iowin::ACCESS_WIDTH); write<Iowin>((Iowin::access_t)(irte >> Iowin::ACCESS_WIDTH));
write<Ioregsel>(IOREDTBL + 2 * i); write<Ioregsel>(IOREDTBL + 2 * i);
write<Iowin>(irte); write<Iowin>((Iowin::access_t)(irte));
} }
} }
}; };
@ -284,5 +284,5 @@ void Global_interrupt_controller::toggle_mask(unsigned const vector,
write<Ioregsel>(IOREDTBL + (2 * irq)); write<Ioregsel>(IOREDTBL + (2 * irq));
Irte::access_t irte = read<Iowin>(); Irte::access_t irte = read<Iowin>();
Irte::Mask::set(irte, set); Irte::Mask::set(irte, set);
write<Iowin>(irte); write<Iowin>((Iowin::access_t)(irte));
} }

View File

@ -51,6 +51,8 @@ class Board::Global_interrupt_controller : public Genode::Mmio
{ {
private: private:
using uint8_t = Genode::uint8_t;
enum { enum {
/* Register selectors */ /* Register selectors */
IOAPICVER = 0x01, IOAPICVER = 0x01,
@ -82,9 +84,9 @@ class Board::Global_interrupt_controller : public Genode::Mmio
struct Maximum_redirection_entry : Bitfield<16, 8> { }; struct Maximum_redirection_entry : Bitfield<16, 8> { };
}; };
unsigned _irte_count = 0; /* number of redirection table entries */ unsigned _irte_count = 0; /* number of redirection table entries */
Genode::uint8_t _lapic_id[NR_OF_CPUS]; /* unique name of the LAPIC of each CPU */ uint8_t _lapic_id[NR_OF_CPUS]; /* unique name of the LAPIC of each CPU */
Irq_mode _irq_mode[IRQ_COUNT]; Irq_mode _irq_mode[IRQ_COUNT];
/** /**
* Return whether 'irq' is an edge-triggered interrupt * Return whether 'irq' is an edge-triggered interrupt
@ -137,10 +139,9 @@ class Board::Global_interrupt_controller : public Genode::Mmio
** Accessors ** ** Accessors **
***************/ ***************/
void lapic_id(unsigned cpu_id, void lapic_id(unsigned cpu_id, uint8_t lapic_id);
Genode::uint8_t lapic_id);
Genode::uint8_t lapic_id(unsigned cpu_id) const; uint8_t lapic_id(unsigned cpu_id) const;
}; };
@ -222,7 +223,7 @@ class Board::Local_interrupt_controller : public Genode::Mmio
{ {
if (cpu_id < NR_OF_CPUS) { if (cpu_id < NR_OF_CPUS) {
Id::access_t const lapic_id = read<Id>(); Id::access_t const lapic_id = read<Id>();
_global_irq_ctrl.lapic_id(cpu_id, (lapic_id >> 24) & 0xff); _global_irq_ctrl.lapic_id(cpu_id, (unsigned char)((lapic_id >> 24) & 0xff));
} }
} }

View File

@ -30,10 +30,10 @@ uint32_t Board::Timer::pit_calc_timer_freq(void)
{ {
uint32_t t_start, t_end; uint32_t t_start, t_end;
/* Set channel gate high and disable speaker */ /* set channel gate high and disable speaker */
outb(PIT_CH2_GATE, (inb(0x61) & ~0x02) | 0x01); outb(PIT_CH2_GATE, (uint8_t)((inb(0x61) & ~0x02) | 0x01));
/* Set timer counter (mode 0, binary count) */ /* set timer counter (mode 0, binary count) */
outb(PIT_MODE, 0xb0); outb(PIT_MODE, 0xb0);
outb(PIT_CH2_DATA, PIT_SLEEP_TICS & 0xff); outb(PIT_CH2_DATA, PIT_SLEEP_TICS & 0xff);
outb(PIT_CH2_DATA, PIT_SLEEP_TICS >> 8); outb(PIT_CH2_DATA, PIT_SLEEP_TICS >> 8);
@ -57,7 +57,7 @@ Board::Timer::Timer(unsigned)
: :
Mmio(Platform::mmio_to_virt(Hw::Cpu_memory_map::lapic_phys_base())) Mmio(Platform::mmio_to_virt(Hw::Cpu_memory_map::lapic_phys_base()))
{ {
/* Enable LAPIC timer in one-shot mode */ /* enable LAPIC timer in one-shot mode */
write<Tmr_lvt::Vector>(Board::TIMER_VECTOR_KERNEL); write<Tmr_lvt::Vector>(Board::TIMER_VECTOR_KERNEL);
write<Tmr_lvt::Delivery>(0); write<Tmr_lvt::Delivery>(0);
write<Tmr_lvt::Mask>(0); write<Tmr_lvt::Mask>(0);
@ -71,7 +71,7 @@ Board::Timer::Timer(unsigned)
raw("Failed to calibrate timer frequency"); raw("Failed to calibrate timer frequency");
throw Calibration_failed(); throw Calibration_failed();
} }
write<Divide_configuration::Divide_value>(div); write<Divide_configuration::Divide_value>((uint8_t)div);
/* Calculate timer frequency */ /* Calculate timer frequency */
ticks_per_ms = pit_calc_timer_freq(); ticks_per_ms = pit_calc_timer_freq();
@ -88,7 +88,7 @@ Board::Timer::Timer(unsigned)
void Timer::_start_one_shot(time_t const ticks) { void Timer::_start_one_shot(time_t const ticks) {
_device.write<Board::Timer::Tmr_initial>(ticks); } _device.write<Board::Timer::Tmr_initial>((uint32_t)ticks); }
time_t Timer::ticks_to_us(time_t const ticks) const { time_t Timer::ticks_to_us(time_t const ticks) const {

View File

@ -27,8 +27,7 @@ namespace Genode { namespace Capability_space {
*/ */
static inline Kernel::capid_t capid(Native_capability const &cap) static inline Kernel::capid_t capid(Native_capability const &cap)
{ {
addr_t const index = (addr_t)cap.data(); return (Kernel::capid_t)((addr_t)cap.data() & 0xffffU);
return index;
} }
static inline Native_capability import(Kernel::capid_t capid) static inline Native_capability import(Kernel::capid_t capid)

View File

@ -66,7 +66,7 @@ class Hw::Page_table_allocator
{ {
static_assert((sizeof(TABLE) == TABLE_SIZE), "unexpected size"); static_assert((sizeof(TABLE) == TABLE_SIZE), "unexpected size");
table.~TABLE(); table.~TABLE();
_free(_offset(table) / sizeof(TABLE)); _free((unsigned)(_offset(table) / sizeof(TABLE)));
} }
}; };
@ -114,7 +114,7 @@ class Hw::Page_table_allocator<TABLE_SIZE>::Array<COUNT>::Allocator
unsigned _alloc() override unsigned _alloc() override
{ {
try { try {
return _free_tables.alloc(); return (unsigned)_free_tables.alloc();
} catch (typename Bit_allocator::Out_of_indices&) {} } catch (typename Bit_allocator::Out_of_indices&) {}
throw Out_of_tables(); throw Out_of_tables();
} }

View File

@ -86,7 +86,7 @@ struct Hw::Arm_64_cpu
struct Iss : Bitfield<0, 25> struct Iss : Bitfield<0, 25>
{ {
struct Abort : Register<32> struct Abort : Register<64>
{ {
struct Level : Bitfield<0, 2> {}; struct Level : Bitfield<0, 2> {};
struct Fsc : Bitfield<2, 4> struct Fsc : Bitfield<2, 4>
@ -231,7 +231,7 @@ struct Hw::Arm_64_cpu
struct Asid : Bitfield<48, 8> { }; struct Asid : Bitfield<48, 8> { };
); );
static inline unsigned current_privilege_level() { static Current_el::access_t current_privilege_level() {
return Current_el::El::get(Current_el::read()); } return Current_el::El::get(Current_el::read()); }

View File

@ -17,8 +17,8 @@
#include <hw/spec/arm/psci.h> #include <hw/spec/arm/psci.h>
#define PSCI_CALL_IMPL(instr) \ #define PSCI_CALL_IMPL(instr) \
static inline int call(unsigned int func, unsigned long a0, \ static inline int call(Genode::umword_t func, Genode::umword_t a0, \
unsigned int a1, unsigned int a2) { \ Genode::umword_t a1, Genode::umword_t a2) { \
unsigned long result = 0; \ unsigned long result = 0; \
asm volatile ("mov x0, %1 \n" \ asm volatile ("mov x0, %1 \n" \
"mov x1, %2 \n" \ "mov x1, %2 \n" \
@ -30,7 +30,7 @@
: "r"(func), "r"(a0), "r"(a1), "r"(a2) \ : "r"(func), "r"(a0), "r"(a1), "r"(a2) \
: "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", \ : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", \
"x8", "x9", "x10", "x11", "x12", "x13", "x14"); \ "x8", "x9", "x10", "x11", "x12", "x13", "x14"); \
return result; \ return (int)result; \
} }
namespace Hw { namespace Hw {

View File

@ -181,7 +181,7 @@ class Sv39::Level_x_translation_table
* Return how many entries of an alignment fit into region * Return how many entries of an alignment fit into region
*/ */
static constexpr size_t _count(size_t region, size_t alignment) { static constexpr size_t _count(size_t region, size_t alignment) {
return align_addr<size_t>(region, alignment) / (1UL << alignment); } return align_addr<size_t>(region, (unsigned)alignment) / (1UL << alignment); }
template <typename FUNC> template <typename FUNC>

View File

@ -87,7 +87,7 @@ void Hw::for_each_rsdt_entry(Hw::Acpi_generic &rsdt, FUNC fn)
typedef Genode::uint32_t entry_t; typedef Genode::uint32_t entry_t;
unsigned const table_size = rsdt.size; unsigned const table_size = rsdt.size;
unsigned const entry_count = (table_size - sizeof(rsdt)) / sizeof(entry_t); unsigned const entry_count = (unsigned)((table_size - sizeof(rsdt)) / sizeof(entry_t));
entry_t * entries = reinterpret_cast<entry_t *>(&rsdt + 1); entry_t * entries = reinterpret_cast<entry_t *>(&rsdt + 1);
for (unsigned i = 0; i < entry_count; i++) for (unsigned i = 0; i < entry_count; i++)
@ -104,7 +104,7 @@ void Hw::for_each_xsdt_entry(Hw::Acpi_generic &xsdt, FUNC fn)
typedef Genode::uint64_t entry_t; typedef Genode::uint64_t entry_t;
unsigned const table_size = xsdt.size; unsigned const table_size = xsdt.size;
unsigned const entry_count = (table_size - sizeof(xsdt)) / sizeof(entry_t); unsigned const entry_count = (unsigned)((table_size - sizeof(xsdt)) / sizeof(entry_t));
entry_t * entries = reinterpret_cast<entry_t *>(&xsdt + 1); entry_t * entries = reinterpret_cast<entry_t *>(&xsdt + 1);
for (unsigned i = 0; i < entry_count; i++) for (unsigned i = 0; i < entry_count; i++)

View File

@ -618,7 +618,7 @@ class Hw::Pml4_table
*/ */
static constexpr size_t _count(size_t region, size_t alignment) static constexpr size_t _count(size_t region, size_t alignment)
{ {
return Genode::align_addr<size_t>(region, alignment) return Genode::align_addr<size_t>(region, (int)alignment)
/ (1UL << alignment); / (1UL << alignment);
} }

View File

@ -48,7 +48,10 @@ void Native_capability::_dec()
return; return;
spinlock_lock(&spinlock); spinlock_lock(&spinlock);
if (!--ref_counter[(addr_t)_data]) { Kernel::delete_cap((addr_t)_data); }
if (!--ref_counter[(addr_t)_data])
Kernel::delete_cap((Kernel::capid_t)((addr_t)_data & 0xffff));
spinlock_unlock(&spinlock); spinlock_unlock(&spinlock);
} }

View File

@ -101,7 +101,9 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
copy_msg_to_utcb(snd_msg, *Thread::myself()->utcb()); copy_msg_to_utcb(snd_msg, *Thread::myself()->utcb());
switch (Kernel::send_request_msg(Capability_space::capid(dst), rcv_caps)) { switch (Kernel::send_request_msg(Capability_space::capid(dst),
(unsigned)rcv_caps)) {
case -1: throw Blocking_canceled(); case -1: throw Blocking_canceled();
case -2: throw Allocator::Out_of_memory(); case -2: throw Allocator::Out_of_memory();
default: default:
@ -111,7 +113,7 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
}, },
[&] () { upgrade_capability_slab(); }); [&] () { upgrade_capability_slab(); });
return Rpc_exception_code(utcb.exception_code()); return Rpc_exception_code((int)utcb.exception_code());
} }

View File

@ -59,7 +59,7 @@ unsigned share_id(void * const pointer)
addr_t const base = (addr_t)data()->shares; addr_t const base = (addr_t)data()->shares;
if (address < base || address >= base + sizeof(data()->shares)) { if (address < base || address >= base + sizeof(data()->shares)) {
return 0; } return 0; }
return (address - base) / sizeof(Cpu_share) + 1; return (unsigned)((address - base) / sizeof(Cpu_share) + 1);
} }

View File

@ -39,16 +39,16 @@ Timer::Time_source::Time_source(Env &env)
void Timer::Time_source::set_timeout(Microseconds duration, void Timer::Time_source::set_timeout(Microseconds duration,
Timeout_handler &handler) Timeout_handler &handler)
{ {
Kernel::timeout_t duration_us = duration.value; Kernel::timeout_t duration_us = (Kernel::timeout_t)duration.value;
if (duration_us < MIN_TIMEOUT_US) { if (duration_us < MIN_TIMEOUT_US) {
duration_us = MIN_TIMEOUT_US; } duration_us = MIN_TIMEOUT_US; }
if (duration_us > _max_timeout_us) { if (duration_us > _max_timeout_us) {
duration_us = _max_timeout_us; } duration_us = (Kernel::timeout_t)_max_timeout_us; }
_handler = &handler; _handler = &handler;
Signal_context_capability cap = _signal_handler; Signal_context_capability cap = _signal_handler;
Kernel::timeout(duration_us, (addr_t)cap.data()); Kernel::timeout(duration_us, (Kernel::capid_t)((addr_t)cap.data() & 0xffff));
} }

View File

@ -32,19 +32,19 @@
inline int lx_mkdir(char const *pathname, mode_t mode) inline int lx_mkdir(char const *pathname, mode_t mode)
{ {
return lx_syscall(SYS_mkdirat, AT_FDCWD, pathname, mode); return (int)lx_syscall(SYS_mkdirat, AT_FDCWD, pathname, mode);
} }
inline int lx_ftruncate(int fd, unsigned long length) inline int lx_ftruncate(int fd, unsigned long length)
{ {
return lx_syscall(SYS_ftruncate, fd, length); return (int)lx_syscall(SYS_ftruncate, fd, length);
} }
inline int lx_unlink(const char *fname) inline int lx_unlink(const char *fname)
{ {
return lx_syscall(SYS_unlinkat, AT_FDCWD, fname, 0); return (int)lx_syscall(SYS_unlinkat, AT_FDCWD, fname, 0);
} }
@ -54,7 +54,7 @@ inline int lx_unlink(const char *fname)
inline int lx_open(char const *pathname, int flags, mode_t mode = 0) inline int lx_open(char const *pathname, int flags, mode_t mode = 0)
{ {
return lx_syscall(SYS_openat, AT_FDCWD, pathname, flags, mode); return (int)lx_syscall(SYS_openat, AT_FDCWD, pathname, flags, mode);
} }
@ -62,16 +62,16 @@ inline int lx_stat_size(char const *path, Genode::uint64_t &out_size)
{ {
#ifdef __aarch64__ #ifdef __aarch64__
struct statx buf { }; struct statx buf { };
int result = lx_syscall(SYS_statx, AT_FDCWD, path, 0, STATX_SIZE, &buf); int result = (int)lx_syscall(SYS_statx, AT_FDCWD, path, 0, STATX_SIZE, &buf);
out_size = buf.stx_size; out_size = buf.stx_size;
#else #else
#ifdef _LP64 #ifdef _LP64
struct stat buf { }; struct stat buf { };
int result = lx_syscall(SYS_stat, path, &buf); int result = (int)lx_syscall(SYS_stat, path, &buf);
out_size = buf.st_size; out_size = buf.st_size;
#else #else
struct stat64 buf { }; struct stat64 buf { };
int result = lx_syscall(SYS_stat64, path, &buf); int result = (int)lx_syscall(SYS_stat64, path, &buf);
out_size = buf.st_size; out_size = buf.st_size;
#endif #endif
#endif #endif
@ -86,7 +86,7 @@ inline int lx_stat_size(char const *path, Genode::uint64_t &out_size)
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
inline int lx_iopl(int level) inline int lx_iopl(int level)
{ {
return lx_syscall(SYS_iopl, level); return (int)lx_syscall(SYS_iopl, level);
} }
#endif #endif
@ -103,13 +103,13 @@ inline int lx_ioctl_iomem(int fd, unsigned long phys, Genode::size_t offset)
Genode::size_t length; Genode::size_t length;
} range = {phys, offset}; } range = {phys, offset};
return lx_syscall(SYS_ioctl, fd, _IOW('g', 1, void *), &range); return (int)lx_syscall(SYS_ioctl, fd, _IOW('g', 1, void *), &range);
} }
inline int lx_ioctl_irq(int fd, int irq) inline int lx_ioctl_irq(int fd, int irq)
{ {
return lx_syscall(SYS_ioctl, fd, _IOW('g', 2, int*), &irq); return (int)lx_syscall(SYS_ioctl, fd, _IOW('g', 2, int*), &irq);
} }
@ -120,13 +120,13 @@ inline int lx_ioctl_irq(int fd, int irq)
inline int lx_execve(const char *filename, char *const argv[], inline int lx_execve(const char *filename, char *const argv[],
char *const envp[]) char *const envp[])
{ {
return lx_syscall(SYS_execve, filename, argv, envp); return (int)lx_syscall(SYS_execve, filename, argv, envp);
} }
inline int lx_kill(int pid, int signal) inline int lx_kill(int pid, int signal)
{ {
return lx_syscall(SYS_kill, pid, signal); return (int)lx_syscall(SYS_kill, pid, signal);
} }
@ -138,19 +138,19 @@ inline int lx_create_process(int (*entry)(), void *stack)
* this condition. * this condition.
*/ */
int const flags = CLONE_VFORK | LX_SIGCHLD; int const flags = CLONE_VFORK | LX_SIGCHLD;
return lx_clone((int (*)())entry, stack, flags); return (int)lx_clone((int (*)())entry, stack, flags);
} }
inline int lx_setuid(unsigned int uid) inline int lx_setuid(unsigned int uid)
{ {
return lx_syscall(SYS_setuid, uid); return (int)lx_syscall(SYS_setuid, uid);
} }
inline int lx_setgid(unsigned int gid) inline int lx_setgid(unsigned int gid)
{ {
return lx_syscall(SYS_setgid, gid); return (int)lx_syscall(SYS_setgid, gid);
} }
@ -164,7 +164,7 @@ inline int lx_setgid(unsigned int gid)
*/ */
inline int lx_pollpid() inline int lx_pollpid()
{ {
return lx_syscall(SYS_wait4, -1 /* any PID */, (int *)0, 1 /* WNOHANG */, 0); return (int)lx_syscall(SYS_wait4, -1 /* any PID */, (int *)0, 1 /* WNOHANG */, 0);
} }
@ -193,7 +193,7 @@ inline void lx_boost_rlimit()
{ {
rlimit rlimit { }; rlimit rlimit { };
if (int const res = lx_syscall(SYS_getrlimit, RLIMIT_NOFILE, &rlimit)) { if (int const res = (int)lx_syscall(SYS_getrlimit, RLIMIT_NOFILE, &rlimit)) {
Genode::warning("unable to obtain RLIMIT_NOFILE (", res, "), keeping limit unchanged"); Genode::warning("unable to obtain RLIMIT_NOFILE (", res, "), keeping limit unchanged");
return; return;
} }
@ -201,7 +201,7 @@ inline void lx_boost_rlimit()
/* increase soft limit to hard limit */ /* increase soft limit to hard limit */
rlimit.rlim_cur = rlimit.rlim_max; rlimit.rlim_cur = rlimit.rlim_max;
if (int const res = lx_syscall(SYS_setrlimit, RLIMIT_NOFILE, &rlimit)) if (int const res = (int)lx_syscall(SYS_setrlimit, RLIMIT_NOFILE, &rlimit))
Genode::warning("unable to boost RLIMIT_NOFILE (", res, "), keeping limit unchanged"); Genode::warning("unable to boost RLIMIT_NOFILE (", res, "), keeping limit unchanged");
} }
@ -215,7 +215,7 @@ inline void lx_boost_rlimit()
inline int lx_socket(int domain, int type, int protocol) inline int lx_socket(int domain, int type, int protocol)
{ {
long args[3] = { domain, type, protocol }; long args[3] = { domain, type, protocol };
return lx_socketcall(SYS_SOCKET, args); return (int)lx_socketcall(SYS_SOCKET, args);
} }
@ -223,7 +223,7 @@ inline int lx_bind(int sockfd, const struct sockaddr *addr,
socklen_t addrlen) socklen_t addrlen)
{ {
long args[3] = { sockfd, (long)addr, (long)addrlen }; long args[3] = { sockfd, (long)addr, (long)addrlen };
return lx_socketcall(SYS_BIND, args); return (int)lx_socketcall(SYS_BIND, args);
} }
@ -231,28 +231,28 @@ inline int lx_connect(int sockfd, const struct sockaddr *serv_addr,
socklen_t addrlen) socklen_t addrlen)
{ {
long args[3] = { sockfd, (long)serv_addr, (long)addrlen }; long args[3] = { sockfd, (long)serv_addr, (long)addrlen };
return lx_socketcall(SYS_CONNECT, args); return (int)lx_socketcall(SYS_CONNECT, args);
} }
#else #else
inline int lx_socket(int domain, int type, int protocol) inline int lx_socket(int domain, int type, int protocol)
{ {
return lx_syscall(SYS_socket, domain, type, protocol); return (int)lx_syscall(SYS_socket, domain, type, protocol);
} }
inline int lx_bind(int sockfd, const struct sockaddr *addr, inline int lx_bind(int sockfd, const struct sockaddr *addr,
socklen_t addrlen) socklen_t addrlen)
{ {
return lx_syscall(SYS_bind, sockfd, addr, addrlen); return (int)lx_syscall(SYS_bind, sockfd, addr, addrlen);
} }
inline int lx_connect(int sockfd, const struct sockaddr *serv_addr, inline int lx_connect(int sockfd, const struct sockaddr *serv_addr,
socklen_t addrlen) socklen_t addrlen)
{ {
return lx_syscall(SYS_connect, sockfd, serv_addr, addrlen); return (int)lx_syscall(SYS_connect, sockfd, serv_addr, addrlen);
} }
#endif /* SYS_socketcall */ #endif /* SYS_socketcall */
@ -264,13 +264,13 @@ inline int lx_connect(int sockfd, const struct sockaddr *serv_addr,
inline int lx_pipe(int pipefd[2]) inline int lx_pipe(int pipefd[2])
{ {
return lx_syscall(SYS_pipe2, pipefd, 0); return (int)lx_syscall(SYS_pipe2, pipefd, 0);
} }
inline int lx_read(int fd, void *buf, Genode::size_t count) inline int lx_read(int fd, void *buf, Genode::size_t count)
{ {
return lx_syscall(SYS_read, fd, buf, count); return (int)lx_syscall(SYS_read, fd, buf, count);
} }
#endif /* _CORE__INCLUDE__CORE_LINUX_SYSCALLS_H_ */ #endif /* _CORE__INCLUDE__CORE_LINUX_SYSCALLS_H_ */

View File

@ -190,7 +190,7 @@ Native_pd_component::Native_pd_component(Pd_session_component &pd, const char *)
Native_pd_component::~Native_pd_component() Native_pd_component::~Native_pd_component()
{ {
if (_pid) if (_pid)
lx_kill(_pid, 9); lx_kill((int)_pid, 9);
_pd_session._ep.dissolve(this); _pd_session._ep.dissolve(this);
} }

View File

@ -58,7 +58,7 @@ size_t Dataspace_component::_file_size()
if (lx_stat_size(_fname.buf, size) < 0) if (lx_stat_size(_fname.buf, size) < 0)
throw Service_denied(); throw Service_denied();
return align_addr(size, 12); return align_addr((size_t)size, 12);
} }

View File

@ -121,7 +121,7 @@ class Genode::Capability_space_tpl : Noncopyable
unsigned _index(Data const &data) const unsigned _index(Data const &data) const
{ {
addr_t const offset = (addr_t)&data - (addr_t)_caps_data; addr_t const offset = (addr_t)&data - (addr_t)_caps_data;
return offset / sizeof(_caps_data[0]); return (unsigned)(offset / sizeof(_caps_data[0]));
} }
Data *_lookup_unsynchronized(Rpc_obj_key key) const Data *_lookup_unsynchronized(Rpc_obj_key key) const
@ -186,7 +186,7 @@ class Genode::Capability_space_tpl : Noncopyable
* object. * object.
*/ */
if (!data.dst.foreign) if (!data.dst.foreign)
lx_close(data.rpc_obj_key().value()); lx_close((int)data.rpc_obj_key().value());
} }

View File

@ -178,7 +178,7 @@ namespace {
if (!cmsg) if (!cmsg)
return 0; return 0;
return (cmsg->cmsg_len - CMSG_ALIGN(sizeof(cmsghdr)))/sizeof(int); return (unsigned)((cmsg->cmsg_len - CMSG_ALIGN(sizeof(cmsghdr)))/sizeof(int));
} }
}; };
@ -352,7 +352,7 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
extract_sds_from_message(0, rcv_msg, rcv_header, rcv_msgbuf); extract_sds_from_message(0, rcv_msg, rcv_header, rcv_msgbuf);
return Rpc_exception_code(rcv_header.protocol_word); return Rpc_exception_code((int)rcv_header.protocol_word);
} }

View File

@ -203,7 +203,7 @@ Native_capability Native_thread::Epoll::alloc_rpc_cap()
void Native_thread::Epoll::free_rpc_cap(Native_capability cap) void Native_thread::Epoll::free_rpc_cap(Native_capability cap)
{ {
int const local_socket = Capability_space::ipc_cap_data(cap).rpc_obj_key.value(); int const local_socket = (int)Capability_space::ipc_cap_data(cap).rpc_obj_key.value();
_exec_control([&] () { _remove(Lx_sd{local_socket}); }); _exec_control([&] () { _remove(Lx_sd{local_socket}); });
} }

View File

@ -61,7 +61,7 @@ void Genode::binary_ready_hook_for_platform()
}; };
uint64_t flags = SECCOMP_FILTER_FLAG_TSYNC; uint64_t flags = SECCOMP_FILTER_FLAG_TSYNC;
auto ret = lx_seccomp(SECCOMP_SET_MODE_FILTER, flags, &program); auto ret = lx_seccomp(SECCOMP_SET_MODE_FILTER, (int)flags, &program);
if (ret != 0) { if (ret != 0) {
error("SECCOMP_SET_MODE_FILTER failed ", ret); error("SECCOMP_SET_MODE_FILTER failed ", ret);
throw Exception(); throw Exception();

View File

@ -33,10 +33,13 @@
*/ */
/* Linux includes */ /* Linux includes */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
/* Genode includes */ /* Genode includes */
#include <base/thread.h> #include <base/thread.h>

View File

@ -46,6 +46,12 @@
*/ */
#define size_t __SIZE_TYPE__ #define size_t __SIZE_TYPE__
/*
* Disable -Wconversion warnings caused by host headers
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
/* Linux includes */ /* Linux includes */
#include <sys/cdefs.h> /* include first to avoid double definition of '__always_inline' */ #include <sys/cdefs.h> /* include first to avoid double definition of '__always_inline' */
#include <linux/futex.h> #include <linux/futex.h>
@ -60,6 +66,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/stat.h> #include <sys/stat.h>
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
#undef size_t #undef size_t
@ -92,32 +99,32 @@ extern "C" int lx_clone(int (*fn)(), void *child_stack, int flags);
*****************************************/ *****************************************/
inline pid_t lx_getpid() { return lx_syscall(SYS_getpid); } inline pid_t lx_getpid() { return (pid_t)lx_syscall(SYS_getpid); }
inline pid_t lx_gettid() { return lx_syscall(SYS_gettid); } inline pid_t lx_gettid() { return (pid_t)lx_syscall(SYS_gettid); }
inline uid_t lx_getuid() { return lx_syscall(SYS_getuid); } inline uid_t lx_getuid() { return (uid_t)lx_syscall(SYS_getuid); }
inline int lx_write(int fd, const void *buf, Genode::size_t count) inline int lx_write(int fd, const void *buf, Genode::size_t count)
{ {
return lx_syscall(SYS_write, fd, buf, count); return (int)lx_syscall(SYS_write, fd, buf, count);
} }
inline int lx_close(int fd) inline int lx_close(int fd)
{ {
return lx_syscall(SYS_close, fd); return (int)lx_syscall(SYS_close, fd);
} }
inline int lx_dup(int fd) inline int lx_dup(int fd)
{ {
return lx_syscall(SYS_dup, fd); return (int)lx_syscall(SYS_dup, fd);
} }
inline int lx_dup2(int fd, int to) inline int lx_dup2(int fd, int to)
{ {
return lx_syscall(SYS_dup3, fd, to, 0); return (int)lx_syscall(SYS_dup3, fd, to, 0);
} }
@ -192,19 +199,19 @@ inline int lx_recvmsg(Lx_sd sockfd, struct msghdr *msg, int flags)
inline int lx_socketpair(int domain, int type, int protocol, int sd[2]) inline int lx_socketpair(int domain, int type, int protocol, int sd[2])
{ {
return lx_syscall(SYS_socketpair, domain, type, protocol, (unsigned long)sd); return (int)lx_syscall(SYS_socketpair, domain, type, protocol, (unsigned long)sd);
} }
inline int lx_sendmsg(Lx_sd sockfd, const struct msghdr *msg, int flags) inline int lx_sendmsg(Lx_sd sockfd, const struct msghdr *msg, int flags)
{ {
return lx_syscall(SYS_sendmsg, sockfd.value, msg, flags); return (int)lx_syscall(SYS_sendmsg, sockfd.value, msg, flags);
} }
inline int lx_recvmsg(Lx_sd sockfd, struct msghdr *msg, int flags) inline int lx_recvmsg(Lx_sd sockfd, struct msghdr *msg, int flags)
{ {
return lx_syscall(SYS_recvmsg, sockfd.value, msg, flags); return (int)lx_syscall(SYS_recvmsg, sockfd.value, msg, flags);
} }
/* TODO add missing socket system calls */ /* TODO add missing socket system calls */
@ -236,7 +243,7 @@ struct Lx_socketpair
inline Lx_epoll_sd lx_epoll_create() inline Lx_epoll_sd lx_epoll_create()
{ {
int const ret = lx_syscall(SYS_epoll_create1, 0); int const ret = (int)lx_syscall(SYS_epoll_create1, 0);
if (ret < 0) { if (ret < 0) {
/* /*
* No recovery possible, just leave a diagnostic message and block * No recovery possible, just leave a diagnostic message and block
@ -251,14 +258,14 @@ inline Lx_epoll_sd lx_epoll_create()
inline int lx_epoll_ctl(Lx_epoll_sd epoll, int op, Lx_sd fd, epoll_event *event) inline int lx_epoll_ctl(Lx_epoll_sd epoll, int op, Lx_sd fd, epoll_event *event)
{ {
return lx_syscall(SYS_epoll_ctl, epoll.value, op, fd.value, event); return (int)lx_syscall(SYS_epoll_ctl, epoll.value, op, fd.value, event);
} }
inline int lx_epoll_wait(Lx_epoll_sd epoll, struct epoll_event *events, inline int lx_epoll_wait(Lx_epoll_sd epoll, struct epoll_event *events,
int maxevents, int timeout) int maxevents, int timeout)
{ {
return lx_syscall(SYS_epoll_pwait, epoll.value, events, maxevents, timeout, 0); return (int)lx_syscall(SYS_epoll_pwait, epoll.value, events, maxevents, timeout, 0);
} }
@ -298,7 +305,7 @@ inline void *lx_mmap(void *start, Genode::size_t length, int prot, int flags,
inline int lx_munmap(void *addr, Genode::size_t length) inline int lx_munmap(void *addr, Genode::size_t length)
{ {
return lx_syscall(SYS_munmap, addr, length); return (int)lx_syscall(SYS_munmap, addr, length);
} }
@ -376,7 +383,7 @@ inline int lx_sigaction(int signum, void (*handler)(int), bool altstack)
lx_sigemptyset(&act.mask); lx_sigemptyset(&act.mask);
return lx_syscall(SYS_rt_sigaction, signum, &act, 0UL, LX_NSIG/8); return (int)lx_syscall(SYS_rt_sigaction, signum, &act, 0UL, LX_NSIG/8);
} }
@ -388,7 +395,7 @@ inline int lx_sigaction(int signum, void (*handler)(int), bool altstack)
*/ */
inline int lx_tgkill(int pid, int tid, int signal) inline int lx_tgkill(int pid, int tid, int signal)
{ {
return lx_syscall(SYS_tgkill, pid, tid, signal); return (int)lx_syscall(SYS_tgkill, pid, tid, signal);
} }
@ -399,7 +406,7 @@ inline int lx_sigaltstack(void *signal_stack, Genode::size_t stack_size)
{ {
stack_t stack { signal_stack, 0, stack_size }; stack_t stack { signal_stack, 0, stack_size };
return lx_syscall(SYS_sigaltstack, &stack, nullptr); return (int)lx_syscall(SYS_sigaltstack, &stack, nullptr);
} }
@ -408,7 +415,7 @@ inline int lx_create_thread(void (*entry)(), void *stack)
int flags = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND int flags = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND
| CLONE_THREAD | CLONE_SYSVSEM; | CLONE_THREAD | CLONE_SYSVSEM;
return lx_clone((int (*)())entry, stack, flags); return (int)lx_clone((int (*)())entry, stack, flags);
} }
@ -420,7 +427,7 @@ struct timespec;
inline int lx_nanosleep(const struct timespec *req, struct timespec *rem) inline int lx_nanosleep(const struct timespec *req, struct timespec *rem)
{ {
return lx_syscall(SYS_nanosleep, req, rem); return (int)lx_syscall(SYS_nanosleep, req, rem);
} }
@ -431,7 +438,7 @@ enum {
inline int lx_futex(const int *uaddr, int op, int val) inline int lx_futex(const int *uaddr, int op, int val)
{ {
return lx_syscall(SYS_futex, uaddr, op, val, 0, 0, 0); return (int)lx_syscall(SYS_futex, uaddr, op, val, 0, 0, 0);
} }
@ -523,13 +530,13 @@ inline bool lx_sigsetmask(int signum, bool state)
inline int lx_prctl(int option, unsigned long arg2, unsigned long arg3, inline int lx_prctl(int option, unsigned long arg2, unsigned long arg3,
unsigned long arg4, unsigned long arg5) unsigned long arg4, unsigned long arg5)
{ {
return lx_syscall(SYS_prctl, option, arg2, arg3, arg4, arg5); return (int)lx_syscall(SYS_prctl, option, arg2, arg3, arg4, arg5);
} }
inline int lx_seccomp(int option, int flag, void* program) inline int lx_seccomp(int option, int flag, void* program)
{ {
return lx_syscall(SYS_seccomp, option, flag, program); return (int)lx_syscall(SYS_seccomp, option, flag, program);
} }
#endif /* _LIB__SYSCALL__LINUX_SYSCALLS_H_ */ #endif /* _LIB__SYSCALL__LINUX_SYSCALLS_H_ */

View File

@ -19,8 +19,11 @@
#include "testlib.h" #include "testlib.h"
/* Linux includes */ /* Linux includes */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
using namespace Genode; using namespace Genode;

View File

@ -23,7 +23,7 @@ using namespace Genode;
inline int lx_gettimeofday(struct timeval *tv, struct timeval *tz) { inline int lx_gettimeofday(struct timeval *tv, struct timeval *tz) {
return lx_syscall(SYS_gettimeofday, tv, tz); } return (int)lx_syscall(SYS_gettimeofday, tv, tz); }
Microseconds Timer::Time_source::max_timeout() const Microseconds Timer::Time_source::max_timeout() const
@ -44,8 +44,8 @@ Duration Timer::Time_source::curr_time()
void Timer::Time_source::_usleep(uint64_t us) void Timer::Time_source::_usleep(uint64_t us)
{ {
struct timespec ts; struct timespec ts;
ts.tv_sec = us / (1000 * 1000); ts.tv_sec = (long)us / (1000 * 1000);
ts.tv_nsec = (us % (1000 * 1000)) * 1000; ts.tv_nsec = ((long)us % (1000 * 1000)) * 1000;
if (lx_nanosleep(&ts, &ts) != 0) if (lx_nanosleep(&ts, &ts) != 0)
throw Blocking_canceled(); throw Blocking_canceled();

View File

@ -94,13 +94,13 @@ namespace Genode {
inline void inc() inline void inc()
{ {
if (_range) if (_range)
_range->inc(_local_name - _range->base()); _range->inc((unsigned)(_local_name - _range->base()));
} }
inline void dec() inline void dec()
{ {
if (_range) if (_range)
_range->dec(_local_name - _range->base()); _range->dec((unsigned)(_local_name - _range->base()));
} }
}; };

View File

@ -184,7 +184,7 @@ namespace Nova {
if (!boot || !is_cpu_enabled(boot_cpu)) if (!boot || !is_cpu_enabled(boot_cpu))
return false; return false;
map_cpus[cpu_i++] = boot_cpu; map_cpus[cpu_i++] = (uint8_t)boot_cpu;
if (cpu_i >= num_cpus) if (cpu_i >= num_cpus)
return true; return true;
@ -204,7 +204,7 @@ namespace Nova {
c->thread == thread)) c->thread == thread))
continue; continue;
map_cpus [cpu_i++] = i; map_cpus[cpu_i++] = (uint8_t)i;
if (cpu_i >= num_cpus) if (cpu_i >= num_cpus)
return true; return true;
} }
@ -376,12 +376,12 @@ namespace Nova {
return sel_hotspot << 12; return sel_hotspot << 12;
} }
mword_t addr() const { return base() << BASE_SHIFT; } mword_t addr() const { return base() << BASE_SHIFT; }
mword_t base() const { return _query<BASE_MASK, BASE_SHIFT>(); } mword_t base() const { return _query<BASE_MASK, BASE_SHIFT>(); }
mword_t order() const { return _query<ORDER_MASK, ORDER_SHIFT>(); } mword_t order() const { return _query<ORDER_MASK, ORDER_SHIFT>(); }
bool is_null() const { return (_value & TYPE_MASK) == NULL_CRD_TYPE; } bool is_null() const { return (_value & TYPE_MASK) == NULL_CRD_TYPE; }
uint8_t type() const { return _query<TYPE_MASK, TYPE_SHIFT>(); } uint8_t type() const { return (uint8_t)_query<TYPE_MASK, TYPE_SHIFT>(); }
uint8_t rights() const { return _query<RIGHTS_MASK, RIGHTS_SHIFT>(); } uint8_t rights() const { return (uint8_t)_query<RIGHTS_MASK, RIGHTS_SHIFT>(); }
} __attribute__((packed)); } __attribute__((packed));
@ -606,71 +606,73 @@ namespace Nova {
}; };
#ifdef __x86_64__ #ifdef __x86_64__
inline mword_t read_r8() { return r8; } uint64_t read_r8() const { return r8; }
inline void write_r8(mword_t value) { r8 = value; } uint64_t read_r9() const { return r9; }
inline mword_t read_r9() { return r9; } uint64_t read_r10() const { return r10; }
inline void write_r9(mword_t value) { r9 = value; } uint64_t read_r11() const { return r11; }
inline mword_t read_r10() { return r10; } uint64_t read_r12() const { return r12; }
inline void write_r10(mword_t value) { r10 = value; } uint64_t read_r13() const { return r13; }
inline mword_t read_r11() { return r11; } uint64_t read_r14() const { return r14; }
inline void write_r11(mword_t value) { r11 = value; } uint64_t read_r15() const { return r15; }
inline mword_t read_r12() { return r12; } mword_t read_efer() const { return efer; }
inline void write_r12(mword_t value) { r12 = value; } uint64_t read_star() const { return star; }
inline mword_t read_r13() { return r13; } uint64_t read_lstar() const { return lstar; }
inline void write_r13(mword_t value) { r13 = value; } uint64_t read_cstar() const { return cstar; }
inline mword_t read_r14() { return r14; } uint64_t read_fmask() const { return fmask; }
inline void write_r14(mword_t value) { r14 = value; } uint64_t read_kernel_gs_base() const { return kernel_gs_base; }
inline mword_t read_r15() { return r15; } uint32_t read_tpr() const { return tpr; }
inline void write_r15(mword_t value) { r15 = value; } uint32_t read_tpr_threshold() const { return tpr_threshold; }
inline mword_t read_efer() { return efer; }
inline void write_efer(mword_t value) { efer = value; } void write_r8 (uint64_t value) { r8 = value; }
inline mword_t read_star() { return star; } void write_r9 (uint64_t value) { r9 = value; }
inline void write_star(mword_t value) { star = value; } void write_r10 (uint64_t value) { r10 = value; }
inline mword_t read_lstar() { return lstar; } void write_r11 (uint64_t value) { r11 = value; }
inline void write_lstar(mword_t value) { lstar = value; } void write_r12 (uint64_t value) { r12 = value; }
inline mword_t read_cstar() { return cstar; } void write_r13 (uint64_t value) { r13 = value; }
inline void write_cstar(mword_t value) { cstar = value; } void write_r14 (uint64_t value) { r14 = value; }
inline mword_t read_fmask() { return fmask; } void write_r15 (uint64_t value) { r15 = value; }
inline void write_fmask(mword_t value) { fmask = value; } void write_efer (mword_t value) { efer = value; }
inline mword_t read_kernel_gs_base() { return kernel_gs_base; } void write_star (uint64_t value) { star = value; }
inline void write_kernel_gs_base(mword_t value) { kernel_gs_base = value; } void write_lstar (uint64_t value) { lstar = value; }
inline uint32_t read_tpr() { return tpr; } void write_cstar (uint64_t value) { cstar = value; }
inline void write_tpr(uint32_t value) { tpr = value; } void write_fmask (uint64_t value) { fmask = value; }
inline uint32_t read_tpr_threshold() { return tpr_threshold; } void write_kernel_gs_base (uint64_t value) { kernel_gs_base = value; }
inline void write_tpr_threshold(uint32_t value) { tpr_threshold = value; } void write_tpr (uint32_t value) { tpr = value; }
void write_tpr_threshold (uint32_t value) { tpr_threshold = value; }
#else #else
inline mword_t read_r8() { return 0UL; } uint64_t read_r8() const { return 0; }
inline void write_r8(mword_t) { } uint64_t read_r9() const { return 0; }
inline mword_t read_r9() { return 0UL; } uint64_t read_r10() const { return 0; }
inline void write_r9(mword_t) { } uint64_t read_r11() const { return 0; }
inline mword_t read_r10() { return 0UL; } uint64_t read_r12() const { return 0; }
inline void write_r10(mword_t) { } uint64_t read_r13() const { return 0; }
inline mword_t read_r11() { return 0UL; } uint64_t read_r14() const { return 0; }
inline void write_r11(mword_t) { } uint64_t read_r15() const { return 0; }
inline mword_t read_r12() { return 0UL; } mword_t read_efer() const { return 0; }
inline void write_r12(mword_t) { } uint64_t read_star() const { return 0; }
inline mword_t read_r13() { return 0UL; } uint64_t read_lstar() const { return 0; }
inline void write_r13(mword_t) { } uint64_t read_cstar() const { return 0; }
inline mword_t read_r14() { return 0UL; } uint64_t read_fmask() const { return 0; }
inline void write_r14(mword_t) { } uint64_t read_kernel_gs_base() const { return 0; }
inline mword_t read_r15() { return 0UL; } uint32_t read_tpr() const { return 0; }
inline void write_r15(mword_t) { } uint32_t read_tpr_threshold() const { return 0; }
inline mword_t read_efer() { return 0UL; }
inline void write_efer(mword_t) { } void write_r8 (uint64_t) { }
inline mword_t read_star() { return 0UL; } void write_r9 (uint64_t) { }
inline void write_star(mword_t) { } void write_r10 (uint64_t) { }
inline mword_t read_lstar() { return 0UL; } void write_r11 (uint64_t) { }
inline void write_lstar(mword_t) { } void write_r12 (uint64_t) { }
inline mword_t read_cstar() { return 0UL; } void write_r13 (uint64_t) { }
inline void write_cstar(mword_t) { } void write_r14 (uint64_t) { }
inline mword_t read_fmask() { return 0UL; } void write_r15 (uint64_t) { }
inline void write_fmask(mword_t) { } void write_efer (mword_t) { }
inline mword_t read_kernel_gs_base() { return 0UL; } void write_star (uint64_t) { }
inline void write_kernel_gs_base(mword_t) { } void write_lstar (uint64_t) { }
inline uint32_t read_tpr() { return 0; } void write_cstar (uint64_t) { }
inline void write_tpr(uint32_t) { } void write_fmask (uint64_t) { }
inline uint32_t read_tpr_threshold() { return 0; } void write_kernel_gs_base (uint64_t) { }
inline void write_tpr_threshold(uint32_t) { } void write_tpr (uint32_t) { }
void write_tpr_threshold (uint32_t) { }
#endif #endif
/** /**
@ -689,7 +691,7 @@ namespace Nova {
/** /**
* Return current number of message items on UTCB * Return current number of message items on UTCB
*/ */
unsigned msg_items() { return items >> 16; } unsigned msg_items() { return (unsigned)(items >> 16); }
/** /**
* Append message-transfer item to message buffer * Append message-transfer item to message buffer
@ -749,6 +751,12 @@ namespace Nova {
} }
mword_t mtd_value() const { return static_cast<Mtd>(mtd).value(); } mword_t mtd_value() const { return static_cast<Mtd>(mtd).value(); }
/**
* Return fault address and type of page-fault message
*/
mword_t pf_addr() const { return (mword_t)qual[1]; }
uint8_t pf_type() const { return (uint8_t)qual[0]; }
}; };
static_assert(sizeof(Utcb) == 4096, "Unexpected size of UTCB"); static_assert(sizeof(Utcb) == 4096, "Unexpected size of UTCB");

View File

@ -62,7 +62,7 @@ namespace Nova {
: "+a" (status) : "+a" (status)
: :
: "ecx", "edx", "memory"); : "ecx", "edx", "memory");
return status; return (uint8_t)status;
} }
@ -83,7 +83,7 @@ namespace Nova {
: :
: "ecx", "edx", "memory"); : "ecx", "edx", "memory");
if (p2) *p2 = p1; if (p2) *p2 = p1;
return status; return (uint8_t)status;
} }
@ -102,7 +102,7 @@ namespace Nova {
: "+a" (status) : "+a" (status)
: "D" (p1), "S" (p2) : "D" (p1), "S" (p2)
: "ecx", "edx"); : "ecx", "edx");
return status; return (uint8_t)status;
} }
@ -125,7 +125,7 @@ namespace Nova {
: "+a" (status), "+d" (p3) : "+a" (status), "+d" (p3)
: "D" (p1), "S" (p2) : "D" (p1), "S" (p2)
: "ecx"); : "ecx");
return status; return (uint8_t)status;
} }
@ -154,7 +154,7 @@ namespace Nova {
: "+a" (status), "+c" (p3), "+d" (p4) : "+a" (status), "+c" (p3), "+d" (p4)
: "D" (p1), "S" (p2) : "D" (p1), "S" (p2)
: "memory"); : "memory");
return status; return (uint8_t)status;
} }
ALWAYS_INLINE ALWAYS_INLINE
@ -179,7 +179,7 @@ namespace Nova {
: "+a" (status), "+D" (p1), "+S" (p2), "+c" (p3) : "+a" (status), "+D" (p1), "+S" (p2), "+c" (p3)
: :
: "edx", "memory"); : "edx", "memory");
return status; return (uint8_t)status;
} }
ALWAYS_INLINE ALWAYS_INLINE
@ -350,7 +350,7 @@ namespace Nova {
ALWAYS_INLINE ALWAYS_INLINE
inline uint8_t sm_ctrl(unsigned sm, Sem_op op, unsigned long long timeout = 0) inline uint8_t sm_ctrl(unsigned sm, Sem_op op, unsigned long long timeout = 0)
{ {
return syscall_2(NOVA_SM_CTRL, op, sm, timeout >> 32, timeout); return syscall_2(NOVA_SM_CTRL, op, sm, (mword_t)(timeout >> 32), (mword_t)timeout);
} }

View File

@ -57,7 +57,7 @@ namespace Nova {
: "+D" (status) : "+D" (status)
: :
: "rcx", "r11", "memory"); : "rcx", "r11", "memory");
return status; return (uint8_t)status;
} }
@ -72,7 +72,7 @@ namespace Nova {
: :
: "rcx", "r11", "memory"); : "rcx", "r11", "memory");
if (p2) *p2 = p1; if (p2) *p2 = p1;
return status; return (uint8_t)status;
} }
@ -86,7 +86,7 @@ namespace Nova {
: "+D" (status) : "+D" (status)
: "S" (p1), "d" (p2) : "S" (p1), "d" (p2)
: "rcx", "r11", "memory"); : "rcx", "r11", "memory");
return status; return (uint8_t)status;
} }
@ -100,7 +100,7 @@ namespace Nova {
: "+D" (status) : "+D" (status)
: "S" (p1), "d" (p2), "a" (p3) : "S" (p1), "d" (p2), "a" (p3)
: "rcx", "r11", "memory"); : "rcx", "r11", "memory");
return status; return (uint8_t)status;
} }
@ -115,7 +115,7 @@ namespace Nova {
: "+D" (status) : "+D" (status)
: "S" (p1), "d" (p2), "a" (p3), "r" (r8) : "S" (p1), "d" (p2), "a" (p3), "r" (r8)
: "rcx", "r11", "memory"); : "rcx", "r11", "memory");
return status; return (uint8_t)status;
} }
@ -129,7 +129,7 @@ namespace Nova {
: "+D" (status), "+S"(p1), "+d"(p2) : "+D" (status), "+S"(p1), "+d"(p2)
: "a" (p3) : "a" (p3)
: "rcx", "r11", "memory"); : "rcx", "r11", "memory");
return status; return (uint8_t)status;
} }
@ -159,7 +159,7 @@ namespace Nova {
inline uint8_t create_pd(mword_t pd0, mword_t pd, Crd crd, inline uint8_t create_pd(mword_t pd0, mword_t pd, Crd crd,
unsigned lower_limit, unsigned long upper_limit) unsigned lower_limit, unsigned long upper_limit)
{ {
return syscall_3(NOVA_CREATE_PD, 0, pd0, pd, crd.value(), return syscall_3(NOVA_CREATE_PD, 0, (unsigned)pd0, pd, crd.value(),
upper_limit << 32 | lower_limit); upper_limit << 32 | lower_limit);
} }
@ -202,7 +202,7 @@ namespace Nova {
ALWAYS_INLINE ALWAYS_INLINE
inline uint8_t create_sc(mword_t sc, mword_t pd, mword_t ec, Qpd qpd) inline uint8_t create_sc(mword_t sc, mword_t pd, mword_t ec, Qpd qpd)
{ {
return syscall_3(NOVA_CREATE_SC, 0, sc, pd, ec, qpd.value()); return syscall_3(NOVA_CREATE_SC, 0, (unsigned)sc, pd, ec, qpd.value());
} }
@ -229,14 +229,14 @@ namespace Nova {
ALWAYS_INLINE ALWAYS_INLINE
inline uint8_t create_sm(mword_t sm, mword_t pd, mword_t cnt) inline uint8_t create_sm(mword_t sm, mword_t pd, mword_t cnt)
{ {
return syscall_3(NOVA_CREATE_SM, 0, sm, pd, cnt, 0); return syscall_3(NOVA_CREATE_SM, 0, (unsigned)sm, pd, cnt, 0);
} }
ALWAYS_INLINE ALWAYS_INLINE
inline uint8_t create_si(mword_t si, mword_t pd, mword_t value, mword_t sm) inline uint8_t create_si(mword_t si, mword_t pd, mword_t value, mword_t sm)
{ {
return syscall_3(NOVA_CREATE_SM, 0, si, pd, value, sm); return syscall_3(NOVA_CREATE_SM, 0, (unsigned)si, pd, value, sm);
} }

View File

@ -40,7 +40,7 @@ static inline void * alloc_region(Dataspace_component &ds, const size_t size)
size_t align_log2 = log2(ds.size()); size_t align_log2 = log2(ds.size());
for (; align_log2 >= get_page_size_log2(); align_log2--) { for (; align_log2 >= get_page_size_log2(); align_log2--) {
platform().region_alloc().alloc_aligned(size, align_log2).with_result( platform().region_alloc().alloc_aligned(size, (unsigned)align_log2).with_result(
[&] (void *ptr) { virt_addr = ptr; }, [&] (void *ptr) { virt_addr = ptr; },
[&] (Allocator::Alloc_error) { }); [&] (Allocator::Alloc_error) { });

View File

@ -115,7 +115,7 @@ lsb_bit(unsigned long const &value, unsigned char const shift = 0)
unsigned long const scan = value >> shift; unsigned long const scan = value >> shift;
if (scan == 0) return 0; if (scan == 0) return 0;
unsigned char pos = __builtin_ctzl(scan); unsigned char pos = (unsigned char)__builtin_ctzl(scan);
unsigned char res = shift ? pos + shift : pos; unsigned char res = shift ? pos + shift : pos;
return res; return res;
} }
@ -207,7 +207,7 @@ inline void unmap_local(Nova::Utcb &, Genode::addr_t start,
while (num_pages) { while (num_pages) {
unsigned char const base_bit = lsb_bit(base); unsigned char const base_bit = lsb_bit(base);
unsigned char const order_bit = min(log2(num_pages), 31U); unsigned char const order_bit = (unsigned char)min(log2(num_pages), 31U);
unsigned char const order = min(order_bit, base_bit); unsigned char const order = min(order_bit, base_bit);
Mem_crd const crd(base, order, rwx); Mem_crd const crd(base, order, rwx);

View File

@ -100,10 +100,10 @@ namespace Genode {
/* convenience function to access pause/recall state */ /* convenience function to access pause/recall state */
inline bool blocked() { return _status & BLOCKED;} inline bool blocked() { return _status & BLOCKED;}
inline void block() { _status |= BLOCKED; } inline void block() { _status |= BLOCKED; }
inline void unblock() { _status &= ~BLOCKED; } inline void unblock() { _status &= (uint8_t)(~BLOCKED); }
inline bool blocked_pause_sm() { return _status & BLOCKED_PAUSE_SM;} inline bool blocked_pause_sm() { return _status & BLOCKED_PAUSE_SM;}
inline void block_pause_sm() { _status |= BLOCKED_PAUSE_SM; } inline void block_pause_sm() { _status |= (uint8_t)BLOCKED_PAUSE_SM; }
inline void unblock_pause_sm() { _status &= ~BLOCKED_PAUSE_SM; } inline void unblock_pause_sm() { _status &= (uint8_t)(~BLOCKED_PAUSE_SM); }
inline void mark_dead() { _status |= DEAD; } inline void mark_dead() { _status |= DEAD; }
inline bool is_dead() { return _status & DEAD; } inline bool is_dead() { return _status & DEAD; }
@ -118,10 +118,10 @@ namespace Genode {
inline bool to_submit() { return _status & SUBMIT_SIGNAL; } inline bool to_submit() { return _status & SUBMIT_SIGNAL; }
inline void submit_signal() { _status |= SUBMIT_SIGNAL; } inline void submit_signal() { _status |= SUBMIT_SIGNAL; }
inline void reset_submit() { _status &= ~SUBMIT_SIGNAL; } inline void reset_submit() { _status &= (uint8_t)(~SUBMIT_SIGNAL); }
bool migrate() const { return _status & MIGRATE; } bool migrate() const { return _status & MIGRATE; }
void reset_migrate() { _status &= ~MIGRATE; } void reset_migrate() { _status &= (uint8_t)(~MIGRATE); }
void request_migrate() { _status |= MIGRATE; } void request_migrate() { _status |= MIGRATE; }
} _state { }; } _state { };
@ -287,7 +287,7 @@ namespace Genode {
if (on) if (on)
_state._status |= _state.SINGLESTEP; _state._status |= _state.SINGLESTEP;
else else
_state._status &= ~_state.SINGLESTEP; _state._status &= (uint8_t)(~_state.SINGLESTEP);
_state_lock.release(); _state_lock.release();

View File

@ -26,9 +26,12 @@ namespace Genode {
constexpr size_t get_super_page_size_log2() { return 22; } constexpr size_t get_super_page_size_log2() { return 22; }
constexpr size_t get_super_page_size() { return 1 << get_super_page_size_log2(); } constexpr size_t get_super_page_size() { return 1 << get_super_page_size_log2(); }
inline addr_t trunc_page(addr_t addr) { return addr & _align_mask(get_page_size_log2()); }
inline addr_t round_page(addr_t addr) { return trunc_page(addr + get_page_size() - 1); }
template <typename T>
inline T trunc_page(T addr) { return addr & _align_mask(get_page_size_log2()); }
template <typename T>
inline T round_page(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 addr_t map_src_addr(addr_t /* core_local */, addr_t phys) { return phys; }

View File

@ -32,9 +32,9 @@ Ipc_pager::Ipc_pager(Nova::Utcb &utcb, addr_t pd_dst, addr_t pd_core)
_pd_dst(pd_dst), _pd_dst(pd_dst),
_pd_core(pd_core), _pd_core(pd_core),
_fault_ip(utcb.ip), _fault_ip(utcb.ip),
_fault_addr(utcb.qual[1]), _fault_addr(utcb.pf_addr()),
_sp(utcb.sp), _sp(utcb.sp),
_fault_type(utcb.qual[0]), _fault_type(utcb.pf_type()),
_syscall_res(Nova::NOVA_OK), _syscall_res(Nova::NOVA_OK),
_normal_ipc((((addr_t)&utcb.qual[2] - (addr_t)utcb.msg()) / sizeof(addr_t)) _normal_ipc((((addr_t)&utcb.qual[2] - (addr_t)utcb.msg()) / sizeof(addr_t))
== utcb.msg_words()) == utcb.msg_words())

View File

@ -225,7 +225,7 @@ Irq_session_component::Irq_session_component(Range_allocator &irq_alloc,
throw Service_denied(); throw Service_denied();
} }
_irq_number = irq_number; _irq_number = (unsigned)irq_number;
_irq_object.start(_irq_number, device_phys); _irq_object.start(_irq_number, device_phys);
} }

View File

@ -101,8 +101,10 @@ struct Page_fault_info
Page_fault_info(char const *pd, char const *thread, unsigned cpu, Page_fault_info(char const *pd, char const *thread, unsigned cpu,
addr_t ip, addr_t addr, addr_t sp, unsigned type) addr_t ip, addr_t addr, addr_t sp, unsigned type)
: pd(pd), thread(thread), cpu(cpu), ip(ip), addr(addr), :
sp(sp), pf_type(type) { } pd(pd), thread(thread), cpu(cpu), ip(ip), addr(addr),
sp(sp), pf_type((uint8_t)type)
{ }
void print(Genode::Output &out) const void print(Genode::Output &out) const
{ {
@ -191,7 +193,7 @@ void Pager_object::_page_fault_handler(Pager_object &obj)
ipc_pager.fault_ip(), ipc_pager.fault_ip(),
ipc_pager.fault_addr(), ipc_pager.fault_addr(),
ipc_pager.sp(), ipc_pager.sp(),
ipc_pager.fault_type()); (uint8_t)ipc_pager.fault_type());
/* region manager fault - to be handled */ /* region manager fault - to be handled */
log("page fault, ", fault_info, " reason=", error); log("page fault, ", fault_info, " reason=", error);

View File

@ -113,10 +113,10 @@ static void page_fault_handler()
{ {
Utcb *utcb = (Utcb *)CORE_PAGER_UTCB_ADDR; Utcb *utcb = (Utcb *)CORE_PAGER_UTCB_ADDR;
addr_t pf_addr = utcb->qual[1]; addr_t const pf_addr = utcb->pf_addr();
addr_t pf_ip = utcb->ip; addr_t const pf_ip = utcb->ip;
addr_t pf_sp = utcb->sp; addr_t const pf_sp = utcb->sp;
addr_t pf_type = utcb->qual[0]; uint8_t const pf_type = utcb->pf_type();
error("\nPAGE-FAULT IN CORE addr=", Hex(pf_addr), " ip=", Hex(pf_ip), error("\nPAGE-FAULT IN CORE addr=", Hex(pf_addr), " ip=", Hex(pf_ip),
" (", (pf_type & Ipc_pager::ERR_W) ? "write" : "read", ")"); " (", (pf_type & Ipc_pager::ERR_W) ? "write" : "read", ")");
@ -370,7 +370,7 @@ Platform::Platform()
" vs ", sizeof(map_cpu_ids) / sizeof(map_cpu_ids[0])); " vs ", sizeof(map_cpu_ids) / sizeof(map_cpu_ids[0]));
nova_die(); nova_die();
} }
if (!hip.remap_cpu_ids(map_cpu_ids, boot_cpu())) { if (!hip.remap_cpu_ids(map_cpu_ids, (unsigned)boot_cpu())) {
error("re-ording cpu_id failed"); error("re-ording cpu_id failed");
nova_die(); nova_die();
} }
@ -492,7 +492,7 @@ Platform::Platform()
Hip::Mem_desc *boot_fb = nullptr; Hip::Mem_desc *boot_fb = nullptr;
bool efi_boot = false; bool efi_boot = false;
addr_t kernel_memory = 0; size_t kernel_memory = 0;
/* /*
* All "available" ram must be added to our physical allocator before all * All "available" ram must be added to our physical allocator before all
@ -506,13 +506,13 @@ Platform::Platform()
if (mem_desc->type == Hip::Mem_desc::FRAMEBUFFER) if (mem_desc->type == Hip::Mem_desc::FRAMEBUFFER)
boot_fb = mem_desc; boot_fb = mem_desc;
if (mem_desc->type == Hip::Mem_desc::MICROHYPERVISOR) if (mem_desc->type == Hip::Mem_desc::MICROHYPERVISOR)
kernel_memory += mem_desc->size; kernel_memory += (size_t)mem_desc->size;
if (mem_desc->type != Hip::Mem_desc::AVAILABLE_MEMORY) continue; if (mem_desc->type != Hip::Mem_desc::AVAILABLE_MEMORY) continue;
if (verbose_boot_info) { if (verbose_boot_info) {
addr_t const base = mem_desc->addr; uint64_t const base = mem_desc->addr;
size_t const size = mem_desc->size; uint64_t const size = mem_desc->size;
log("detected physical memory: ", Hex(base, Hex::PREFIX, Hex::PAD), log("detected physical memory: ", Hex(base, Hex::PREFIX, Hex::PAD),
" - size: ", Hex(size, Hex::PREFIX, Hex::PAD)); " - size: ", Hex(size, Hex::PREFIX, Hex::PAD));
} }
@ -522,11 +522,11 @@ Platform::Platform()
/* skip regions above 4G on 32 bit, no op on 64 bit */ /* skip regions above 4G on 32 bit, no op on 64 bit */
if (mem_desc->addr > ~0UL) continue; if (mem_desc->addr > ~0UL) continue;
addr_t base = round_page(mem_desc->addr); uint64_t base = round_page(mem_desc->addr);
size_t size; uint64_t size;
/* truncate size if base+size larger then natural 32/64 bit boundary */ /* truncate size if base+size larger then natural 32/64 bit boundary */
if (mem_desc->addr >= ~0UL - mem_desc->size + 1) if (mem_desc->addr >= ~0ULL - mem_desc->size + 1)
size = trunc_page(~0UL - mem_desc->addr + 1); size = trunc_page(~0ULL - mem_desc->addr + 1);
else else
size = trunc_page(mem_desc->addr + mem_desc->size) - base; size = trunc_page(mem_desc->addr + mem_desc->size) - base;
@ -534,12 +534,12 @@ Platform::Platform()
log("use physical memory: ", Hex(base, Hex::PREFIX, Hex::PAD), log("use physical memory: ", Hex(base, Hex::PREFIX, Hex::PAD),
" - size: ", Hex(size, Hex::PREFIX, Hex::PAD)); " - size: ", Hex(size, Hex::PREFIX, Hex::PAD));
_io_mem_alloc.remove_range(base, size); _io_mem_alloc.remove_range((addr_t)base, (size_t)size);
ram_alloc().add_range(base, size); ram_alloc().add_range((addr_t)base, (size_t)size);
} }
uint64_t hyp_log = 0; addr_t hyp_log = 0;
uint64_t hyp_log_size = 0; size_t hyp_log_size = 0;
/* /*
* Exclude all non-available memory from physical allocator AFTER all * Exclude all non-available memory from physical allocator AFTER all
@ -551,16 +551,16 @@ Platform::Platform()
if (mem_desc->type == Hip::Mem_desc::AVAILABLE_MEMORY) continue; if (mem_desc->type == Hip::Mem_desc::AVAILABLE_MEMORY) continue;
if (mem_desc->type == Hip::Mem_desc::HYPERVISOR_LOG) { if (mem_desc->type == Hip::Mem_desc::HYPERVISOR_LOG) {
hyp_log = mem_desc->addr; hyp_log = (addr_t)mem_desc->addr;
hyp_log_size = mem_desc->size; hyp_log_size = (size_t)mem_desc->size;
} }
addr_t base = trunc_page(mem_desc->addr); uint64_t base = trunc_page(mem_desc->addr);
size_t size = mem_desc->size; uint64_t size = mem_desc->size;
/* remove framebuffer from available memory */ /* remove framebuffer from available memory */
if (mem_desc->type == Hip::Mem_desc::FRAMEBUFFER) { if (mem_desc->type == Hip::Mem_desc::FRAMEBUFFER) {
uint32_t const height = Resolution::Height::get(mem_desc->size); uint32_t const height = (uint32_t)Resolution::Height::get(mem_desc->size);
uint32_t const pitch = mem_desc->aux; uint32_t const pitch = mem_desc->aux;
/* calculate size of framebuffer */ /* calculate size of framebuffer */
size = pitch * height; size = pitch * height;
@ -585,9 +585,9 @@ Platform::Platform()
/* make acpi regions as io_mem available to platform driver */ /* make acpi regions as io_mem available to platform driver */
if (mem_desc->type == Hip::Mem_desc::ACPI_RECLAIM_MEMORY || if (mem_desc->type == Hip::Mem_desc::ACPI_RECLAIM_MEMORY ||
mem_desc->type == Hip::Mem_desc::ACPI_NVS_MEMORY) mem_desc->type == Hip::Mem_desc::ACPI_NVS_MEMORY)
_io_mem_alloc.add_range(base, size); _io_mem_alloc.add_range((addr_t)base, (size_t)size);
ram_alloc().remove_range(base, size); ram_alloc().remove_range((addr_t)base, (size_t)size);
} }
/* needed as I/O memory by the VESA driver */ /* needed as I/O memory by the VESA driver */
@ -634,9 +634,9 @@ Platform::Platform()
continue; continue;
error("region overlap ", error("region overlap ",
Hex_range<addr_t>(mem_desc->addr, mem_desc->size), " " Hex_range<addr_t>((addr_t)mem_desc->addr, (size_t)mem_desc->size), " "
"(", (int)mem_desc->type, ") with ", "(", (int)mem_desc->type, ") with ",
Hex_range<addr_t>(mem_d->addr, mem_d->size), " " Hex_range<addr_t>((addr_t)mem_d->addr, (size_t)mem_d->size), " "
"(", (int)mem_d->type, ")"); "(", (int)mem_d->type, ")");
nova_die(); nova_die();
} }
@ -659,7 +659,7 @@ Platform::Platform()
if (!mem_desc->addr || !mem_desc->size) continue; if (!mem_desc->addr || !mem_desc->size) continue;
/* assume core's ELF image has one-page header */ /* assume core's ELF image has one-page header */
_core_phys_start = trunc_page(mem_desc->addr + get_page_size()); _core_phys_start = (addr_t)trunc_page(mem_desc->addr + get_page_size());
} }
_init_rom_modules(); _init_rom_modules();
@ -842,7 +842,7 @@ Platform::Platform()
cap_map().insert(range); cap_map().insert(range);
index = range.base() + range.elements(); index = (unsigned)(range.base() + range.elements());
} }
_max_caps = index - first_index; _max_caps = index - first_index;
@ -894,15 +894,15 @@ Platform::Platform()
}; };
new (core_mem_alloc()) Trace_source(Trace::sources(), location, new (core_mem_alloc()) Trace_source(Trace::sources(), location,
sc_idle_base + kernel_cpu_id, (unsigned)(sc_idle_base + kernel_cpu_id),
"idle"); "idle");
new (core_mem_alloc()) Trace_source(Trace::sources(), location, new (core_mem_alloc()) Trace_source(Trace::sources(), location,
sc_idle_base + kernel_cpu_id, (unsigned)(sc_idle_base + kernel_cpu_id),
"cross"); "cross");
new (core_mem_alloc()) Trace_source(Trace::sources(), location, new (core_mem_alloc()) Trace_source(Trace::sources(), location,
sc_idle_base + kernel_cpu_id, (unsigned)(sc_idle_base + kernel_cpu_id),
"killed"); "killed");
}); });
@ -988,8 +988,7 @@ unsigned Platform::pager_index(Affinity::Location location) const
** Support for core memory management ** ** Support for core memory management **
****************************************/ ****************************************/
bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr, bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr, size_t size)
unsigned size)
{ {
/* platform_specific()->core_pd_sel() deadlocks if called from platform constructor */ /* platform_specific()->core_pd_sel() deadlocks if called from platform constructor */
Hip const &hip = *(Hip const *)__initial_sp; Hip const &hip = *(Hip const *)__initial_sp;
@ -1003,7 +1002,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, unsigned size) bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t, size_t size)
{ {
unmap_local(*(Utcb *)Thread::myself()->utcb(), unmap_local(*(Utcb *)Thread::myself()->utcb(),
virt_addr, size / get_page_size()); virt_addr, size / get_page_size());

View File

@ -359,7 +359,7 @@ Platform_thread::Platform_thread(size_t, const char *name, unsigned prio,
_sel_exc_base(Native_thread::INVALID_INDEX), _sel_exc_base(Native_thread::INVALID_INDEX),
_location(platform_specific().sanitize(affinity)), _location(platform_specific().sanitize(affinity)),
_features(0), _features(0),
_priority(scale_priority(prio, name)), _priority((uint8_t)(scale_priority(prio, name))),
_name(name) _name(name)
{ } { }

View File

@ -41,7 +41,7 @@ static inline void * alloc_region(Dataspace_component &ds, const size_t size)
size_t align_log2 = log2(ds.size()); size_t align_log2 = log2(ds.size());
for (; align_log2 >= get_page_size_log2(); align_log2--) { for (; align_log2 >= get_page_size_log2(); align_log2--) {
platform().region_alloc().alloc_aligned(size, align_log2).with_result( platform().region_alloc().alloc_aligned(size, (unsigned)align_log2).with_result(
[&] (void *ptr) { virt_addr = ptr; }, [&] (void *ptr) { virt_addr = ptr; },
[&] (Range_allocator::Alloc_error) { /* try next iteration */ } [&] (Range_allocator::Alloc_error) { /* try next iteration */ }
); );

View File

@ -96,7 +96,7 @@ void Thread::start()
Affinity::Location location = _affinity; Affinity::Location location = _affinity;
if (!location.valid()) if (!location.valid())
location = Affinity::Location(boot_cpu(), 0); location = Affinity::Location((int)boot_cpu(), 0);
/* create local EC */ /* create local EC */
enum { LOCAL_THREAD = false }; enum { LOCAL_THREAD = false };

View File

@ -333,7 +333,7 @@ Capability<Vm_session::Native_vcpu> Vm_session_component::create_vcpu(Thread_cap
_constrained_md_ram_alloc, _constrained_md_ram_alloc,
_cap_quota_guard(), _cap_quota_guard(),
vcpu_id, vcpu_id,
kernel_cpu_id, (unsigned)kernel_cpu_id,
vcpu_location, vcpu_location,
_priority, _priority,
_session_label, _session_label,

View File

@ -104,7 +104,7 @@ static inline bool copy_msgbuf_to_utcb(Nova::Utcb &utcb,
for (unsigned i = 0; i < num_data_words; i++) for (unsigned i = 0; i < num_data_words; i++)
*dst++ = *src++; *dst++ = *src++;
utcb.set_msg_word(num_msg_words); utcb.set_msg_word((unsigned)num_msg_words);
/* append portal capability selectors */ /* append portal capability selectors */
for (unsigned i = 0; i < snd_msg.used_caps(); i++) { for (unsigned i = 0; i < snd_msg.used_caps(); i++) {

View File

@ -35,8 +35,8 @@ static inline void spinlock_lock(volatile T *lock_variable)
using Genode::cmpxchg; using Genode::cmpxchg;
Genode::Thread * myself = Genode::Thread::myself(); Genode::Thread * myself = Genode::Thread::myself();
T const tid = myself ? myself->native_thread().ec_sel T const tid = (T)(myself ? myself->native_thread().ec_sel
: (Genode::addr_t)Nova::EC_SEL_THREAD; : (Genode::addr_t)Nova::EC_SEL_THREAD);
unsigned help_counter = 0; unsigned help_counter = 0;

View File

@ -95,7 +95,7 @@ namespace Genode {
} while (imprint == 0); } while (imprint == 0);
return Signal(imprint, count); return Signal(imprint, (int)count);
} }
}; };
} }

Some files were not shown because too many files have changed in this diff Show More