mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
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:
@@ -97,7 +97,7 @@ namespace Kernel {
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return call(call_id_kill_signal_context(), context);
|
||||
return (int)call(call_id_kill_signal_context(), context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,3 +38,5 @@ vpath hw/% $(BASE_HW_DIR)/src/lib
|
||||
vpath lib/base/% $(BASE_HW_DIR)/src
|
||||
vpath lib/base/% $(BASE_DIR)/src
|
||||
vpath lib/startup/% $(BASE_DIR)/src
|
||||
|
||||
CC_CXX_WARN_STRICT_CONVERSION =
|
||||
|
||||
@@ -14,3 +14,5 @@ SRC_CC += spec/arm/bcm2835_system_timer.cc
|
||||
|
||||
# include less specific configuration
|
||||
include $(call select_from_repositories,lib/mk/spec/arm_v6/core-hw.inc)
|
||||
|
||||
CC_CXX_WARN_STRICT_CONVERSION =
|
||||
|
||||
@@ -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
|
||||
|
||||
SRC_CC += spec/arm/imx_epit.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)
|
||||
|
||||
CC_CXX_WARN_STRICT_CONVERSION =
|
||||
|
||||
@@ -11,4 +11,3 @@ SRC_S += spec/arm_v7/trustzone/exception_vector.s
|
||||
|
||||
# include less specific configuration
|
||||
include $(call select_from_repositories,lib/mk/spec/arm_v7/core-hw-imx53_qsb.inc)
|
||||
|
||||
|
||||
@@ -11,3 +11,5 @@ SRC_CC += spec/arm/kernel/lock.cc
|
||||
|
||||
# include less specific configuration
|
||||
include $(call select_from_repositories,lib/mk/spec/arm_v7/core-hw.inc)
|
||||
|
||||
CC_CXX_WARN_STRICT_CONVERSION =
|
||||
|
||||
@@ -15,3 +15,5 @@ SRC_CC += kernel/cpu_mp.cc
|
||||
|
||||
# include less specific configuration
|
||||
include $(call select_from_repositories,lib/mk/spec/arm_v7/core-hw.inc)
|
||||
|
||||
CC_CXX_WARN_STRICT_CONVERSION =
|
||||
|
||||
@@ -31,8 +31,9 @@ void * Platform::Ram_allocator::alloc_aligned(size_t size, unsigned align)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
return Base::alloc_aligned(Hw::round_page(size),
|
||||
max(align, get_page_size_log2())).convert<void *>(
|
||||
align = max(align, (unsigned)get_page_size_log2());
|
||||
|
||||
return Base::alloc_aligned(Hw::round_page(size), align).convert<void *>(
|
||||
|
||||
[&] (void *ptr) { return ptr; },
|
||||
[&] (Ram_allocator::Alloc_error e) -> void *
|
||||
|
||||
@@ -307,7 +307,7 @@ unsigned Bootstrap::Platform::enable_mmu()
|
||||
|
||||
/* skip the SMP when ACPI parsing did not reveal the number of CPUs */
|
||||
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()));
|
||||
|
||||
@@ -317,7 +317,7 @@ unsigned Bootstrap::Platform::enable_mmu()
|
||||
|
||||
if (!Cpu::IA32_apic_base::Bsp::get(lapic_msr))
|
||||
/* AP - done */
|
||||
return cpu_id;
|
||||
return (unsigned)cpu_id;
|
||||
|
||||
/* 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 */
|
||||
ipi_to_all(lapic, AP_BOOT_CODE_PAGE >> 12, Lapic::Icr_low::Delivery_mode::SIPI);
|
||||
|
||||
return cpu_id;
|
||||
return (unsigned)cpu_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
|
||||
using namespace Hw;
|
||||
|
||||
/* 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,
|
||||
NO_EXEC, KERN, GLOBAL,
|
||||
ds.io_mem() ? DEVICE : RAM,
|
||||
|
||||
@@ -28,7 +28,7 @@ using namespace Genode;
|
||||
|
||||
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,
|
||||
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)
|
||||
{
|
||||
long const mmconf =
|
||||
|
||||
@@ -132,8 +132,8 @@ namespace Kernel {
|
||||
inline int start_thread(Thread & thread, unsigned const cpu_id,
|
||||
Pd & pd, Native_utcb & utcb)
|
||||
{
|
||||
return call(call_id_start_thread(), (Call_arg)&thread, cpu_id,
|
||||
(Call_arg)&pd, (Call_arg)&utcb);
|
||||
return (int)call(call_id_start_thread(), (Call_arg)&thread, cpu_id,
|
||||
(Call_arg)&pd, (Call_arg)&utcb);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -121,8 +121,8 @@ class Kernel::Cpu : public Genode::Cpu, private Irq::Pool, private Timeout
|
||||
Inter_processor_work_list _local_work_list {};
|
||||
|
||||
void _arch_init();
|
||||
unsigned _quota() const { return _timer.us_to_ticks(cpu_quota_us); }
|
||||
unsigned _fill() const { return _timer.us_to_ticks(cpu_fill_us); }
|
||||
unsigned _quota() const { return (unsigned)_timer.us_to_ticks(cpu_quota_us); }
|
||||
unsigned _fill() const { return (unsigned)_timer.us_to_ticks(cpu_fill_us); }
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -188,8 +188,8 @@ class Kernel::User_irq : public Kernel::Irq
|
||||
Genode::Irq_session::Polarity polarity,
|
||||
capid_t sig)
|
||||
{
|
||||
return call(call_id_new_irq(), (Call_arg)&irq, nr,
|
||||
(trigger << 2) | polarity, sig);
|
||||
return (capid_t)call(call_id_new_irq(), (Call_arg)&irq, nr,
|
||||
(trigger << 2) | polarity, sig);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -195,7 +195,7 @@ void Object_identity_reference::invalidate()
|
||||
Object_identity_reference::Object_identity_reference(Object_identity *oi,
|
||||
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)
|
||||
_identity->insert(this);
|
||||
|
||||
@@ -250,7 +250,7 @@ class Kernel::Core_object_identity : public Object_identity,
|
||||
|
||||
static capid_t syscall_create(Genode::Constructible<Core_object_identity<T>> & t,
|
||||
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) {
|
||||
call(call_id_delete_obj(), (Call_arg)&t); }
|
||||
|
||||
@@ -72,7 +72,7 @@ class Kernel::Pd
|
||||
_platform_pd(platform_pd),
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ class Kernel::Pd
|
||||
Hw::Page_table &tt,
|
||||
Genode::Platform_pd &pd)
|
||||
{
|
||||
return call(call_id_new_pd(), (Call_arg)&p,
|
||||
(Call_arg)&tt, (Call_arg)&pd);
|
||||
return (capid_t)call(call_id_new_pd(), (Call_arg)&p,
|
||||
(Call_arg)&tt, (Call_arg)&pd);
|
||||
}
|
||||
|
||||
static void syscall_destroy(Genode::Kernel_object<Pd> & p) {
|
||||
|
||||
@@ -203,8 +203,8 @@ class Kernel::Signal_context
|
||||
Signal_receiver & receiver,
|
||||
addr_t const imprint)
|
||||
{
|
||||
return call(call_id_new_signal_context(), (Call_arg)&c,
|
||||
(Call_arg)&receiver, (Call_arg)imprint);
|
||||
return (capid_t)call(call_id_new_signal_context(), (Call_arg)&c,
|
||||
(Call_arg)&receiver, (Call_arg)imprint);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,7 +283,7 @@ class Kernel::Signal_receiver
|
||||
* \retval capability id of the new kernel object
|
||||
*/
|
||||
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
|
||||
|
||||
@@ -90,7 +90,7 @@ void Thread::_ipc_free_recv_caps()
|
||||
void Thread::_ipc_init(Genode::Native_utcb &utcb, Thread &starter)
|
||||
{
|
||||
_utcb = &utcb;
|
||||
_ipc_alloc_recv_caps(starter._utcb->cap_cnt());
|
||||
_ipc_alloc_recv_caps((unsigned)(starter._utcb->cap_cnt()));
|
||||
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()
|
||||
{
|
||||
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()
|
||||
{
|
||||
/* lookup CPU */
|
||||
Cpu & cpu = _cpu_pool.cpu(user_arg_2());
|
||||
Cpu & cpu = _cpu_pool.cpu((unsigned)user_arg_2());
|
||||
user_arg_0(0);
|
||||
Thread &thread = *(Thread*)user_arg_1();
|
||||
|
||||
@@ -362,7 +362,7 @@ void Thread::_call_stop_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)
|
||||
return;
|
||||
@@ -450,7 +450,7 @@ void Thread::_call_delete_thread()
|
||||
void Thread::_call_await_request_msg()
|
||||
{
|
||||
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();
|
||||
if (_ipc_node.awaits_request()) {
|
||||
_become_inactive(AWAITS_IPC);
|
||||
@@ -467,7 +467,7 @@ void Thread::_call_await_request_msg()
|
||||
void Thread::_call_timeout()
|
||||
{
|
||||
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()));
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ void Thread::timeout_triggered()
|
||||
|
||||
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;
|
||||
if (!dst) {
|
||||
Genode::raw(*this, ": cannot send to unknown recipient ",
|
||||
@@ -513,7 +513,7 @@ void Thread::_call_send_request_msg()
|
||||
if (!_ipc_node.can_send_request()) {
|
||||
Genode::raw("IPC send request: bad state");
|
||||
} 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_node.send_request(dst->_ipc_node, help);
|
||||
}
|
||||
@@ -536,7 +536,7 @@ void Thread::_call_pager()
|
||||
{
|
||||
/* override event route */
|
||||
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;
|
||||
}
|
||||
/* 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) {
|
||||
Genode::raw(*this, ": cannot await, unknown signal receiver ",
|
||||
(unsigned)user_arg_1());
|
||||
@@ -573,7 +573,7 @@ void Thread::_call_await_signal()
|
||||
void Thread::_call_pending_signal()
|
||||
{
|
||||
/* 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) {
|
||||
Genode::raw(*this, ": cannot await, unknown signal receiver ",
|
||||
(unsigned)user_arg_1());
|
||||
@@ -601,7 +601,7 @@ void Thread::_call_pending_signal()
|
||||
void Thread::_call_cancel_next_await_signal()
|
||||
{
|
||||
/* 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())) {
|
||||
raw(*this, ": failed to lookup thread ", (unsigned)user_arg_1());
|
||||
_die();
|
||||
@@ -620,7 +620,7 @@ void Thread::_call_cancel_next_await_signal()
|
||||
void Thread::_call_submit_signal()
|
||||
{
|
||||
/* 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) {
|
||||
/* cannot submit unknown signal context */
|
||||
user_arg_0(-1);
|
||||
@@ -628,12 +628,12 @@ void Thread::_call_submit_signal()
|
||||
}
|
||||
|
||||
/* 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");
|
||||
user_arg_0(-1);
|
||||
return;
|
||||
}
|
||||
c->submit(user_arg_2());
|
||||
c->submit((unsigned)user_arg_2());
|
||||
user_arg_0(0);
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ void Thread::_call_submit_signal()
|
||||
void Thread::_call_ack_signal()
|
||||
{
|
||||
/* 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) {
|
||||
Genode::raw(*this, ": cannot ack unknown signal context");
|
||||
return;
|
||||
@@ -655,7 +655,7 @@ void Thread::_call_ack_signal()
|
||||
void Thread::_call_kill_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) {
|
||||
Genode::raw(*this, ": cannot kill unknown signal context");
|
||||
user_arg_0(-1);
|
||||
@@ -674,7 +674,7 @@ void Thread::_call_kill_signal_context()
|
||||
|
||||
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) {
|
||||
Genode::raw(*this, ": invalid signal context for interrupt");
|
||||
user_arg_0(-1);
|
||||
@@ -699,7 +699,7 @@ void Thread::_call_ack_irq() {
|
||||
void Thread::_call_new_obj()
|
||||
{
|
||||
/* 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;
|
||||
if (!thread ||
|
||||
(static_cast<Core_object<Thread>*>(thread)->capid() != ref->capid())) {
|
||||
@@ -726,14 +726,14 @@ void Thread::_call_delete_obj()
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
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->in_utcb()) return;
|
||||
@@ -766,7 +766,7 @@ void Thread::_call()
|
||||
try {
|
||||
|
||||
/* switch over unrestricted kernel calls */
|
||||
unsigned const call_id = user_arg_0();
|
||||
unsigned const call_id = (unsigned)user_arg_0();
|
||||
switch (call_id) {
|
||||
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;
|
||||
|
||||
@@ -356,8 +356,9 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout
|
||||
size_t const quota,
|
||||
char const * const label)
|
||||
{
|
||||
return call(call_id_new_thread(), (Call_arg)&t, (Call_arg)priority,
|
||||
(Call_arg)quota, (Call_arg)label);
|
||||
return (capid_t)call(call_id_new_thread(), (Call_arg)&t,
|
||||
(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,
|
||||
char const * const label)
|
||||
{
|
||||
return call(call_id_new_core_thread(), (Call_arg)&t,
|
||||
(Call_arg)label);
|
||||
return (capid_t)call(call_id_new_core_thread(), (Call_arg)&t,
|
||||
(Call_arg)label);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,8 +101,8 @@ class Kernel::Vm : private Kernel::Object, public Cpu_job
|
||||
capid_t const signal_context_id,
|
||||
Identity & id)
|
||||
{
|
||||
return call(call_id_new_vm(), (Call_arg)&vm, (Call_arg)cpu,
|
||||
(Call_arg)state, (Call_arg)&id, signal_context_id);
|
||||
return (capid_t)call(call_id_new_vm(), (Call_arg)&vm, (Call_arg)cpu,
|
||||
(Call_arg)state, (Call_arg)&id, signal_context_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
void Kernel::Thread::_call_new_vm()
|
||||
{
|
||||
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) {
|
||||
user_arg_0(cap_id_invalid());
|
||||
return;
|
||||
@@ -36,7 +36,7 @@ void Kernel::Thread::_call_delete_vm() { _call_delete<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;
|
||||
|
||||
if (!vm) {
|
||||
@@ -52,7 +52,7 @@ void Kernel::Thread::_call_run_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;
|
||||
|
||||
if (!vm) {
|
||||
|
||||
@@ -300,11 +300,9 @@ Platform::Platform()
|
||||
** Support for core memory management **
|
||||
****************************************/
|
||||
|
||||
bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr,
|
||||
unsigned size) {
|
||||
return ::map_local(phys_addr, virt_addr, size / get_page_size()); }
|
||||
bool Mapped_mem_allocator::_map_local(addr_t virt, addr_t phys, size_t size) {
|
||||
return ::map_local(phys, virt, size / get_page_size()); }
|
||||
|
||||
|
||||
bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t,
|
||||
unsigned size) {
|
||||
return ::unmap_local(virt_addr, size / get_page_size()); }
|
||||
bool Mapped_mem_allocator::_unmap_local(addr_t virt, addr_t, size_t size) {
|
||||
return ::unmap_local(virt, size / get_page_size()); }
|
||||
|
||||
@@ -54,7 +54,7 @@ Platform_thread::~Platform_thread()
|
||||
|
||||
void Platform_thread::quota(size_t const quota)
|
||||
{
|
||||
_quota = quota;
|
||||
_quota = (unsigned)quota;
|
||||
Kernel::thread_quota(*_kobj, quota);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ Platform_thread::Platform_thread(size_t const quota,
|
||||
_pager(nullptr),
|
||||
_utcb_pd_addr((Native_utcb *)utcb),
|
||||
_priority(_scale_priority(virt_prio)),
|
||||
_quota(quota),
|
||||
_quota((unsigned)quota),
|
||||
_main_thread(false),
|
||||
_location(location),
|
||||
_kobj(_kobj.CALLED_FROM_CORE, _priority, _quota, _label.string())
|
||||
|
||||
@@ -71,7 +71,7 @@ struct Genode::Arm_cpu : public Hw::Arm_cpu
|
||||
|
||||
~Mmu_context();
|
||||
|
||||
uint8_t id() { return cidr; }
|
||||
uint8_t id() { return (uint8_t)cidr; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,7 @@ unsigned Timer::interrupt_id() const { return Board::TIMER_IRQ; }
|
||||
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::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)
|
||||
{
|
||||
_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::Istatus::set(ctl, 0);
|
||||
Cpu::Cntp_ctl::write(ctl);
|
||||
|
||||
@@ -96,7 +96,7 @@ static Vmid_allocator &alloc()
|
||||
allocator = unmanaged_singleton<Vmid_allocator>();
|
||||
|
||||
/* reserve VM ID 0 for the hypervisor */
|
||||
unsigned id = allocator->alloc();
|
||||
addr_t id = allocator->alloc();
|
||||
assert (id == 0);
|
||||
}
|
||||
return *allocator;
|
||||
|
||||
@@ -96,7 +96,7 @@ struct Genode::Cpu : Hw::Arm_64_cpu
|
||||
~Mmu_context();
|
||||
|
||||
Genode::uint16_t id() {
|
||||
return Ttbr::Asid::get(ttbr); }
|
||||
return Ttbr::Asid::get(ttbr) & 0xffff; }
|
||||
};
|
||||
|
||||
void switch_to(Context&, Mmu_context &);
|
||||
|
||||
@@ -47,7 +47,7 @@ Mmu_context(addr_t page_table_base,
|
||||
|
||||
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);
|
||||
_addr_space_id_alloc.free(asid);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,9 @@ unsigned Genode::Cpu::executing_id()
|
||||
void * const stack_ptr = nullptr;
|
||||
addr_t const stack_addr = reinterpret_cast<addr_t>(&stack_ptr);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ void Global_interrupt_controller::_update_irt_entry(unsigned irq)
|
||||
Irte::Trg::set(irte, _irq_mode[irq].trigger_mode);
|
||||
|
||||
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) {
|
||||
Irte::access_t irte = _create_irt_entry(i);
|
||||
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<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));
|
||||
Irte::access_t irte = read<Iowin>();
|
||||
Irte::Mask::set(irte, set);
|
||||
write<Iowin>(irte);
|
||||
write<Iowin>((Iowin::access_t)(irte));
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ class Board::Global_interrupt_controller : public Genode::Mmio
|
||||
{
|
||||
private:
|
||||
|
||||
using uint8_t = Genode::uint8_t;
|
||||
|
||||
enum {
|
||||
/* Register selectors */
|
||||
IOAPICVER = 0x01,
|
||||
@@ -82,9 +84,9 @@ class Board::Global_interrupt_controller : public Genode::Mmio
|
||||
struct Maximum_redirection_entry : Bitfield<16, 8> { };
|
||||
};
|
||||
|
||||
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 */
|
||||
Irq_mode _irq_mode[IRQ_COUNT];
|
||||
unsigned _irte_count = 0; /* number of redirection table entries */
|
||||
uint8_t _lapic_id[NR_OF_CPUS]; /* unique name of the LAPIC of each CPU */
|
||||
Irq_mode _irq_mode[IRQ_COUNT];
|
||||
|
||||
/**
|
||||
* Return whether 'irq' is an edge-triggered interrupt
|
||||
@@ -137,10 +139,9 @@ class Board::Global_interrupt_controller : public Genode::Mmio
|
||||
** Accessors **
|
||||
***************/
|
||||
|
||||
void lapic_id(unsigned cpu_id,
|
||||
Genode::uint8_t lapic_id);
|
||||
void lapic_id(unsigned cpu_id, 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) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ uint32_t Board::Timer::pit_calc_timer_freq(void)
|
||||
{
|
||||
uint32_t t_start, t_end;
|
||||
|
||||
/* Set channel gate high and disable speaker */
|
||||
outb(PIT_CH2_GATE, (inb(0x61) & ~0x02) | 0x01);
|
||||
/* set channel gate high and disable speaker */
|
||||
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_CH2_DATA, PIT_SLEEP_TICS & 0xff);
|
||||
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()))
|
||||
{
|
||||
/* 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::Delivery>(0);
|
||||
write<Tmr_lvt::Mask>(0);
|
||||
@@ -71,7 +71,7 @@ Board::Timer::Timer(unsigned)
|
||||
raw("Failed to calibrate timer frequency");
|
||||
throw Calibration_failed();
|
||||
}
|
||||
write<Divide_configuration::Divide_value>(div);
|
||||
write<Divide_configuration::Divide_value>((uint8_t)div);
|
||||
|
||||
/* Calculate timer frequency */
|
||||
ticks_per_ms = pit_calc_timer_freq();
|
||||
@@ -88,7 +88,7 @@ Board::Timer::Timer(unsigned)
|
||||
|
||||
|
||||
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 {
|
||||
|
||||
@@ -27,8 +27,7 @@ namespace Genode { namespace Capability_space {
|
||||
*/
|
||||
static inline Kernel::capid_t capid(Native_capability const &cap)
|
||||
{
|
||||
addr_t const index = (addr_t)cap.data();
|
||||
return index;
|
||||
return (Kernel::capid_t)((addr_t)cap.data() & 0xffffU);
|
||||
}
|
||||
|
||||
static inline Native_capability import(Kernel::capid_t capid)
|
||||
|
||||
@@ -66,7 +66,7 @@ class Hw::Page_table_allocator
|
||||
{
|
||||
static_assert((sizeof(TABLE) == TABLE_SIZE), "unexpected size");
|
||||
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
|
||||
{
|
||||
try {
|
||||
return _free_tables.alloc();
|
||||
return (unsigned)_free_tables.alloc();
|
||||
} catch (typename Bit_allocator::Out_of_indices&) {}
|
||||
throw Out_of_tables();
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ struct Hw::Arm_64_cpu
|
||||
|
||||
struct Iss : Bitfield<0, 25>
|
||||
{
|
||||
struct Abort : Register<32>
|
||||
struct Abort : Register<64>
|
||||
{
|
||||
struct Level : Bitfield<0, 2> {};
|
||||
struct Fsc : Bitfield<2, 4>
|
||||
@@ -231,7 +231,7 @@ struct Hw::Arm_64_cpu
|
||||
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()); }
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#include <hw/spec/arm/psci.h>
|
||||
|
||||
#define PSCI_CALL_IMPL(instr) \
|
||||
static inline int call(unsigned int func, unsigned long a0, \
|
||||
unsigned int a1, unsigned int a2) { \
|
||||
static inline int call(Genode::umword_t func, Genode::umword_t a0, \
|
||||
Genode::umword_t a1, Genode::umword_t a2) { \
|
||||
unsigned long result = 0; \
|
||||
asm volatile ("mov x0, %1 \n" \
|
||||
"mov x1, %2 \n" \
|
||||
@@ -30,7 +30,7 @@
|
||||
: "r"(func), "r"(a0), "r"(a1), "r"(a2) \
|
||||
: "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", \
|
||||
"x8", "x9", "x10", "x11", "x12", "x13", "x14"); \
|
||||
return result; \
|
||||
return (int)result; \
|
||||
}
|
||||
|
||||
namespace Hw {
|
||||
|
||||
@@ -181,7 +181,7 @@ class Sv39::Level_x_translation_table
|
||||
* Return how many entries of an alignment fit into region
|
||||
*/
|
||||
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>
|
||||
|
||||
@@ -87,7 +87,7 @@ void Hw::for_each_rsdt_entry(Hw::Acpi_generic &rsdt, FUNC fn)
|
||||
typedef Genode::uint32_t entry_t;
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
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);
|
||||
for (unsigned i = 0; i < entry_count; i++)
|
||||
|
||||
@@ -618,7 +618,7 @@ class Hw::Pml4_table
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,10 @@ void Native_capability::_dec()
|
||||
return;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,9 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
|
||||
|
||||
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 -2: throw Allocator::Out_of_memory();
|
||||
default:
|
||||
@@ -111,7 +113,7 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
|
||||
},
|
||||
[&] () { upgrade_capability_slab(); });
|
||||
|
||||
return Rpc_exception_code(utcb.exception_code());
|
||||
return Rpc_exception_code((int)utcb.exception_code());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ unsigned share_id(void * const pointer)
|
||||
addr_t const base = (addr_t)data()->shares;
|
||||
if (address < base || address >= base + sizeof(data()->shares)) {
|
||||
return 0; }
|
||||
return (address - base) / sizeof(Cpu_share) + 1;
|
||||
return (unsigned)((address - base) / sizeof(Cpu_share) + 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,16 +39,16 @@ Timer::Time_source::Time_source(Env &env)
|
||||
void Timer::Time_source::set_timeout(Microseconds duration,
|
||||
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) {
|
||||
duration_us = MIN_TIMEOUT_US; }
|
||||
|
||||
if (duration_us > _max_timeout_us) {
|
||||
duration_us = _max_timeout_us; }
|
||||
duration_us = (Kernel::timeout_t)_max_timeout_us; }
|
||||
|
||||
_handler = &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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user