diff --git a/repos/base-hw/src/test/cpu_quota/main.cc b/repos/base-hw/src/test/cpu_quota/main.cc index 05365e69b..849ffafc1 100644 --- a/repos/base-hw/src/test/cpu_quota/main.cc +++ b/repos/base-hw/src/test/cpu_quota/main.cc @@ -130,7 +130,7 @@ struct Main log("start measurement ..."); timer.sigh(timer_signal.cap); - auto measure = [&] (unsigned duration_sec) { + auto measure = [&] (uint64_t duration_sec) { timer.trigger_once(duration_sec * 1000 * 1000); synchronizer.synchronize(); timer_signal.receive(); diff --git a/repos/base-linux/src/timer/linux/time_source.cc b/repos/base-linux/src/timer/linux/time_source.cc index ddaaecfb7..4369c0a4f 100644 --- a/repos/base-linux/src/timer/linux/time_source.cc +++ b/repos/base-linux/src/timer/linux/time_source.cc @@ -37,11 +37,11 @@ Duration Timer::Time_source::curr_time() { struct timeval tv; lx_gettimeofday(&tv, 0); - return Duration(Microseconds(tv.tv_sec * 1000 * 1000 + tv.tv_usec)); + return Duration(Microseconds((uint64_t)tv.tv_sec * 1000 * 1000 + tv.tv_usec)); } -void Timer::Time_source::_usleep(unsigned long us) +void Timer::Time_source::_usleep(uint64_t us) { struct timespec ts; ts.tv_sec = us / (1000 * 1000); diff --git a/repos/base-nova/src/timer/nova/time_source.h b/repos/base-nova/src/timer/nova/time_source.h index c05732cf3..dd7689397 100644 --- a/repos/base-nova/src/timer/nova/time_source.h +++ b/repos/base-nova/src/timer/nova/time_source.h @@ -22,7 +22,11 @@ /* local includes */ #include -namespace Timer { class Time_source; } +namespace Timer { + + using Genode::uint64_t; + class Time_source; +} class Timer::Time_source : public Threaded_time_source @@ -45,7 +49,7 @@ class Timer::Time_source : public Threaded_time_source } Genode::addr_t _sem { ~0UL }; - unsigned long _timeout_us { 0 }; + uint64_t _timeout_us { 0 }; unsigned long const _tsc_khz; Duration _curr_time { Microseconds(0) }; Genode::Trace::Timestamp _tsc_start { Genode::Trace::timestamp() }; @@ -54,7 +58,7 @@ class Timer::Time_source : public Threaded_time_source /* 1 / ((us / (1000 * 1000)) * (tsc_khz * 1000)) */ enum { TSC_FACTOR = 1000ULL }; - inline Genode::uint64_t _tsc_to_us(Genode::uint64_t tsc) const + inline uint64_t _tsc_to_us(uint64_t tsc) const { return (tsc) / (_tsc_khz / TSC_FACTOR); } @@ -84,8 +88,8 @@ class Timer::Time_source : public Threaded_time_source Microseconds max_timeout() const override { - unsigned long long const max_us_ull = _tsc_to_us(~0ULL); - return max_us_ull > ~0UL ? Microseconds(~0UL) : Microseconds(max_us_ull); + uint64_t const max_us = _tsc_to_us(~(uint64_t)0); + return max_us > ~(uint64_t)0 ? Microseconds(~(uint64_t)0) : Microseconds(max_us); } Duration curr_time() override diff --git a/repos/base/include/base/alarm.h b/repos/base/include/base/alarm.h index ff3badb0d..1159d19cd 100644 --- a/repos/base/include/base/alarm.h +++ b/repos/base/include/base/alarm.h @@ -26,7 +26,7 @@ class Genode::Alarm { public: - typedef unsigned long Time; + typedef uint64_t Time; private: @@ -38,7 +38,7 @@ class Genode::Alarm bool deadline_period; Time period; /* duration between alarms */ - bool is_pending_at(unsigned long time, bool time_period) const; + bool is_pending_at(uint64_t time, bool time_period) const; }; Lock _dispatch_lock { }; /* taken during handle method */ @@ -76,7 +76,7 @@ class Genode::Alarm * return value is 'true' and the alarm is periodically scheduled, * the alarm is scheduled again. */ - virtual bool on_alarm(unsigned) { return false; } + virtual bool on_alarm(uint64_t) { return false; } public: diff --git a/repos/base/include/base/duration.h b/repos/base/include/base/duration.h index 502e4d227..87ac6a2a1 100644 --- a/repos/base/include/base/duration.h +++ b/repos/base/include/base/duration.h @@ -32,9 +32,9 @@ namespace Genode { */ struct Genode::Microseconds { - unsigned long value; + uint64_t value; - explicit Microseconds(unsigned long value) : value(value) { } + explicit Microseconds(uint64_t value) : value(value) { } void print(Output &out) const { @@ -49,9 +49,9 @@ struct Genode::Microseconds */ struct Genode::Milliseconds { - unsigned long value; + uint64_t value; - explicit Milliseconds(unsigned long value) : value(value) { } + explicit Milliseconds(uint64_t value) : value(value) { } void print(Output &out) const { @@ -76,11 +76,7 @@ struct Genode::Duration enum { MS_PER_HOUR = 1000UL * 60 * 60 }; enum { US_PER_HOUR = 1000UL * 1000 * 60 * 60 }; - unsigned long _microseconds { 0 }; - unsigned long _hours { 0 }; - - void _add_us_less_than_an_hour(unsigned long us); - void _raise_hours(unsigned long hours); + uint64_t _microseconds { 0 }; public: diff --git a/repos/base/include/timer/timeout.h b/repos/base/include/timer/timeout.h index 3dbab7432..7a5c043fc 100644 --- a/repos/base/include/timer/timeout.h +++ b/repos/base/include/timer/timeout.h @@ -158,7 +158,7 @@ class Genode::Timeout : private Noncopyable private: - typedef unsigned long Time; + typedef uint64_t Time; struct Raw { @@ -166,7 +166,7 @@ class Genode::Timeout : private Noncopyable bool deadline_period; Time period; - bool is_pending_at(unsigned long time, bool time_period) const; + bool is_pending_at(uint64_t time, bool time_period) const; }; Lock _dispatch_lock { }; @@ -188,7 +188,7 @@ class Genode::Timeout : private Noncopyable void _alarm_reset() { _alarm_assign(0, 0, false, 0), _active = 0, _next = 0; } - bool _on_alarm(unsigned); + bool _on_alarm(uint64_t); Alarm(Alarm const &); Alarm &operator = (Alarm const &); diff --git a/repos/base/include/timer_session/client.h b/repos/base/include/timer_session/client.h index da9dc5551..ac1f2bd38 100644 --- a/repos/base/include/timer_session/client.h +++ b/repos/base/include/timer_session/client.h @@ -27,15 +27,15 @@ struct Timer::Session_client : Genode::Rpc_client explicit Session_client(Session_capability session) : Genode::Rpc_client(session) { } - void trigger_once(unsigned us) override { call(us); } + void trigger_once(uint64_t us) override { call(us); } - void trigger_periodic(unsigned us) override { call(us); } + void trigger_periodic(uint64_t us) override { call(us); } void sigh(Signal_context_capability sigh) override { call(sigh); } - unsigned long elapsed_ms() const override { return call(); } + uint64_t elapsed_ms() const override { return call(); } - unsigned long elapsed_us() const override { return call(); } + uint64_t elapsed_us() const override { return call(); } }; #endif /* _INCLUDE__TIMER_SESSION__CLIENT_H_ */ diff --git a/repos/base/include/timer_session/connection.h b/repos/base/include/timer_session/connection.h index 9b3201524..eef8d641e 100644 --- a/repos/base/include/timer_session/connection.h +++ b/repos/base/include/timer_session/connection.h @@ -205,22 +205,22 @@ class Timer::Connection : public Genode::Connection, Timeout_handler *_handler { nullptr }; Lock _real_time_lock { Lock::UNLOCKED }; - unsigned long _us { elapsed_us() }; + uint64_t _us { elapsed_us() }; Timestamp _ts { _timestamp() }; Duration _real_time { Microseconds(_us) }; Duration _interpolated_time { _real_time }; unsigned _interpolation_quality { 0 }; - unsigned long _us_to_ts_factor { 1UL }; + uint64_t _us_to_ts_factor { 1UL }; unsigned _us_to_ts_factor_shift { 0 }; Timestamp _timestamp(); - void _update_interpolation_quality(unsigned long min_factor, - unsigned long max_factor); + void _update_interpolation_quality(uint64_t min_factor, + uint64_t max_factor); - unsigned long _ts_to_us_ratio(Timestamp ts, - unsigned long us, - unsigned shift); + uint64_t _ts_to_us_ratio(Timestamp ts, + uint64_t us, + unsigned shift); void _update_real_time(); @@ -284,7 +284,7 @@ class Timer::Connection : public Genode::Connection, * \noapi * \deprecated Use One_shot_timeout (or Periodic_timeout) instead */ - void usleep(unsigned us) override + void usleep(uint64_t us) override { if (_mode == MODERN) { throw Cannot_use_both_legacy_and_modern_interface(); @@ -322,7 +322,7 @@ class Timer::Connection : public Genode::Connection, * \noapi * \deprecated Use One_shot_timeout (or Periodic_timeout) instead */ - void msleep(unsigned ms) override + void msleep(uint64_t ms) override { if (_mode == MODERN) { throw Cannot_use_both_legacy_and_modern_interface(); diff --git a/repos/base/include/timer_session/timer_session.h b/repos/base/include/timer_session/timer_session.h index ffc6bac1b..1df9a7db3 100644 --- a/repos/base/include/timer_session/timer_session.h +++ b/repos/base/include/timer_session/timer_session.h @@ -19,7 +19,12 @@ #include #include -namespace Timer { struct Session; } +namespace Timer { + + using Genode::uint64_t; + + struct Session; +} struct Timer::Session : Genode::Session @@ -38,7 +43,7 @@ struct Timer::Session : Genode::Session /** * Program single timeout (relative from now in microseconds) */ - virtual void trigger_once(unsigned us) = 0; + virtual void trigger_once(uint64_t us) = 0; /** * Program periodic timeout (in microseconds) @@ -46,7 +51,7 @@ struct Timer::Session : Genode::Session * The first period will be triggered after 'us' at the latest, * but it might be triggered earlier as well. */ - virtual void trigger_periodic(unsigned us) = 0; + virtual void trigger_periodic(uint64_t us) = 0; /** * Register timeout signal handler @@ -56,32 +61,32 @@ struct Timer::Session : Genode::Session /** * Return number of elapsed milliseconds since session creation */ - virtual unsigned long elapsed_ms() const = 0; + virtual uint64_t elapsed_ms() const = 0; - virtual unsigned long elapsed_us() const = 0; + virtual uint64_t elapsed_us() const = 0; /** * Client-side convenience method for sleeping the specified number * of milliseconds */ - virtual void msleep(unsigned ms) = 0; + virtual void msleep(uint64_t ms) = 0; /** * Client-side convenience method for sleeping the specified number * of microseconds */ - virtual void usleep(unsigned us) = 0; + virtual void usleep(uint64_t us) = 0; /********************* ** RPC declaration ** *********************/ - GENODE_RPC(Rpc_trigger_once, void, trigger_once, unsigned); - GENODE_RPC(Rpc_trigger_periodic, void, trigger_periodic, unsigned); + GENODE_RPC(Rpc_trigger_once, void, trigger_once, uint64_t); + GENODE_RPC(Rpc_trigger_periodic, void, trigger_periodic, uint64_t); GENODE_RPC(Rpc_sigh, void, sigh, Genode::Signal_context_capability); - GENODE_RPC(Rpc_elapsed_ms, unsigned long, elapsed_ms); - GENODE_RPC(Rpc_elapsed_us, unsigned long, elapsed_us); + GENODE_RPC(Rpc_elapsed_ms, uint64_t, elapsed_ms); + GENODE_RPC(Rpc_elapsed_us, uint64_t, elapsed_us); GENODE_RPC_INTERFACE(Rpc_trigger_once, Rpc_trigger_periodic, Rpc_sigh, Rpc_elapsed_ms, Rpc_elapsed_us); diff --git a/repos/base/include/util/register_set.h b/repos/base/include/util/register_set.h index 3dc0f8db9..bd0eda3ea 100644 --- a/repos/base/include/util/register_set.h +++ b/repos/base/include/util/register_set.h @@ -666,8 +666,8 @@ class Genode::Register_set : Noncopyable struct Microseconds { - unsigned value; - explicit Microseconds(unsigned value) : value(value) { } + uint64_t value; + explicit Microseconds(uint64_t value) : value(value) { } }; /** @@ -678,7 +678,7 @@ class Genode::Register_set : Noncopyable /** * Delay execution of the caller for 'us' microseconds */ - virtual void usleep(unsigned us) = 0; + virtual void usleep(uint64_t us) = 0; }; diff --git a/repos/base/lib/symbols/ld b/repos/base/lib/symbols/ld index 2056de833..dd566d80f 100644 --- a/repos/base/lib/symbols/ld +++ b/repos/base/lib/symbols/ld @@ -125,11 +125,11 @@ _ZN6Genode14env_deprecatedEv T _ZN6Genode14ipc_reply_waitERKNS_17Native_capabilityENS_18Rpc_exception_codeERNS_11Msgbuf_baseES5_ T _ZN6Genode15Alarm_scheduler12_setup_alarmERNS_5AlarmEmm T _ZN6Genode15Alarm_scheduler13next_deadlineEPm T -_ZN6Genode15Alarm_scheduler17schedule_absoluteEPNS_5AlarmEm T +_ZN6Genode15Alarm_scheduler17schedule_absoluteEPNS_5AlarmEy T _ZN6Genode15Alarm_scheduler18_get_pending_alarmEv T _ZN6Genode15Alarm_scheduler23_unsynchronized_dequeueEPNS_5AlarmE T _ZN6Genode15Alarm_scheduler23_unsynchronized_enqueueEPNS_5AlarmE T -_ZN6Genode15Alarm_scheduler6handleEm T +_ZN6Genode15Alarm_scheduler6handleEy T _ZN6Genode15Alarm_scheduler7discardEPNS_5AlarmE T _ZN6Genode15Alarm_scheduler8scheduleEPNS_5AlarmEm T _ZN6Genode15Alarm_schedulerD1Ev T diff --git a/repos/base/src/lib/alarm/alarm.cc b/repos/base/src/lib/alarm/alarm.cc index 7ee353b47..3d49c5ceb 100644 --- a/repos/base/src/lib/alarm/alarm.cc +++ b/repos/base/src/lib/alarm/alarm.cc @@ -83,7 +83,7 @@ void Alarm_scheduler::_unsynchronized_dequeue(Alarm *alarm) } -bool Alarm::Raw::is_pending_at(unsigned long time, bool time_period) const +bool Alarm::Raw::is_pending_at(uint64_t time, bool time_period) const { return (time_period == deadline_period && time >= deadline) || @@ -139,7 +139,7 @@ void Alarm_scheduler::handle(Alarm::Time curr_time) Alarm *curr; while ((curr = _get_pending_alarm())) { - unsigned long triggered = 1; + uint64_t triggered = 1; if (curr->_raw.period) { Alarm::Time deadline = curr->_raw.deadline; diff --git a/repos/base/src/lib/timeout/duration.cc b/repos/base/src/lib/timeout/duration.cc index 47a38b3f0..b8a5d97bc 100644 --- a/repos/base/src/lib/timeout/duration.cc +++ b/repos/base/src/lib/timeout/duration.cc @@ -16,75 +16,37 @@ using namespace Genode; - -void Duration::_raise_hours(unsigned long hours) -{ - unsigned long const old_hours = _hours; - _hours += hours; - if (_hours < old_hours) { - throw Overflow(); } -} - - -void Duration::_add_us_less_than_an_hour(unsigned long us) -{ - unsigned long const us_until_next_hr = - (unsigned long)US_PER_HOUR - _microseconds; - - if (us >= us_until_next_hr) { - _raise_hours(1); - _microseconds = us - us_until_next_hr; - } else { - _microseconds += us; - } -} - - void Duration::add(Microseconds us) { - /* filter out hours if any */ - if (us.value >= (unsigned long)US_PER_HOUR) { - unsigned long const hours = us.value / US_PER_HOUR; - _raise_hours(hours); - us.value -= hours * US_PER_HOUR; + if (us.value > ~(uint64_t)0 - _microseconds) { + throw Overflow(); } - /* add the rest */ - _add_us_less_than_an_hour(us.value); + _microseconds += us.value; } void Duration::add(Milliseconds ms) { - /* filter out hours if any */ - if (ms.value >= MS_PER_HOUR) { - unsigned long const hours = ms.value / MS_PER_HOUR; - _raise_hours(hours); - ms.value -= hours * MS_PER_HOUR; + if (ms.value > ~(uint64_t)0 / 1000) { + throw Overflow(); } - /* add the rest as microseconds value */ - _add_us_less_than_an_hour(ms.value * US_PER_MS); + add(Microseconds(ms.value * 1000)); } bool Duration::less_than(Duration const &other) const { - if (_hours != other._hours) { - return _hours < other._hours; } - - if (_microseconds != other._microseconds) { - return _microseconds < other._microseconds; } - - return false; + return _microseconds < other._microseconds; } Microseconds Duration::trunc_to_plain_us() const { - return Microseconds(_microseconds + (_hours ? _hours * US_PER_HOUR : 0)); + return Microseconds(_microseconds); } Milliseconds Duration::trunc_to_plain_ms() const { - return Milliseconds(trunc_to_plain_us().value / 1000); + return Milliseconds(_microseconds / 1000); } diff --git a/repos/base/src/lib/timeout/timeout.cc b/repos/base/src/lib/timeout/timeout.cc index 1bf7298b5..902731b1b 100644 --- a/repos/base/src/lib/timeout/timeout.cc +++ b/repos/base/src/lib/timeout/timeout.cc @@ -48,7 +48,7 @@ void Timeout::discard() ** Timeout::Alarm ** ********************/ -bool Timeout::Alarm::_on_alarm(unsigned) +bool Timeout::Alarm::_on_alarm(uint64_t) { if (handler) { Handler *current = handler; @@ -68,7 +68,7 @@ Timeout::Alarm::~Alarm() } -bool Timeout::Alarm::Raw::is_pending_at(unsigned long time, bool time_period) const +bool Timeout::Alarm::Raw::is_pending_at(uint64_t time, bool time_period) const { return (time_period == deadline_period && time >= deadline) || @@ -83,12 +83,12 @@ bool Timeout::Alarm::Raw::is_pending_at(unsigned long time, bool time_period) co void Alarm_timeout_scheduler::handle_timeout(Duration duration) { - unsigned long const curr_time_us = duration.trunc_to_plain_us().value; + uint64_t const curr_time_us = duration.trunc_to_plain_us().value; _alarm_handle(curr_time_us); /* sleep time is either until the next deadline or the maximum timout */ - unsigned long sleep_time_us; + uint64_t sleep_time_us; Alarm::Time deadline_us; if (_alarm_next_deadline(&deadline_us)) { sleep_time_us = deadline_us - curr_time_us; @@ -139,7 +139,7 @@ void Alarm_timeout_scheduler::_schedule_one_shot(Timeout &timeout, Microseconds duration) { /* raise timeout duration by the age of the local time value */ - unsigned long us = _time_source.curr_time().trunc_to_plain_us().value; + uint64_t us = _time_source.curr_time().trunc_to_plain_us().value; if (us >= _now) { us = duration.value + (us - _now); } else { @@ -294,7 +294,7 @@ void Alarm_timeout_scheduler::_alarm_handle(Alarm::Time curr_time) _pending_head = _pending_head->_next; curr->_next = nullptr; - unsigned long triggered = 1; + uint64_t triggered = 1; if (curr->_raw.period) { Alarm::Time deadline = curr->_raw.deadline; diff --git a/repos/base/src/lib/timeout/timer_connection.cc b/repos/base/src/lib/timeout/timer_connection.cc index b721f4fb1..614dd2315 100644 --- a/repos/base/src/lib/timeout/timer_connection.cc +++ b/repos/base/src/lib/timeout/timer_connection.cc @@ -19,8 +19,8 @@ using namespace Genode; using namespace Genode::Trace; -void Timer::Connection::_update_interpolation_quality(unsigned long min_factor, - unsigned long max_factor) +void Timer::Connection::_update_interpolation_quality(uint64_t min_factor, + uint64_t max_factor) { /* * If the factor gets adapted less than 12.5%, we raise the @@ -35,9 +35,9 @@ void Timer::Connection::_update_interpolation_quality(unsigned long min_factor, } -unsigned long Timer::Connection::_ts_to_us_ratio(Timestamp ts, - unsigned long us, - unsigned shift) +uint64_t Timer::Connection::_ts_to_us_ratio(Timestamp ts, + uint64_t us, + unsigned shift) { /* * If the timestamp difference is to big to do the following @@ -59,8 +59,8 @@ unsigned long Timer::Connection::_ts_to_us_ratio(Timestamp ts, * the calculation. This upscaling must be considered when using * the result. */ - Timestamp const result = (ts << shift) / us; - unsigned long const result_ul = (unsigned long)result; + Timestamp const result = (ts << shift) / us; + uint64_t const result_ul = (uint64_t)result; if (result != result_ul) { warning("Timestamp-to-time ratio too big"); return ~0UL; @@ -87,7 +87,7 @@ Duration Timer::Connection::_update_interpolated_time(Duration &interpolated_tim void Timer::Connection::_handle_timeout() { - unsigned long const us = elapsed_us(); + uint64_t const us = elapsed_us(); if (us - _us > REAL_TIME_UPDATE_PERIOD_US) { _update_real_time(); } diff --git a/repos/base/src/lib/timeout/timer_connection_time.cc b/repos/base/src/lib/timeout/timer_connection_time.cc index d4f717d91..39e32b95d 100644 --- a/repos/base/src/lib/timeout/timer_connection_time.cc +++ b/repos/base/src/lib/timeout/timer_connection_time.cc @@ -28,9 +28,9 @@ void Timer::Connection::_update_real_time() * Update timestamp, time, and real-time value */ - Timestamp ts = 0UL; - unsigned long us = 0UL; - unsigned long latency_us = ~0UL; + Timestamp ts = 0UL; + uint64_t us = 0UL; + uint64_t latency_us = ~0UL; /* * We retry reading out timestamp plus remote time until the result @@ -41,8 +41,8 @@ void Timer::Connection::_update_real_time() remote_time_trials < MAX_REMOTE_TIME_TRIALS; ) { /* read out the two time values close in succession */ - Timestamp volatile new_ts = _timestamp(); - unsigned long volatile new_us = elapsed_us(); + Timestamp volatile new_ts = _timestamp(); + uint64_t volatile new_us = elapsed_us(); /* do not proceed until the time difference is at least 1 us */ if (new_us == _us || new_ts == _ts) { continue; } @@ -58,8 +58,8 @@ void Timer::Connection::_update_real_time() break; } /* determine latency between reading out timestamp and time value */ - Timestamp const ts_diff = _timestamp() - new_ts; - unsigned long const new_latency_us = + Timestamp const ts_diff = _timestamp() - new_ts; + uint64_t const new_latency_us = _ts_to_us_ratio(ts_diff, _us_to_ts_factor, _us_to_ts_factor_shift); /* remember results if the latency was better than on the last trial */ @@ -75,8 +75,8 @@ void Timer::Connection::_update_real_time() } /* determine timestamp and time difference */ - unsigned long const us_diff = us - _us; - Timestamp ts_diff = ts - _ts; + uint64_t const us_diff = us - _us; + Timestamp ts_diff = ts - _ts; /* overwrite timestamp, time, and real time member */ _us = us; @@ -88,16 +88,16 @@ void Timer::Connection::_update_real_time() * Update timestamp-to-time factor and its shift */ - unsigned factor_shift = _us_to_ts_factor_shift; - unsigned long old_factor = _us_to_ts_factor; - Timestamp max_ts_diff = ~(Timestamp)0ULL >> factor_shift; - Timestamp min_ts_diff_shifted = ~(Timestamp)0ULL >> 1; + unsigned factor_shift = _us_to_ts_factor_shift; + uint64_t old_factor = _us_to_ts_factor; + Timestamp max_ts_diff = ~(Timestamp)0ULL >> factor_shift; + Timestamp min_ts_diff_shifted = ~(Timestamp)0ULL >> 1; /* * If the calculation type is bigger than the resulting factor type, * we have to apply further limitations to avoid a loss at the final cast. */ - if (sizeof(Timestamp) > sizeof(unsigned long)) { + if (sizeof(Timestamp) > sizeof(uint64_t)) { Timestamp limit_ts_diff_shifted = (Timestamp)~0UL * us_diff; Timestamp const limit_ts_diff = limit_ts_diff_shifted >> @@ -146,12 +146,12 @@ void Timer::Connection::_update_real_time() old_factor <<= 1; } /* - * The cast to unsigned long does not cause a loss because of the - * limitations we applied to the timestamp difference. We also took - * care that the time difference cannot become null. + * The cast to uint64_t does not cause a loss because the timestamp + * type cannot be bigger as the factor type. We also took care that + * the time difference cannot become null. */ - unsigned long const new_factor = - (unsigned long)((Timestamp)ts_diff_shifted / us_diff); + uint64_t const new_factor = + (uint64_t)((Timestamp)ts_diff_shifted / us_diff); /* update interpolation-quality value */ if (old_factor > new_factor) { _update_interpolation_quality(new_factor, old_factor); } @@ -187,15 +187,15 @@ Duration Timer::Connection::curr_time() if (_interpolation_quality == MAX_INTERPOLATION_QUALITY) { /* buffer interpolation related members and free the lock */ - Timestamp const ts = _ts; - unsigned long const us_to_ts_factor = _us_to_ts_factor; - unsigned const us_to_ts_factor_shift = _us_to_ts_factor_shift; + Timestamp const ts = _ts; + uint64_t const us_to_ts_factor = _us_to_ts_factor; + unsigned const us_to_ts_factor_shift = _us_to_ts_factor_shift; lock_guard.destruct(); /* interpolate time difference since the last real time update */ - Timestamp const ts_diff = _timestamp() - ts; - unsigned long const us_diff = _ts_to_us_ratio(ts_diff, us_to_ts_factor, + Timestamp const ts_diff = _timestamp() - ts; + uint64_t const us_diff = _ts_to_us_ratio(ts_diff, us_to_ts_factor, us_to_ts_factor_shift); interpolated_time.add(Microseconds(us_diff)); diff --git a/repos/base/src/test/timer/main.cc b/repos/base/src/test/timer/main.cc index 87c42465e..9040c23b8 100644 --- a/repos/base/src/test/timer/main.cc +++ b/repos/base/src/test/timer/main.cc @@ -99,10 +99,10 @@ struct Stress_test Signal_handler timer_handler; Timer::Connection timer; - unsigned long us; + uint64_t us; unsigned count { 0 }; - Slave(Env &env, unsigned us) + Slave(Env &env, uint64_t us) : timer_handler(env.ep(), *this, &Slave::handle_timer), timer(env), us(us) { timer.sigh(timer_handler); } @@ -119,7 +119,7 @@ struct Stress_test log("timer (period ", us, " us) triggered ", count, " times (min ", (unsigned)MIN_CNT, " max ", (unsigned)MAX_CNT, ") -> slept ", - ((unsigned long)us * count) / 1000, " ms"); + ((uint64_t)us * count) / 1000, " ms"); /* detect starvation of timeouts */ if (count < MIN_CNT) { @@ -151,8 +151,8 @@ struct Stress_test { if (count < DURATION_SEC) { count++; - log("wait ", count, "/", (unsigned)DURATION_SEC); - timer.trigger_once(1000UL * 1000); + log("wait ", count, "/", (uint64_t)DURATION_SEC); + timer.trigger_once((uint64_t)1000 * 1000); } else { unsigned starvation = 0; unsigned rate_violation = 0; @@ -175,13 +175,13 @@ struct Stress_test { timer.sigh(handler); - for (unsigned long us_1 = 1; us_1 < MAX_SLV_PERIOD_US; us_1 *= 2) { + for (uint64_t us_1 = 1; us_1 < MAX_SLV_PERIOD_US; us_1 *= 2) { new (heap) Registered(slaves, env, us_1 - us_1 / 3); new (heap) Registered(slaves, env, us_1); } slaves.for_each([&] (Slave &slv) { slv.start(); }); - timer.trigger_once(1000 * 1000); + timer.trigger_once((uint64_t)1000 * 1000); } ~Stress_test() { diff --git a/repos/base/src/test/timer_accuracy/main.cc b/repos/base/src/test/timer_accuracy/main.cc index 46c6eeae9..f2e4f147a 100644 --- a/repos/base/src/test/timer_accuracy/main.cc +++ b/repos/base/src/test/timer_accuracy/main.cc @@ -23,7 +23,7 @@ struct Main { Timer::Connection timer; Signal_handler
timer_handler; - unsigned duration_us { 0 }; + uint64_t duration_us { 0 }; void handle_timer() { diff --git a/repos/base/src/timer/fiasco/time_source.cc b/repos/base/src/timer/fiasco/time_source.cc index 885b91386..7737f4639 100644 --- a/repos/base/src/timer/fiasco/time_source.cc +++ b/repos/base/src/timer/fiasco/time_source.cc @@ -41,16 +41,17 @@ namespace Fiasco { using namespace Fiasco; using Microseconds = Genode::Microseconds; using Duration = Genode::Duration; +using Genode::uint64_t; -static l4_timeout_s mus_to_timeout(unsigned long mus) +static l4_timeout_s mus_to_timeout(uint64_t mus) { if (mus == 0) return L4_IPC_TIMEOUT_0; - else if (mus == ~0UL) + else if (mus == ~(uint64_t)0) return L4_IPC_TIMEOUT_NEVER; - long e = Genode::log2(mus) - 7; + long e = Genode::log2((unsigned long)mus) - 7; unsigned long m; if (e < 0) e = 0; m = mus / (1UL << e); @@ -89,5 +90,5 @@ Duration Timer::Time_source::curr_time() } -void Timer::Time_source::_usleep(unsigned long usecs) { +void Timer::Time_source::_usleep(uint64_t usecs) { l4_ipc_sleep(l4_timeout(L4_IPC_TIMEOUT_NEVER, mus_to_timeout(usecs))); } diff --git a/repos/base/src/timer/include/session_component.h b/repos/base/src/timer/include/session_component.h index 6fd53b1fb..4ace282bf 100644 --- a/repos/base/src/timer/include/session_component.h +++ b/repos/base/src/timer/include/session_component.h @@ -25,6 +25,7 @@ namespace Timer { + using Genode::uint64_t; using Microseconds = Genode::Microseconds; using Duration = Genode::Duration; class Session_component; @@ -43,7 +44,7 @@ class Timer::Session_component : public Genode::Rpc_object, Genode::Timeout_scheduler &_timeout_scheduler; Genode::Signal_context_capability _sigh { }; - unsigned long const _init_time_us = + uint64_t const _init_time_us = _timeout_scheduler.curr_time().trunc_to_plain_us().value; void handle_timeout(Duration) override { @@ -59,7 +60,7 @@ class Timer::Session_component : public Genode::Rpc_object, ** Timer::Session ** ********************/ - void trigger_once(unsigned us) override { + void trigger_once(uint64_t us) override { /* * FIXME Workaround for the problem that Alarm scheduler may @@ -70,11 +71,11 @@ class Timer::Session_component : public Genode::Rpc_object, * Alarm framework takes solely relative time values, please * remove this. */ - Microseconds typed_us((us > ~0U >> 1) ? ~0U >> 1 : us); + Microseconds typed_us((us > ~(uint64_t)0 >> 1) ? ~(uint64_t)0 >> 1 : us); _timeout.schedule_one_shot(typed_us, *this); } - void trigger_periodic(unsigned us) override { + void trigger_periodic(uint64_t us) override { _timeout.schedule_periodic(Microseconds(us), *this); } void sigh(Signal_context_capability sigh) override @@ -84,15 +85,15 @@ class Timer::Session_component : public Genode::Rpc_object, _timeout.discard(); } - unsigned long elapsed_ms() const override { + uint64_t elapsed_ms() const override { return elapsed_us() / 1000; } - unsigned long elapsed_us() const override { + uint64_t elapsed_us() const override { return _timeout_scheduler.curr_time().trunc_to_plain_us().value - _init_time_us; } - void msleep(unsigned) override { /* never called at the server side */ } - void usleep(unsigned) override { /* never called at the server side */ } + void msleep(uint64_t) override { /* never called at the server side */ } + void usleep(uint64_t) override { /* never called at the server side */ } }; #endif /* _SESSION_COMPONENT_ */ diff --git a/repos/base/src/timer/periodic/time_source.cc b/repos/base/src/timer/periodic/time_source.cc index 0a67971e2..b1fd9c118 100644 --- a/repos/base/src/timer/periodic/time_source.cc +++ b/repos/base/src/timer/periodic/time_source.cc @@ -29,8 +29,8 @@ void Timer::Time_source::schedule_timeout(Microseconds duration, void Timer::Time_source::_wait_for_irq() { - enum { SLEEP_GRANULARITY_US = 1000UL }; - unsigned long last_time_us = curr_time().trunc_to_plain_us().value; + enum { SLEEP_GRANULARITY_US = 1000 }; + uint64_t last_time_us = curr_time().trunc_to_plain_us().value; _lock.lock(); while (_next_timeout_us > 0) { _lock.unlock(); @@ -38,8 +38,8 @@ void Timer::Time_source::_wait_for_irq() try { _usleep(SLEEP_GRANULARITY_US); } catch (Blocking_canceled) { } - unsigned long curr_time_us = curr_time().trunc_to_plain_us().value; - unsigned long sleep_duration_us = curr_time_us - last_time_us; + uint64_t curr_time_us = curr_time().trunc_to_plain_us().value; + uint64_t sleep_duration_us = curr_time_us - last_time_us; last_time_us = curr_time_us; _lock.lock(); diff --git a/repos/base/src/timer/periodic/time_source.h b/repos/base/src/timer/periodic/time_source.h index 646d45487..e6e2cf89f 100644 --- a/repos/base/src/timer/periodic/time_source.h +++ b/repos/base/src/timer/periodic/time_source.h @@ -18,7 +18,11 @@ /* local includes */ #include -namespace Timer { class Time_source; } +namespace Timer { + + using Genode::uint64_t; + class Time_source; +} class Timer::Time_source : public Threaded_time_source @@ -28,10 +32,10 @@ class Timer::Time_source : public Threaded_time_source Genode::Env &_env; Genode::Lock mutable _lock { }; - unsigned long _curr_time_us = 0; - unsigned long _next_timeout_us = max_timeout().value; + uint64_t _curr_time_us = 0; + uint64_t _next_timeout_us = max_timeout().value; - void _usleep(unsigned long us); + void _usleep(uint64_t us); /************************** diff --git a/repos/base/src/timer/pit/time_source.cc b/repos/base/src/timer/pit/time_source.cc index 60644a675..be9302aa1 100644 --- a/repos/base/src/timer/pit/time_source.cc +++ b/repos/base/src/timer/pit/time_source.cc @@ -53,7 +53,7 @@ void Timer::Time_source::schedule_timeout(Microseconds duration, Timeout_handler &handler) { _handler = &handler; - unsigned long duration_us = duration.value; + uint64_t duration_us = duration.value; /* timeout '0' is trigger to cancel the current pending, if required */ if (!duration.value) { @@ -62,8 +62,8 @@ void Timer::Time_source::schedule_timeout(Microseconds duration, } else { /* limit timer-interrupt rate */ enum { MAX_TIMER_IRQS_PER_SECOND = 4*1000 }; - if (duration_us < 1000 * 1000 / MAX_TIMER_IRQS_PER_SECOND) - duration_us = 1000 * 1000 / MAX_TIMER_IRQS_PER_SECOND; + if (duration_us < (uint64_t)1000 * 1000 / MAX_TIMER_IRQS_PER_SECOND) + duration_us = (uint64_t)1000 * 1000 / MAX_TIMER_IRQS_PER_SECOND; if (duration_us > max_timeout().value) duration_us = max_timeout().value; diff --git a/repos/base/src/timer/pit/time_source.h b/repos/base/src/timer/pit/time_source.h index 9bad5aa98..74d9e07e3 100644 --- a/repos/base/src/timer/pit/time_source.h +++ b/repos/base/src/timer/pit/time_source.h @@ -25,6 +25,7 @@ namespace Timer { + using Genode::uint64_t; using Microseconds = Genode::Microseconds; using Duration = Genode::Duration; class Time_source; @@ -70,7 +71,7 @@ class Timer::Time_source : public Genode::Signalled_time_source Genode::Io_port_connection _io_port; Genode::Irq_connection _timer_irq; - unsigned long mutable _curr_time_us = 0; + uint64_t mutable _curr_time_us = 0; Genode::uint16_t mutable _counter_init_value = 0; bool mutable _handled_wrap = false; diff --git a/repos/dde_bsd/src/lib/audio/timer.cc b/repos/dde_bsd/src/lib/audio/timer.cc index 764ccf1a2..77e5a50c9 100644 --- a/repos/dde_bsd/src/lib/audio/timer.cc +++ b/repos/dde_bsd/src/lib/audio/timer.cc @@ -25,7 +25,7 @@ #include -static unsigned long millisecs; +static Genode::uint64_t millisecs; namespace Bsd { @@ -71,7 +71,7 @@ class Bsd::Timer millisecs = _timer_conn.elapsed_ms(); } - void delay(unsigned ms) + void delay(Genode::uint64_t ms) { _timer_conn.msleep(ms); } @@ -88,7 +88,7 @@ void Bsd::timer_init(Genode::Env &env) _bsd_timer = &bsd_timer; /* initialize value explicitly */ - millisecs = 0UL; + millisecs = 0; } diff --git a/repos/dde_linux/src/drivers/framebuffer/intel/include/component.h b/repos/dde_linux/src/drivers/framebuffer/intel/include/component.h index b3916c5b9..58254da2b 100644 --- a/repos/dde_linux/src/drivers/framebuffer/intel/include/component.h +++ b/repos/dde_linux/src/drivers/framebuffer/intel/include/component.h @@ -51,7 +51,7 @@ class Framebuffer::Driver Timer::Connection _timer; Genode::Reporter _reporter; Genode::Signal_handler _poll_handler; - unsigned long _poll_ms = 0; + Genode::uint64_t _poll_ms = 0; Genode::Signal_context_capability _config_sigh; @@ -74,7 +74,7 @@ class Framebuffer::Driver unsigned pitch() const { return _config._lx.pitch; } void finish_initialization(); - void set_polling(unsigned long poll); + void set_polling(Genode::uint64_t poll); void update_mode(); void generate_report(); @@ -117,8 +117,8 @@ class Framebuffer::Session_component : public Genode::Rpc_object Genode::Attached_ram_dataspace _ds; bool _in_mode_change = true; - unsigned long _polling_from_config() { - return _config.xml().attribute_value("poll", 0); } + Genode::uint64_t _polling_from_config() { + return _config.xml().attribute_value("poll", 0); } public: diff --git a/repos/dde_linux/src/drivers/framebuffer/intel/lx_emul.cc b/repos/dde_linux/src/drivers/framebuffer/intel/lx_emul.cc index 604ee1f2c..b2d2072cb 100644 --- a/repos/dde_linux/src/drivers/framebuffer/intel/lx_emul.cc +++ b/repos/dde_linux/src/drivers/framebuffer/intel/lx_emul.cc @@ -170,7 +170,7 @@ void Framebuffer::Driver::_poll() } -void Framebuffer::Driver::set_polling(unsigned long poll) +void Framebuffer::Driver::set_polling(Genode::uint64_t poll) { if (poll == _poll_ms) return; diff --git a/repos/dde_linux/src/drivers/wifi/frontend.h b/repos/dde_linux/src/drivers/wifi/frontend.h index 8de545cab..c4721fd6d 100644 --- a/repos/dde_linux/src/drivers/wifi/frontend.h +++ b/repos/dde_linux/src/drivers/wifi/frontend.h @@ -368,8 +368,8 @@ struct Wifi::Frontend bool _deferred_config_update { false }; bool _single_autoconnect { false }; - unsigned _connected_scan_interval { 30 }; - unsigned _scan_interval { 5 }; + Genode::uint64_t _connected_scan_interval { 30 }; + Genode::uint64_t _scan_interval { 5 }; void _config_update(bool signal) { @@ -385,12 +385,12 @@ struct Wifi::Frontend /* only evaluated at start-up */ _use_11n = config.attribute_value("use_11n", _use_11n); - unsigned connected_scan_interval = + Genode::uint64_t connected_scan_interval = Util::check_time(config.attribute_value("connected_scan_interval", _connected_scan_interval), 0, 15*60); - unsigned scan_interval = + Genode::uint64_t scan_interval = Util::check_time(config.attribute_value("scan_interval", _scan_interval), 5, 15*60); @@ -699,7 +699,7 @@ struct Wifi::Frontend bool _arm_scan_timer(bool connected) { - unsigned const sec = connected ? _connected_scan_interval : _scan_interval; + Genode::uint64_t const sec = connected ? _connected_scan_interval : _scan_interval; if (!sec) { return false; } if (_verbose) { diff --git a/repos/dde_linux/src/drivers/wifi/util.h b/repos/dde_linux/src/drivers/wifi/util.h index f5d07dda6..1cdb40d65 100644 --- a/repos/dde_linux/src/drivers/wifi/util.h +++ b/repos/dde_linux/src/drivers/wifi/util.h @@ -78,7 +78,7 @@ namespace Util { return 2 * (level + 100); } - inline unsigned check_time(unsigned value, unsigned min, unsigned max) + inline Genode::uint64_t check_time(Genode::uint64_t value, Genode::uint64_t min, Genode::uint64_t max) { if (value < min) { return min; } else if (value > max) { return max; } diff --git a/repos/dde_linux/src/include/lx_emul/jiffies.h b/repos/dde_linux/src/include/lx_emul/jiffies.h index 0bb124696..8889936a2 100644 --- a/repos/dde_linux/src/include/lx_emul/jiffies.h +++ b/repos/dde_linux/src/include/lx_emul/jiffies.h @@ -19,6 +19,8 @@ ** linux/jiffies.h ** *********************/ +#include + #define MAX_JIFFY_OFFSET ((LONG_MAX >> 1)-1) extern unsigned long jiffies; @@ -29,11 +31,11 @@ enum { JIFFIES_TICK_NS = 1000ULL*1000*1000/HZ, }; -static inline unsigned long msecs_to_jiffies(const unsigned int m) { return m / JIFFIES_TICK_MS; } -static inline unsigned long usecs_to_jiffies(const unsigned int u) { return u / JIFFIES_TICK_US; } +static inline unsigned long msecs_to_jiffies(const genode_uint64_t m) { return m / JIFFIES_TICK_MS; } +static inline unsigned long usecs_to_jiffies(const genode_uint64_t u) { return u / JIFFIES_TICK_US; } -static inline unsigned int jiffies_to_msecs(const unsigned long j) { return j * JIFFIES_TICK_MS; } -static inline u64 jiffies_to_nsecs(const unsigned long j) { return (u64)j * JIFFIES_TICK_NS; } +static inline genode_uint64_t jiffies_to_msecs(const unsigned long j) { return j * JIFFIES_TICK_MS; } +static inline genode_uint64_t jiffies_to_nsecs(const unsigned long j) { return (u64)j * JIFFIES_TICK_NS; } clock_t jiffies_to_clock_t(unsigned long x); static inline clock_t jiffies_delta_to_clock_t(long delta) diff --git a/repos/dde_linux/src/include/lx_kit/timer.h b/repos/dde_linux/src/include/lx_kit/timer.h index aaa539d8e..09e0f3fb8 100644 --- a/repos/dde_linux/src/include/lx_kit/timer.h +++ b/repos/dde_linux/src/include/lx_kit/timer.h @@ -86,7 +86,7 @@ class Lx::Timer /** * Suspend calling thread */ - virtual void usleep(unsigned us) = 0; + virtual void usleep(Genode::uint64_t us) = 0; }; diff --git a/repos/dde_linux/src/lib/lxip/timer_handler.cc b/repos/dde_linux/src/lib/lxip/timer_handler.cc index 45e8bb28f..06b8f7161 100644 --- a/repos/dde_linux/src/lib/lxip/timer_handler.cc +++ b/repos/dde_linux/src/lib/lxip/timer_handler.cc @@ -127,8 +127,8 @@ class Lx::Timer return; /* calculate relative microseconds for trigger */ - unsigned long us = ctx->timeout > jiffies ? - jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0; + Genode::uint64_t us = ctx->timeout > jiffies ? + (Genode::uint64_t)jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0; _timers_one_shot.schedule(Genode::Microseconds{us}); } diff --git a/repos/dde_linux/src/lx_kit/scheduler.cc b/repos/dde_linux/src/lx_kit/scheduler.cc index 4a4d0b1d8..e8ae8f3ce 100644 --- a/repos/dde_linux/src/lx_kit/scheduler.cc +++ b/repos/dde_linux/src/lx_kit/scheduler.cc @@ -69,12 +69,12 @@ class Lx_kit::Scheduler : public Lx::Scheduler struct Logger : Genode::Thread { - Timer::Connection _timer; - Lx::Scheduler &_scheduler; - unsigned const _interval; + Timer::Connection _timer; + Lx::Scheduler &_scheduler; + Genode::uint64_t const _interval; Logger(Genode::Env &env, Lx::Scheduler &scheduler, - unsigned interval_seconds) + Genode::uint64_t interval_seconds) : Genode::Thread(env, "logger", 0x4000), _timer(env), _scheduler(scheduler), diff --git a/repos/dde_linux/src/lx_kit/timer.cc b/repos/dde_linux/src/lx_kit/timer.cc index 86f9da93a..705c24aa2 100644 --- a/repos/dde_linux/src/lx_kit/timer.cc +++ b/repos/dde_linux/src/lx_kit/timer.cc @@ -114,8 +114,8 @@ class Lx_kit::Timer : public Lx::Timer return; /* calculate relative microseconds for trigger */ - unsigned long us = ctx->timeout > _jiffies ? - jiffies_to_msecs(ctx->timeout - _jiffies) * 1000 : 0; + Genode::uint64_t us = ctx->timeout > _jiffies ? + (Genode::uint64_t)jiffies_to_msecs(ctx->timeout - _jiffies) * 1000 : 0; _timer_conn.trigger_once(us); } @@ -290,10 +290,10 @@ class Lx_kit::Timer : public Lx::Timer * Do not use lx_emul usecs_to_jiffies(unsigned int) because * of implicit truncation! */ - _jiffies = _timer_conn_modern.curr_time().trunc_to_plain_ms().value / JIFFIES_TICK_MS; + _jiffies = (Genode::uint64_t)_timer_conn_modern.curr_time().trunc_to_plain_ms().value / JIFFIES_TICK_MS; } - void usleep(unsigned us) { + void usleep(Genode::uint64_t us) { _timer_conn.usleep(us); } }; diff --git a/repos/dde_linux/src/test/framebuffer/intel/main.cc b/repos/dde_linux/src/test/framebuffer/intel/main.cc index ece87771d..e786b73f4 100644 --- a/repos/dde_linux/src/test/framebuffer/intel/main.cc +++ b/repos/dde_linux/src/test/framebuffer/intel/main.cc @@ -50,7 +50,7 @@ struct Framebuffer_controller timer_handler(env.ep(), *this, &Framebuffer_controller::handle_timer) { Attached_rom_dataspace config(env, "config"); - unsigned long const period_ms = config.xml().attribute_value("artifical_update_ms", 0UL); + Genode::uint64_t const period_ms = config.xml().attribute_value("artifical_update_ms", (Genode::uint64_t)0); rom.sigh(rom_sigh); diff --git a/repos/dde_rump/include/rump/timed_semaphore.h b/repos/dde_rump/include/rump/timed_semaphore.h index e9bcc322f..e076a76d5 100644 --- a/repos/dde_rump/include/rump/timed_semaphore.h +++ b/repos/dde_rump/include/rump/timed_semaphore.h @@ -171,7 +171,7 @@ class Timed_semaphore : public Semaphore protected: - bool on_alarm(unsigned) override + bool on_alarm(Genode::uint64_t) override { _triggered = _sem._abort(_element); return false; diff --git a/repos/dde_rump/src/lib/rump/hypercall.cc b/repos/dde_rump/src/lib/rump/hypercall.cc index 8a15a8584..1e954adfc 100644 --- a/repos/dde_rump/src/lib/rump/hypercall.cc +++ b/repos/dde_rump/src/lib/rump/hypercall.cc @@ -311,7 +311,7 @@ void rumpuser_free(void *mem, size_t len) int rumpuser_clock_gettime(int enum_rumpclock, int64_t *sec, long *nsec) { Hard_context *h = myself(); - unsigned long t = h->timer().elapsed_ms(); + Genode::uint64_t t = h->timer().elapsed_ms(); *sec = (int64_t)t / 1000; *nsec = (t % 1000) * 1000; return 0; @@ -321,18 +321,18 @@ int rumpuser_clock_gettime(int enum_rumpclock, int64_t *sec, long *nsec) int rumpuser_clock_sleep(int enum_rumpclock, int64_t sec, long nsec) { int nlocks; - unsigned int msec = 0; + Genode::uint64_t msec = 0; Timer::Connection &timer = myself()->timer(); rumpkern_unsched(&nlocks, 0); switch (enum_rumpclock) { case RUMPUSER_CLOCK_RELWALL: - msec = sec * 1000 + nsec / (1000*1000UL); + msec = (Genode::uint64_t)sec * 1000 + nsec / (1000*1000UL); break; case RUMPUSER_CLOCK_ABSMONO: msec = timer.elapsed_ms(); - msec = ((sec * 1000) + (nsec / (1000 * 1000))) - msec; + msec = (((Genode::uint64_t)sec * 1000) + ((Genode::uint64_t)nsec / (1000 * 1000))) - msec; break; } diff --git a/repos/dde_rump/src/server/rump_fs/file_system.cc b/repos/dde_rump/src/server/rump_fs/file_system.cc index de5f4c93e..9d4e427dd 100644 --- a/repos/dde_rump/src/server/rump_fs/file_system.cc +++ b/repos/dde_rump/src/server/rump_fs/file_system.cc @@ -11,7 +11,6 @@ * under the terms of the GNU Affero General Public License version 3. */ -#include "file_system.h" #include #include @@ -20,6 +19,8 @@ #include #include +#include "file_system.h" + /** * We define our own fs arg structure to fit all sizes used by the different * file system implementations, we assume that 'fspec' * is the only valid diff --git a/repos/dde_rump/src/server/rump_fs/main.cc b/repos/dde_rump/src/server/rump_fs/main.cc index 924999bf9..6d17e2645 100644 --- a/repos/dde_rump/src/server/rump_fs/main.cc +++ b/repos/dde_rump/src/server/rump_fs/main.cc @@ -13,9 +13,9 @@ */ /* Genode includes */ +#include #include #include -#include #include #include #include @@ -30,6 +30,7 @@ #include "directory.h" #include "open_node.h" + namespace Rump_fs { using File_system::Packet_descriptor; diff --git a/repos/demo/include/scout/platform.h b/repos/demo/include/scout/platform.h index d7d4034d8..4cbf1ca57 100644 --- a/repos/demo/include/scout/platform.h +++ b/repos/demo/include/scout/platform.h @@ -63,7 +63,7 @@ class Scout::Platform Timer::Connection _timer { _env }; - unsigned long _ticks = 0; + Genode::uint64_t _ticks = 0; void _handle_timer() { @@ -128,7 +128,7 @@ class Scout::Platform /** * Get timer ticks in miilliseconds */ - unsigned long timer_ticks() const { return _ticks; } + Genode::uint64_t timer_ticks() const { return _ticks; } /** * Register event handler diff --git a/repos/demo/src/app/launchpad/main.cc b/repos/demo/src/app/launchpad/main.cc index 20e88070d..a7ca60c25 100644 --- a/repos/demo/src/app/launchpad/main.cc +++ b/repos/demo/src/app/launchpad/main.cc @@ -130,7 +130,7 @@ struct Main : Scout::Event_handler bool const _launchpad_initialized = (_init_launchpad(), true); - unsigned long _old_time = _platform.timer_ticks(); + Genode::uint64_t _old_time = _platform.timer_ticks(); void handle_event(Scout::Event const &event) override { @@ -147,7 +147,7 @@ struct Main : Scout::Event_handler Tick::handle(_platform.timer_ticks()); /* perform periodic redraw */ - unsigned long const curr_time = _platform.timer_ticks(); + Genode::uint64_t const curr_time = _platform.timer_ticks(); if (!_platform.event_pending() && ((curr_time - _old_time > 20) || (curr_time < _old_time))) { _old_time = curr_time; diff --git a/repos/demo/src/app/scout/main.cc b/repos/demo/src/app/scout/main.cc index 9488deb19..8e4ba321b 100644 --- a/repos/demo/src/app/scout/main.cc +++ b/repos/demo/src/app/scout/main.cc @@ -121,7 +121,7 @@ struct Scout::Main : Scout::Event_handler Scout::Point _mouse_position { }; - unsigned long _old_time = _platform.timer_ticks(); + Genode::uint64_t _old_time = _platform.timer_ticks(); void handle_event(Scout::Event const &event) override { @@ -156,7 +156,7 @@ struct Scout::Main : Scout::Event_handler Tick::handle(_platform.timer_ticks()); /* perform periodic redraw */ - unsigned long curr_time = _platform.timer_ticks(); + Genode::uint64_t curr_time = _platform.timer_ticks(); if (!_platform.event_pending() && ((curr_time - _old_time > 20) || (curr_time < _old_time))) { _old_time = curr_time; diff --git a/repos/demo/src/server/liquid_framebuffer/main.cc b/repos/demo/src/server/liquid_framebuffer/main.cc index 22b63a71d..17d167eab 100644 --- a/repos/demo/src/server/liquid_framebuffer/main.cc +++ b/repos/demo/src/server/liquid_framebuffer/main.cc @@ -199,8 +199,8 @@ class Liquid_fb::Main : public Scout::Event_handler bool _services_initialized = (init_services(_env, _input_session_component), true); - unsigned long _curr_time = _platform.timer_ticks(); - unsigned long _old_time = _curr_time; + Genode::uint64_t _curr_time = _platform.timer_ticks(); + Genode::uint64_t _old_time = _curr_time; void _handle_config() { diff --git a/repos/gems/include/nano3d/scene.h b/repos/gems/include/nano3d/scene.h index ae1229e2f..18b71504b 100644 --- a/repos/gems/include/nano3d/scene.h +++ b/repos/gems/include/nano3d/scene.h @@ -280,7 +280,7 @@ class Nano3d::Scene public: - Scene(Genode::Env &env, unsigned update_rate_ms, + Scene(Genode::Env &env, Genode::uint64_t update_rate_ms, Nitpicker::Point pos, Nitpicker::Area size) : _env(env), _pos(pos), _size(size) @@ -302,7 +302,7 @@ class Nano3d::Scene virtual ~Scene() { } - unsigned long elapsed_ms() const { return _timer.elapsed_ms(); } + Genode::uint64_t elapsed_ms() const { return _timer.elapsed_ms(); } void input_handler(Input_handler *input_handler) { diff --git a/repos/gems/src/app/cpu_load_display/main.cc b/repos/gems/src/app/cpu_load_display/main.cc index 45a70e907..aecd2c545 100644 --- a/repos/gems/src/app/cpu_load_display/main.cc +++ b/repos/gems/src/app/cpu_load_display/main.cc @@ -317,7 +317,7 @@ class Cpu_load_display::Scene : public Nano3d::Scene public: - Scene(Genode::Env &env, unsigned update_rate_ms, + Scene(Genode::Env &env, Genode::uint64_t update_rate_ms, Nitpicker::Point pos, Nitpicker::Area size) : Nano3d::Scene(env, update_rate_ms, pos, size), diff --git a/repos/gems/src/app/depot_autopilot/child.cc b/repos/gems/src/app/depot_autopilot/child.cc index 1a8c92676..8b4149941 100644 --- a/repos/gems/src/app/depot_autopilot/child.cc +++ b/repos/gems/src/app/depot_autopilot/child.cc @@ -17,10 +17,10 @@ using namespace Depot_deploy; -static void forward_to_log(unsigned long const sec, - unsigned long const ms, - char const *const base, - char const *const end) +static void forward_to_log(Genode::uint64_t const sec, + Genode::uint64_t const ms, + char const *const base, + char const *const end) { log(sec, ".", ms < 10 ? "00" : ms < 100 ? "0" : "", ms, " ", Cstring(base, end - base)); @@ -152,7 +152,7 @@ void Child::gen_start_node(Xml_generator &xml, if (_running) { return; } - unsigned long max_timeout_sec = 0; + Genode::uint64_t max_timeout_sec = 0; try { Xml_node const events = _pkg_xml->xml().sub_node("runtime").sub_node("events"); events.for_each_sub_node("timeout", [&] (Xml_node const &event) { @@ -431,9 +431,9 @@ void Child::log_session_write(Log_event::Line const &log_line) }; /* calculate timestamp that prefixes*/ - unsigned long const time_us { _timer.curr_time().trunc_to_plain_us().value - init_time_us }; - unsigned long time_ms { time_us / 1000UL }; - unsigned long const time_sec { time_ms / 1000UL }; + Genode::uint64_t const time_us { _timer.curr_time().trunc_to_plain_us().value - init_time_us }; + Genode::uint64_t time_ms { time_us / 1000UL }; + Genode::uint64_t const time_sec { time_ms / 1000UL }; time_ms = time_ms - time_sec * 1000UL; char const *const log_base { log_line.string() }; @@ -765,8 +765,8 @@ void Child::gen_installation_entry(Xml_generator &xml) const } -void Child::event_occured(Event const &event, - unsigned long const time_us) +void Child::event_occured(Event const &event, + Genode::uint64_t const time_us) { if (_skip) { return; } @@ -779,9 +779,9 @@ void Child::event_occured(Event const &event, } -void Child::_finished(State state, - Event const &event, - unsigned long const time_us) +void Child::_finished(State state, + Event const &event, + Genode::uint64_t const time_us) { if (_skip) { return; } @@ -789,8 +789,8 @@ void Child::_finished(State state, _running = false; _state = state; - unsigned long time_ms { time_us / 1000UL }; - unsigned long const time_sec { time_ms / 1000UL }; + Genode::uint64_t time_ms { time_us / 1000UL }; + Genode::uint64_t const time_sec { time_ms / 1000UL }; time_ms = time_ms - time_sec * 1000UL; char name_padded[32]; @@ -855,7 +855,7 @@ Timeout_event::Timeout_event(Timer::Connection &timer, Event { event, Type::TIMEOUT }, _child { child }, _timer { timer }, - _sec { event.attribute_value("sec", 0UL) }, + _sec { event.attribute_value("sec", (Genode::uint64_t)0) }, _timeout { timer, *this, &Timeout_event::_handle_timeout } { if (!_sec) { diff --git a/repos/gems/src/app/depot_autopilot/child.h b/repos/gems/src/app/depot_autopilot/child.h index 0e90c3dd6..276dc39a0 100644 --- a/repos/gems/src/app/depot_autopilot/child.h +++ b/repos/gems/src/app/depot_autopilot/child.h @@ -119,7 +119,7 @@ class Depot_deploy::Timeout_event : public Event, Child &_child; Timer::Connection &_timer; - unsigned long const _sec; + Genode::uint64_t const _sec; Timer::One_shot_timeout _timeout; void _handle_timeout(Duration); @@ -136,7 +136,7 @@ class Depot_deploy::Timeout_event : public Event, ** Accessors ** ***************/ - unsigned long sec() const { return _sec; } + Genode::uint64_t sec() const { return _sec; } }; @@ -206,15 +206,15 @@ class Depot_deploy::Child : public List_model::Element Xml_node from_node, Xml_node::Type const &sub_node_type); - void _finished(State state, - Event const &event, - unsigned long const time_us); + void _finished(State state, + Event const &event, + Genode::uint64_t const time_us); State_name _padded_state_name() const; public: - unsigned long init_time_us { 0 }; + Genode::uint64_t init_time_us { 0 }; Child(Genode::Allocator &alloc, Genode::Xml_node start_node, @@ -229,8 +229,8 @@ class Depot_deploy::Child : public List_model::Element void conclusion(Result &result); - void event_occured(Event const &event, - unsigned long const time_us); + void event_occured(Event const &event, + Genode::uint64_t const time_us); void apply_config(Xml_node start_node); diff --git a/repos/gems/src/app/depot_autopilot/main.cc b/repos/gems/src/app/depot_autopilot/main.cc index 76bd74695..17a9b8f93 100644 --- a/repos/gems/src/app/depot_autopilot/main.cc +++ b/repos/gems/src/app/depot_autopilot/main.cc @@ -156,18 +156,18 @@ struct Depot_deploy::Main if (finished) { Result result; - unsigned long previous_time_sec { 0UL }; + Genode::uint64_t previous_time_sec { 0 }; if (config.has_sub_node("previous-results")) { Xml_node const previous_results = config.sub_node("previous-results"); - previous_time_sec += previous_results.attribute_value("time_sec", 0UL); + previous_time_sec += previous_results.attribute_value("time_sec", (Genode::uint64_t)0); result.succeeded += previous_results.attribute_value("succeeded", 0UL); result.failed += previous_results.attribute_value("failed", 0UL); result.skipped += previous_results.attribute_value("skipped", 0UL); } - unsigned long const time_us { _timer.curr_time().trunc_to_plain_us().value }; - unsigned long time_ms { time_us / 1000UL }; - unsigned long const time_sec { time_ms / 1000UL }; - time_ms = time_ms - time_sec * 1000UL; + Genode::uint64_t const time_us { _timer.curr_time().trunc_to_plain_us().value }; + Genode::uint64_t time_ms { time_us / 1000 }; + Genode::uint64_t const time_sec { time_ms / 1000 }; + time_ms = time_ms - time_sec * 1000; _children.conclusion(result); int exit_code = result.failed ? -1 : 0; diff --git a/repos/gems/src/app/depot_download_manager/main.cc b/repos/gems/src/app/depot_download_manager/main.cc index fde31cd62..a3adc27be 100644 --- a/repos/gems/src/app/depot_download_manager/main.cc +++ b/repos/gems/src/app/depot_download_manager/main.cc @@ -249,7 +249,7 @@ struct Depot_download_manager::Main : Import::Download_progress Fetchurl_watchdog(Main &main) : _main(main) { _timer.sigh(_handler); - _timer.trigger_periodic(PERIOD_SECONDS*1000*1000); + _timer.trigger_periodic((Genode::uint64_t)PERIOD_SECONDS*1000*1000); } }; diff --git a/repos/gems/src/app/launcher/panel_dialog.h b/repos/gems/src/app/launcher/panel_dialog.h index 19e86c8d1..5ee6a684b 100644 --- a/repos/gems/src/app/launcher/panel_dialog.h +++ b/repos/gems/src/app/launcher/panel_dialog.h @@ -403,7 +403,7 @@ class Launcher::Panel_dialog : Input_event_handler, Dialog_generator, * button for a while. */ enum { CONTEXT_DELAY = 500 }; - _timer.trigger_once(CONTEXT_DELAY*1000); + _timer.trigger_once((Genode::uint64_t)CONTEXT_DELAY*1000); } /* diff --git a/repos/gems/src/app/menu_view/main.cc b/repos/gems/src/app/menu_view/main.cc index 778f82466..42b6c1cb6 100644 --- a/repos/gems/src/app/menu_view/main.cc +++ b/repos/gems/src/app/menu_view/main.cc @@ -145,9 +145,9 @@ struct Menu_view::Main { enum { PERIOD = 10 }; - unsigned curr_frame() const { return elapsed_ms() / PERIOD; } + Genode::uint64_t curr_frame() const { return elapsed_ms() / PERIOD; } - void schedule() { trigger_once(Frame_timer::PERIOD*1000); } + void schedule() { trigger_once((Genode::uint64_t)Frame_timer::PERIOD*1000); } Frame_timer(Env &env) : Timer::Connection(env) { } @@ -167,7 +167,7 @@ struct Menu_view::Main /** * Frame of last call of 'handle_frame_timer' */ - unsigned _last_frame = 0; + Genode::uint64_t _last_frame = 0; /** * Number of frames between two redraws @@ -250,7 +250,7 @@ void Menu_view::Main::_handle_dialog_update() * processing immediately. This way, we avoid latencies when the dialog * model is updated sporadically. */ - unsigned const curr_frame = _timer.curr_frame(); + Genode::uint64_t const curr_frame = _timer.curr_frame(); if (curr_frame != _last_frame) { if (curr_frame - _last_frame > 10) @@ -310,15 +310,15 @@ void Menu_view::Main::_handle_frame_timer() { _frame_cnt++; - unsigned const curr_frame = _timer.curr_frame(); + Genode::uint64_t const curr_frame = _timer.curr_frame(); if (_animator.active()) { - unsigned const passed_frames = max(curr_frame - _last_frame, 4U); + Genode::uint64_t const passed_frames = max(curr_frame - _last_frame, 4U); if (passed_frames > 0) { - for (unsigned i = 0; i < passed_frames; i++) + for (Genode::uint64_t i = 0; i < passed_frames; i++) _animator.animate(); _schedule_redraw = true; diff --git a/repos/gems/src/app/nano3d/main.cc b/repos/gems/src/app/nano3d/main.cc index 2d5dafee0..4fa4607d5 100644 --- a/repos/gems/src/app/nano3d/main.cc +++ b/repos/gems/src/app/nano3d/main.cc @@ -103,7 +103,7 @@ class Scene : public Nano3d::Scene public: - Scene(Genode::Env &env, unsigned update_rate_ms, + Scene(Genode::Env &env, Genode::uint64_t update_rate_ms, Nitpicker::Point pos, Nitpicker::Area size) : Nano3d::Scene(env, update_rate_ms, pos, size), diff --git a/repos/gems/src/server/cpu_sampler/main.cc b/repos/gems/src/server/cpu_sampler/main.cc index 50997ff45..72c646cc2 100644 --- a/repos/gems/src/server/cpu_sampler/main.cc +++ b/repos/gems/src/server/cpu_sampler/main.cc @@ -50,7 +50,7 @@ struct Cpu_sampler::Main : Thread_list_change_handler unsigned int sample_index; unsigned int max_sample_index; - unsigned int timeout_us; + Genode::uint64_t timeout_us; void handle_timeout() @@ -87,11 +87,11 @@ struct Cpu_sampler::Main : Thread_list_change_handler sample_index = 0; - unsigned int sample_interval_ms = - config.xml().attribute_value("sample_interval_ms", 1000); + Genode::uint64_t sample_interval_ms = + config.xml().attribute_value("sample_interval_ms", 1000); - unsigned int sample_duration_s = - config.xml().attribute_value("sample_duration_s", 10); + Genode::uint64_t sample_duration_s = + config.xml().attribute_value("sample_duration_s", 10); max_sample_index = ((sample_duration_s * 1000) / sample_interval_ms) - 1; diff --git a/repos/gems/src/server/nit_fader/main.cc b/repos/gems/src/server/nit_fader/main.cc index a1a250b06..94d8dfa05 100644 --- a/repos/gems/src/server/nit_fader/main.cc +++ b/repos/gems/src/server/nit_fader/main.cc @@ -443,9 +443,9 @@ struct Nit_fader::Main unsigned long alpha = 0; - unsigned long curr_frame() const { return timer.elapsed_ms() / PERIOD; } + Genode::uint64_t curr_frame() const { return timer.elapsed_ms() / PERIOD; } - unsigned long last_frame = 0; + Genode::uint64_t last_frame = 0; void handle_config_update(); @@ -463,7 +463,7 @@ struct Nit_fader::Main void handle_timer() { - unsigned long frame = curr_frame(); + Genode::uint64_t frame = curr_frame(); if (nitpicker_session.animate(frame - last_frame)) timer.trigger_once(PERIOD); diff --git a/repos/gems/src/server/terminal/main.cc b/repos/gems/src/server/terminal/main.cc index 48b8185ff..dd520c7bb 100644 --- a/repos/gems/src/server/terminal/main.cc +++ b/repos/gems/src/server/terminal/main.cc @@ -93,7 +93,7 @@ struct Terminal::Main : Character_consumer * update of the pixels. By delaying the update, multiple intermediate * changes result in only one rendering step. */ - unsigned const _flush_delay = 5; + Genode::uint64_t const _flush_delay = 5; bool _flush_scheduled = false; @@ -111,7 +111,7 @@ struct Terminal::Main : Character_consumer void _schedule_flush() { if (!_flush_scheduled) { - _timer.trigger_once(1000*_flush_delay); + _timer.trigger_once((Genode::uint64_t)1000*_flush_delay); _flush_scheduled = true; } } diff --git a/repos/gems/src/test/text_painter/main.cc b/repos/gems/src/test/text_painter/main.cc index d4f2c2bd4..1e39eeaaa 100644 --- a/repos/gems/src/test/text_painter/main.cc +++ b/repos/gems/src/test/text_painter/main.cc @@ -158,7 +158,7 @@ struct Test::Main { Timer::Connection timer(_env); - unsigned long const start_us = timer.elapsed_us(); + Genode::uint64_t const start_us = timer.elapsed_us(); enum { ITERATIONS = 40 }; for (int i = 0; i < ITERATIONS; i++) @@ -168,7 +168,7 @@ struct Test::Main _font_4, Color(150 + i*73, 0, 200), "Glyphs obtained from VFS"); - unsigned long const end_us = timer.elapsed_us(); + Genode::uint64_t const end_us = timer.elapsed_us(); unsigned long num_glyphs = strlen(vfs_text_string)*ITERATIONS; log("uncached painting: ", (float)(end_us - start_us)/num_glyphs, " us/glyph"); @@ -181,7 +181,7 @@ struct Test::Main Timer::Connection timer(_env); - unsigned long const start_us = timer.elapsed_us(); + Genode::uint64_t const start_us = timer.elapsed_us(); /* use less iterations for small cache sizes */ int const iterations = (limit_kib < 100) ? 200 : 2000; @@ -192,7 +192,7 @@ struct Test::Main cached_font, Color(30, limit_kib, 150 + i*73), "Glyphs obtained from VFS"); - unsigned long const end_us = timer.elapsed_us(); + Genode::uint64_t const end_us = timer.elapsed_us(); unsigned long num_glyphs = strlen(vfs_text_string)*iterations; log("cached painting: ", (float)(end_us - start_us)/num_glyphs, " us/glyph" diff --git a/repos/libports/src/lib/libc/nanosleep.cc b/repos/libports/src/lib/libc/nanosleep.cc index 7068abe8c..d32e30449 100644 --- a/repos/libports/src/lib/libc/nanosleep.cc +++ b/repos/libports/src/lib/libc/nanosleep.cc @@ -19,7 +19,7 @@ extern "C" __attribute__((weak)) int _nanosleep(const struct timespec *req, struct timespec *rem) { - unsigned long sleep_ms = req->tv_sec*1000 + req->tv_nsec/1000000; + Genode::uint64_t sleep_ms = (uint64_t)req->tv_sec*1000 + req->tv_nsec/1000000; if (!sleep_ms) return 0; diff --git a/repos/libports/src/lib/libc/select.cc b/repos/libports/src/lib/libc/select.cc index 15cc53f1d..058674923 100644 --- a/repos/libports/src/lib/libc/select.cc +++ b/repos/libports/src/lib/libc/select.cc @@ -262,8 +262,8 @@ _select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, { timeval const *_tv; bool const valid { _tv != nullptr }; - unsigned long duration { - valid ? (unsigned long)_tv->tv_sec*1000 + _tv->tv_usec/1000 : 0UL }; + Genode::uint64_t duration { + valid ? (Genode::uint64_t)_tv->tv_sec*1000 + _tv->tv_usec/1000 : 0UL }; bool expired() const { return valid && duration == 0; }; diff --git a/repos/libports/src/lib/libc/task.cc b/repos/libports/src/lib/libc/task.cc index 827772faf..147dfd47d 100644 --- a/repos/libports/src/lib/libc/task.cc +++ b/repos/libports/src/lib/libc/task.cc @@ -158,12 +158,12 @@ struct Libc::Timer return _timer.curr_time(); } - static Microseconds microseconds(unsigned long timeout_ms) + static Microseconds microseconds(Genode::uint64_t timeout_ms) { return Microseconds(1000*timeout_ms); } - static unsigned long max_timeout() + static Genode::uint64_t max_timeout() { return ~0UL/1000; } @@ -198,8 +198,8 @@ struct Libc::Timeout Timeout_handler &_handler; ::Timer::One_shot_timeout _timeout; - bool _expired = true; - unsigned long _absolute_timeout_ms = 0; + bool _expired = true; + Genode::uint64_t _absolute_timeout_ms = 0; void _handle(Duration now) { @@ -215,7 +215,7 @@ struct Libc::Timeout _timeout(_timer_accessor.timer()._timer, *this, &Timeout::_handle) { } - void start(unsigned long timeout_ms) + void start(Genode::uint64_t timeout_ms) { Milliseconds const now = _timer_accessor.timer().curr_time().trunc_to_plain_ms(); @@ -225,7 +225,7 @@ struct Libc::Timeout _timeout.schedule(_timer_accessor.timer().microseconds(timeout_ms)); } - unsigned long duration_left() const + Genode::uint64_t duration_left() const { Milliseconds const now = _timer_accessor.timer().curr_time().trunc_to_plain_ms(); @@ -253,7 +253,7 @@ struct Libc::Pthreads _timeout.construct(_timer_accessor, *this); } - Pthread(Timer_accessor &timer_accessor, unsigned long timeout_ms) + Pthread(Timer_accessor &timer_accessor, Genode::uint64_t timeout_ms) : _timer_accessor(timer_accessor) { if (timeout_ms > 0) { @@ -262,7 +262,7 @@ struct Libc::Pthreads } } - unsigned long duration_left() + Genode::uint64_t duration_left() { _construct_timeout_once(); return _timeout->duration_left(); @@ -290,7 +290,7 @@ struct Libc::Pthreads p->lock.unlock(); } - unsigned long suspend_myself(Suspend_functor & check, unsigned long timeout_ms) + Genode::uint64_t suspend_myself(Suspend_functor & check, Genode::uint64_t timeout_ms) { Pthread myself { timer_accessor, timeout_ms }; { @@ -430,13 +430,13 @@ struct Libc::Kernel final : Vfs::Io_response_handler, : _timer_accessor(timer_accessor), _kernel(kernel) { } - void timeout(unsigned long timeout_ms) + void timeout(Genode::uint64_t timeout_ms) { _construct_timeout_once(); _timeout->start(timeout_ms); } - unsigned long duration_left() + Genode::uint64_t duration_left() { _construct_timeout_once(); return _timeout->duration_left(); @@ -513,8 +513,8 @@ struct Libc::Kernel final : Vfs::Io_response_handler, _longjmp(_user_context, 1); } - unsigned long _suspend_main(Suspend_functor &check, - unsigned long timeout_ms) + Genode::uint64_t _suspend_main(Suspend_functor &check, + Genode::uint64_t timeout_ms) { /* check that we're not running on libc kernel context */ if (Thread::mystack().top == _kernel_stack) { @@ -651,7 +651,7 @@ struct Libc::Kernel final : Vfs::Io_response_handler, /** * Suspend this context (main or pthread) */ - unsigned long suspend(Suspend_functor &check, unsigned long timeout_ms) + Genode::uint64_t suspend(Suspend_functor &check, Genode::uint64_t timeout_ms) { if (timeout_ms > 0 && timeout_ms > _timer_accessor.timer().max_timeout()) { @@ -841,7 +841,7 @@ static void resumed_callback() { kernel->entrypoint_resumed(); } void Libc::resume_all() { kernel->resume_all(); } -unsigned long Libc::suspend(Suspend_functor &s, unsigned long timeout_ms) +Genode::uint64_t Libc::suspend(Suspend_functor &s, Genode::uint64_t timeout_ms) { if (!kernel) { error("libc kernel not initialized, needed for suspend()"); diff --git a/repos/libports/src/lib/libc/task.h b/repos/libports/src/lib/libc/task.h index a04871d15..c674becad 100644 --- a/repos/libports/src/lib/libc/task.h +++ b/repos/libports/src/lib/libc/task.h @@ -47,7 +47,7 @@ namespace Libc { * resumed the user context execution. */ struct Suspend_functor { virtual bool suspend() = 0; }; - unsigned long suspend(Suspend_functor &, unsigned long timeout_ms = 0UL); + Genode::uint64_t suspend(Suspend_functor &, Genode::uint64_t timeout_ms = 0); void dispatch_pending_io_signals(); diff --git a/repos/libports/src/lib/libc/time.cc b/repos/libports/src/lib/libc/time.cc index 0ac13d4a5..944e5d085 100644 --- a/repos/libports/src/lib/libc/time.cc +++ b/repos/libports/src/lib/libc/time.cc @@ -39,9 +39,9 @@ int clock_gettime(clockid_t clk_id, struct timespec *ts) case CLOCK_REALTIME: case CLOCK_SECOND: /* FreeBSD specific */ { - static bool initial_rtc_requested = false; - static time_t initial_rtc = 0; - static unsigned long t0_ms = 0; + static bool initial_rtc_requested = false; + static time_t initial_rtc = 0; + static Genode::uint64_t t0_ms = 0; /* try to read rtc once */ if (!initial_rtc_requested) { @@ -54,7 +54,7 @@ int clock_gettime(clockid_t clk_id, struct timespec *ts) if (!initial_rtc) return Libc::Errno(EINVAL); - unsigned long time = Libc::current_time().trunc_to_plain_ms().value - t0_ms; + Genode::uint64_t time = Libc::current_time().trunc_to_plain_ms().value - t0_ms; ts->tv_sec = initial_rtc + time/1000; ts->tv_nsec = (time % 1000) * (1000*1000); @@ -65,7 +65,7 @@ int clock_gettime(clockid_t clk_id, struct timespec *ts) case CLOCK_MONOTONIC: case CLOCK_UPTIME: { - unsigned long us = Libc::current_time().trunc_to_plain_us().value; + Genode::uint64_t us = Libc::current_time().trunc_to_plain_us().value; ts->tv_sec = us / (1000*1000); ts->tv_nsec = (us % (1000*1000)) * 1000; diff --git a/repos/libports/src/lib/libc/timed_semaphore.h b/repos/libports/src/lib/libc/timed_semaphore.h index 41ddf97ba..537ce265d 100644 --- a/repos/libports/src/lib/libc/timed_semaphore.h +++ b/repos/libports/src/lib/libc/timed_semaphore.h @@ -173,7 +173,7 @@ class Libc::Timed_semaphore : public Semaphore protected: - bool on_alarm(unsigned) override + bool on_alarm(uint64_t) override { _triggered = _sem._abort(_element); return false; diff --git a/repos/libports/src/test/timed_semaphore/main.cc b/repos/libports/src/test/timed_semaphore/main.cc index 1c823e23e..82ea5399b 100644 --- a/repos/libports/src/test/timed_semaphore/main.cc +++ b/repos/libports/src/test/timed_semaphore/main.cc @@ -31,7 +31,7 @@ struct Test : Thread Timeout_entrypoint timeout_ep; unsigned id; Timer::Connection wakeup_timer; - unsigned const wakeup_period; + uint64_t const wakeup_period; Timed_semaphore sem { timeout_ep }; bool stop_wakeup { false }; Lock wakeup_stopped { Lock::LOCKED }; diff --git a/repos/os/src/app/block_tester/main.cc b/repos/os/src/app/block_tester/main.cc index 88197803a..63a6070f2 100644 --- a/repos/os/src/app/block_tester/main.cc +++ b/repos/os/src/app/block_tester/main.cc @@ -262,7 +262,7 @@ struct Test::Test_base : private Genode::Fifo::Element _verbose(node.attribute_value("verbose", false)), _io_buffer(_node.attribute_value("io_buffer", Number_of_bytes(4*1024*1024))), - _progress_interval(_node.attribute_value("progress", 0ul)), + _progress_interval(_node.attribute_value("progress", (uint64_t)0)), _copy(_node.attribute_value("copy", true)), _batch(_node.attribute_value("batch", 1u)), _finished_sig(finished_sig) diff --git a/repos/os/src/app/cpu_burner/main.cc b/repos/os/src/app/cpu_burner/main.cc index 3beadf90c..19f4036ca 100644 --- a/repos/os/src/app/cpu_burner/main.cc +++ b/repos/os/src/app/cpu_burner/main.cc @@ -16,6 +16,7 @@ #include #include +using namespace Genode; struct Cpu_burner { @@ -40,13 +41,13 @@ struct Cpu_burner void _handle_period() { - unsigned long const start_ms = _timer.elapsed_ms(); + uint64_t const start_ms = _timer.elapsed_ms(); unsigned iterations = 0; for (;; iterations++) { - unsigned long const curr_ms = _timer.elapsed_ms(); - unsigned long passed_ms = curr_ms - start_ms; + uint64_t const curr_ms = _timer.elapsed_ms(); + uint64_t passed_ms = curr_ms - start_ms; if (passed_ms >= 10*_percent) break; diff --git a/repos/os/src/app/dummy/main.cc b/repos/os/src/app/dummy/main.cc index ab9dab699..b44dee4f8 100644 --- a/repos/os/src/app/dummy/main.cc +++ b/repos/os/src/app/dummy/main.cc @@ -329,7 +329,7 @@ struct Dummy::Main if (!_timer.constructed()) _timer.construct(_env); - _timer->msleep(node.attribute_value("ms", 100UL)); + _timer->msleep(node.attribute_value("ms", (uint64_t)100)); } if (node.type() == "sleep_forever") diff --git a/repos/os/src/app/global_keys_handler/main.cc b/repos/os/src/app/global_keys_handler/main.cc index 3373c57bf..6d8af78ee 100644 --- a/repos/os/src/app/global_keys_handler/main.cc +++ b/repos/os/src/app/global_keys_handler/main.cc @@ -175,7 +175,7 @@ struct Global_keys_handler::Main */ Constructible _timer { }; - unsigned long const _delay_ms; + uint64_t const _delay_ms; Signal_handler _timer_handler; @@ -189,7 +189,7 @@ struct Global_keys_handler::Main _element(reports, *this), _bool_states(bool_states), _reporter(env, _name.string()), - _delay_ms(node.attribute_value("delay_ms", 0UL)), + _delay_ms(node.attribute_value("delay_ms", (uint64_t)0)), _timer_handler(env.ep(), *this, &Report::_generate_report) { _reporter.enabled(true); diff --git a/repos/os/src/app/log_core/component.cc b/repos/os/src/app/log_core/component.cc index e2a873190..ce2bd0faf 100644 --- a/repos/os/src/app/log_core/component.cc +++ b/repos/os/src/app/log_core/component.cc @@ -111,7 +111,7 @@ struct Monitor period_ms = config.xml().attribute_value("period_ms", 1000UL); } catch (...) { } - timer.trigger_periodic(1000UL * period_ms); + timer.trigger_periodic((Genode::uint64_t)1000 * period_ms); } void check() diff --git a/repos/os/src/app/ping/dhcp_client.cc b/repos/os/src/app/ping/dhcp_client.cc index ceda41604..b9daa5cf9 100644 --- a/repos/os/src/app/ping/dhcp_client.cc +++ b/repos/os/src/app/ping/dhcp_client.cc @@ -92,13 +92,13 @@ Microseconds Dhcp_client::_rerequest_timeout(unsigned lease_time_div_log2) { /* FIXME limit the time because of shortcomings in timeout framework */ enum { MAX_TIMEOUT_SEC = 3600 }; - unsigned long timeout_sec = _lease_time_sec >> lease_time_div_log2; + uint64_t timeout_sec = _lease_time_sec >> lease_time_div_log2; if (timeout_sec > MAX_TIMEOUT_SEC) { timeout_sec = MAX_TIMEOUT_SEC; warning("Had to prune the state timeout of DHCP client"); } - return Microseconds(timeout_sec * 1000UL * 1000UL); + return Microseconds(timeout_sec * 1000 * 1000); } diff --git a/repos/os/src/app/ping/dhcp_client.h b/repos/os/src/app/ping/dhcp_client.h index 0f52d6ba9..e1bbd2ee9 100644 --- a/repos/os/src/app/ping/dhcp_client.h +++ b/repos/os/src/app/ping/dhcp_client.h @@ -68,8 +68,8 @@ class Net::Dhcp_client State _state { State::INIT }; Timer::One_shot_timeout _timeout; unsigned long _lease_time_sec = 0; - Genode::Microseconds const _discover_timeout { DISCOVER_TIMEOUT_SEC * 1000 * 1000 }; - Genode::Microseconds const _request_timeout { REQUEST_TIMEOUT_SEC * 1000 * 1000 }; + Genode::Microseconds const _discover_timeout { (Genode::uint64_t)DISCOVER_TIMEOUT_SEC * 1000 * 1000 }; + Genode::Microseconds const _request_timeout { (Genode::uint64_t)REQUEST_TIMEOUT_SEC * 1000 * 1000 }; Nic &_nic; Dhcp_client_handler &_handler; diff --git a/repos/os/src/app/ping/main.cc b/repos/os/src/app/ping/main.cc index c2513439e..a3966f285 100644 --- a/repos/os/src/app/ping/main.cc +++ b/repos/os/src/app/ping/main.cc @@ -31,11 +31,11 @@ using namespace Net; using namespace Genode; -Microseconds read_sec_attr(Xml_node const node, - char const *name, - unsigned long const default_sec) +Microseconds read_sec_attr(Xml_node const node, + char const *name, + uint64_t const default_sec) { - unsigned long sec = node.attribute_value(name, 0UL); + uint64_t sec = node.attribute_value(name, (uint64_t)0); if (!sec) { sec = default_sec; } @@ -63,7 +63,7 @@ class Main : public Nic_handler, Xml_node _config { _config_rom.xml() }; Timer::Connection _timer { _env }; Microseconds _send_time { 0 }; - Microseconds _period_us { read_sec_attr(_config, "period_sec", DEFAULT_PERIOD_SEC) }; + Microseconds _period_us { read_sec_attr(_config, "period_sec", (uint64_t)DEFAULT_PERIOD_SEC) }; Constructible _period { }; Heap _heap { &_env.ram(), &_env.rm() }; bool const _verbose { _config.attribute_value("verbose", false) }; @@ -271,13 +271,13 @@ void Main::_handle_icmp_echo_reply(Ipv4_packet &ip, chr = chr < 'z' ? chr + 1 : 'a'; } /* calculate time since the request was sent */ - unsigned long time_us = _timer.curr_time().trunc_to_plain_us().value - _send_time.value; - unsigned long const time_ms = time_us / 1000UL; + uint64_t time_us = _timer.curr_time().trunc_to_plain_us().value - _send_time.value; + uint64_t const time_ms = time_us / 1000UL; time_us = time_us - time_ms * 1000UL; /* print success message */ log(ICMP_DATA_SIZE + sizeof(Icmp_packet), " bytes from ", ip.src(), - ": icmp_seq=", icmp_seq, " ttl=", (unsigned long)IPV4_TIME_TO_LIVE, + ": icmp_seq=", icmp_seq, " ttl=", (uint64_t)IPV4_TIME_TO_LIVE, " time=", time_ms, ".", time_us ," ms"); /* raise ICMP sequence number and check exit condition */ @@ -405,12 +405,12 @@ void Main::_handle_udp(Ipv4_packet &ip, return; } /* calculate time since the request was sent */ - unsigned long time_us = _timer.curr_time().trunc_to_plain_us().value - _send_time.value; - unsigned long const time_ms = time_us / 1000UL; + uint64_t time_us = _timer.curr_time().trunc_to_plain_us().value - _send_time.value; + uint64_t const time_ms = time_us / 1000UL; time_us = time_us - time_ms * 1000UL; /* print success message */ - log(udp.length(), " bytes from ", ip.src(), " ttl=", (unsigned long)IPV4_TIME_TO_LIVE, + log(udp.length(), " bytes from ", ip.src(), " ttl=", (uint64_t)IPV4_TIME_TO_LIVE, " time=", time_ms, ".", time_us ," ms"); /* check exit condition */ diff --git a/repos/os/src/app/ping/xml_node.cc b/repos/os/src/app/ping/xml_node.cc index be7d7b80c..b2dbee155 100644 --- a/repos/os/src/app/ping/xml_node.cc +++ b/repos/os/src/app/ping/xml_node.cc @@ -17,11 +17,11 @@ using namespace Genode; -Microseconds Genode::read_sec_attr(Xml_node const node, - char const *name, - unsigned long const default_sec) +Microseconds Genode::read_sec_attr(Xml_node const node, + char const *name, + uint64_t const default_sec) { - unsigned long sec = node.attribute_value(name, 0UL); + uint64_t sec = node.attribute_value(name, (uint64_t)0); if (!sec) { sec = default_sec; } diff --git a/repos/os/src/app/ping/xml_node.h b/repos/os/src/app/ping/xml_node.h index c910af860..33cf34647 100644 --- a/repos/os/src/app/ping/xml_node.h +++ b/repos/os/src/app/ping/xml_node.h @@ -21,9 +21,9 @@ namespace Genode { - Microseconds read_sec_attr(Xml_node const node, - char const *name, - unsigned long const default_sec); + Microseconds read_sec_attr(Xml_node const node, + char const *name, + uint64_t const default_sec); } #endif /* _XML_NODE_H_ */ diff --git a/repos/os/src/app/top/main.cc b/repos/os/src/app/top/main.cc index 3a92e2b02..188295dbb 100644 --- a/repos/os/src/app/top/main.cc +++ b/repos/os/src/app/top/main.cc @@ -311,9 +311,9 @@ struct App::Main Reconstructible _trace { _env, TRACE_RAM_QUOTA, ARG_BUFFER_RAM, PARENT_LEVELS }; - static unsigned long _default_period_ms() { return 5000; } + static uint64_t _default_period_ms() { return 5000; } - unsigned long _period_ms = _default_period_ms(); + uint64_t _period_ms = _default_period_ms(); SORT_TIME _sort { EC_TIME }; diff --git a/repos/os/src/app/trace_logger/xml_node.cc b/repos/os/src/app/trace_logger/xml_node.cc index be7d7b80c..b2dbee155 100644 --- a/repos/os/src/app/trace_logger/xml_node.cc +++ b/repos/os/src/app/trace_logger/xml_node.cc @@ -17,11 +17,11 @@ using namespace Genode; -Microseconds Genode::read_sec_attr(Xml_node const node, - char const *name, - unsigned long const default_sec) +Microseconds Genode::read_sec_attr(Xml_node const node, + char const *name, + uint64_t const default_sec) { - unsigned long sec = node.attribute_value(name, 0UL); + uint64_t sec = node.attribute_value(name, (uint64_t)0); if (!sec) { sec = default_sec; } diff --git a/repos/os/src/app/trace_logger/xml_node.h b/repos/os/src/app/trace_logger/xml_node.h index c910af860..33cf34647 100644 --- a/repos/os/src/app/trace_logger/xml_node.h +++ b/repos/os/src/app/trace_logger/xml_node.h @@ -21,9 +21,9 @@ namespace Genode { - Microseconds read_sec_attr(Xml_node const node, - char const *name, - unsigned long const default_sec); + Microseconds read_sec_attr(Xml_node const node, + char const *name, + uint64_t const default_sec); } #endif /* _XML_NODE_H_ */ diff --git a/repos/os/src/app/trace_subject_reporter/main.cc b/repos/os/src/app/trace_subject_reporter/main.cc index b699f0621..8afcff766 100644 --- a/repos/os/src/app/trace_subject_reporter/main.cc +++ b/repos/os/src/app/trace_subject_reporter/main.cc @@ -164,9 +164,9 @@ struct App::Main Reporter _reporter { _env, "trace_subjects", "trace_subjects", 64*1024 }; - static unsigned long _default_period_ms() { return 5000; } + static uint64_t _default_period_ms() { return 5000; } - unsigned long _period_ms = _default_period_ms(); + uint64_t _period_ms = _default_period_ms(); bool _report_affinity = false; bool _report_activity = false; diff --git a/repos/os/src/drivers/ahci/ahci.cc b/repos/os/src/drivers/ahci/ahci.cc index e77321adf..4be53f333 100644 --- a/repos/os/src/drivers/ahci/ahci.cc +++ b/repos/os/src/drivers/ahci/ahci.cc @@ -37,7 +37,7 @@ struct Ahci Timer_delayer(Genode::Env &env) : Timer::Connection(env) { } - void usleep(unsigned us) override { Timer::Connection::usleep(us); } + void usleep(uint64_t us) override { Timer::Connection::usleep(us); } } _delayer { env }; Ahci_root &root; diff --git a/repos/os/src/drivers/audio/spec/linux/main.cc b/repos/os/src/drivers/audio/spec/linux/main.cc index c00c14d4d..a6e1a3d41 100644 --- a/repos/os/src/drivers/audio/spec/linux/main.cc +++ b/repos/os/src/drivers/audio/spec/linux/main.cc @@ -188,7 +188,7 @@ class Audio_out::Out { _timer.sigh(_timer_dispatcher); - unsigned const us = (Audio_out::PERIOD * 1000 / Audio_out::SAMPLE_RATE)*1000; + uint64_t const us = (Audio_out::PERIOD * 1000 / Audio_out::SAMPLE_RATE)*1000; _timer.trigger_periodic(us); } diff --git a/repos/os/src/drivers/framebuffer/spec/exynos5/driver.cc b/repos/os/src/drivers/framebuffer/spec/exynos5/driver.cc index 5e41bf4d5..121ea4230 100644 --- a/repos/os/src/drivers/framebuffer/spec/exynos5/driver.cc +++ b/repos/os/src/drivers/framebuffer/spec/exynos5/driver.cc @@ -36,7 +36,7 @@ class Timer_delayer : public Mmio::Delayer, public Timer::Connection Timer_delayer(Genode::Env &env) : Timer::Connection(env) { } - void usleep(unsigned us) { Timer::Connection::usleep(us); } + void usleep(uint64_t us) { Timer::Connection::usleep(us); } }; diff --git a/repos/os/src/drivers/framebuffer/spec/omap4/driver.h b/repos/os/src/drivers/framebuffer/spec/omap4/driver.h index fcb7dc348..16fc9761e 100644 --- a/repos/os/src/drivers/framebuffer/spec/omap4/driver.h +++ b/repos/os/src/drivers/framebuffer/spec/omap4/driver.h @@ -52,7 +52,7 @@ class Framebuffer::Driver /** * Implementation of 'Delayer' interface */ - void usleep(unsigned us) + void usleep(uint64_t us) { Timer::Connection::usleep(us); } diff --git a/repos/os/src/drivers/gpio/spec/rpi/gpio.h b/repos/os/src/drivers/gpio/spec/rpi/gpio.h index 6470a7f53..0834fb61d 100644 --- a/repos/os/src/drivers/gpio/spec/rpi/gpio.h +++ b/repos/os/src/drivers/gpio/spec/rpi/gpio.h @@ -117,7 +117,7 @@ class Gpio::Reg : Attached_io_mem_dataspace, Mmio /** * Implementation of 'Delayer' interface */ - void usleep(unsigned us) override { Timer::Connection::usleep(us); } + void usleep(uint64_t us) override { Timer::Connection::usleep(us); } } _delayer; diff --git a/repos/os/src/drivers/gpu/intel/main.cc b/repos/os/src/drivers/gpu/intel/main.cc index 937d9fe91..ad272cefd 100644 --- a/repos/os/src/drivers/gpu/intel/main.cc +++ b/repos/os/src/drivers/gpu/intel/main.cc @@ -95,7 +95,7 @@ struct Igd::Device Timer::Connection &_timer; Timer_delayer(Timer::Connection &timer) : _timer(timer) { } - void usleep(unsigned us) override { _timer.usleep(us); } + void usleep(uint64_t us) override { _timer.usleep(us); } } _delayer { _timer }; diff --git a/repos/os/src/drivers/nvme/main.cc b/repos/os/src/drivers/nvme/main.cc index 6b36586d5..7cc8474cd 100644 --- a/repos/os/src/drivers/nvme/main.cc +++ b/repos/os/src/drivers/nvme/main.cc @@ -685,7 +685,7 @@ struct Nvme::Controller : public Genode::Attached_mmio { enum { MAX = 50u, TO_UNIT = 500u, }; Attempts const a(MAX); - Microseconds const t((read() * TO_UNIT) * (1000 / MAX)); + Microseconds const t(((uint64_t)read() * TO_UNIT) * (1000 / MAX)); try { wait_for(a, t, _delayer, Csts::Rdy::Equal(val)); } catch (Mmio::Polling_timeout) { @@ -1376,7 +1376,7 @@ class Driver : public Block::Driver Timer_delayer(Genode::Env &env) : Timer::Connection(env) { } - void usleep(unsigned us) override { Timer::Connection::usleep(us); } + void usleep(uint64_t us) override { Timer::Connection::usleep(us); } } _delayer { _env }; diff --git a/repos/os/src/drivers/platform/spec/rpi/mbox.h b/repos/os/src/drivers/platform/spec/rpi/mbox.h index a1b039ece..f34108875 100644 --- a/repos/os/src/drivers/platform/spec/rpi/mbox.h +++ b/repos/os/src/drivers/platform/spec/rpi/mbox.h @@ -62,7 +62,7 @@ class Mbox : Genode::Attached_mmio struct Delayer : Mmio::Delayer { Timer::Connection timer; - void usleep(unsigned us) override { timer.usleep(us); } + void usleep(Genode::uint64_t us) override { timer.usleep(us); } Delayer(Genode::Env &env) : timer(env) { } } _delayer { _env }; diff --git a/repos/os/src/drivers/sd_card/spec/exynos5/driver.h b/repos/os/src/drivers/sd_card/spec/exynos5/driver.h index aa48f9c4a..eade9268f 100644 --- a/repos/os/src/drivers/sd_card/spec/exynos5/driver.h +++ b/repos/os/src/drivers/sd_card/spec/exynos5/driver.h @@ -168,7 +168,7 @@ class Sd_card::Driver : public Driver_base, { Timer_delayer(Genode::Env &env) : Timer::Connection(env) { } - void usleep(unsigned us) override { Timer::Connection::usleep(us); } + void usleep(uint64_t us) override { Timer::Connection::usleep(us); } }; struct Block_transfer diff --git a/repos/os/src/drivers/sd_card/spec/imx/driver.cc b/repos/os/src/drivers/sd_card/spec/imx/driver.cc index 0940f066b..108cf9233 100644 --- a/repos/os/src/drivers/sd_card/spec/imx/driver.cc +++ b/repos/os/src/drivers/sd_card/spec/imx/driver.cc @@ -27,7 +27,7 @@ int Driver::_wait_for_card_ready_mbw() * freely chosen. */ unsigned attempts = 5; - unsigned constexpr attempts_delay_us = 100000; + uint64_t constexpr attempts_delay_us = 100000; while (1) { if (!attempts) { error("Reading card status after multiblock write failed"); diff --git a/repos/os/src/drivers/sd_card/spec/imx/driver.h b/repos/os/src/drivers/sd_card/spec/imx/driver.h index f85456be3..b6eaeb45c 100644 --- a/repos/os/src/drivers/sd_card/spec/imx/driver.h +++ b/repos/os/src/drivers/sd_card/spec/imx/driver.h @@ -202,7 +202,7 @@ class Sd_card::Driver : public Driver_base, { Timer_delayer(Genode::Env &env) : Timer::Connection(env) { } - void usleep(unsigned us) override { Timer::Connection::usleep(us); } + void usleep(uint64_t us) override { Timer::Connection::usleep(us); } }; struct Block_transfer diff --git a/repos/os/src/drivers/sd_card/spec/omap4/driver.h b/repos/os/src/drivers/sd_card/spec/omap4/driver.h index f6e058b5a..db117a8eb 100644 --- a/repos/os/src/drivers/sd_card/spec/omap4/driver.h +++ b/repos/os/src/drivers/sd_card/spec/omap4/driver.h @@ -162,7 +162,7 @@ class Sd_card::Driver : public Driver_base, { Timer_delayer(Genode::Env &env) : Timer::Connection(env) { } - void usleep(unsigned us) override { Timer::Connection::usleep(us); } + void usleep(uint64_t us) override { Timer::Connection::usleep(us); } }; Env &_env; diff --git a/repos/os/src/drivers/sd_card/spec/rpi/driver.h b/repos/os/src/drivers/sd_card/spec/rpi/driver.h index bf531147b..45c0ba8e6 100644 --- a/repos/os/src/drivers/sd_card/spec/rpi/driver.h +++ b/repos/os/src/drivers/sd_card/spec/rpi/driver.h @@ -152,7 +152,7 @@ class Sd_card::Driver : public Driver_base, { Timer_delayer(Genode::Env &env) : Timer::Connection(env) { } - void usleep(unsigned us) override { Timer::Connection::usleep(us); } + void usleep(uint64_t us) override { Timer::Connection::usleep(us); } }; Env &_env; diff --git a/repos/os/src/init/heartbeat.h b/repos/os/src/init/heartbeat.h index d8ad137df..da9a6e1c0 100644 --- a/repos/os/src/init/heartbeat.h +++ b/repos/os/src/init/heartbeat.h @@ -34,7 +34,7 @@ class Init::Heartbeat : Genode::Noncopyable Constructible _timer { }; - unsigned _rate_ms = 0; + uint64_t _rate_ms = 0; Signal_handler _timer_handler; diff --git a/repos/os/src/init/state_reporter.h b/repos/os/src/init/state_reporter.h index 7780ed962..75024a6ec 100644 --- a/repos/os/src/init/state_reporter.h +++ b/repos/os/src/init/state_reporter.h @@ -45,10 +45,10 @@ class Init::State_reporter : public Report_update_trigger Reconstructible _report_detail { }; - unsigned _report_delay_ms = 0; + uint64_t _report_delay_ms = 0; /* interval used when child-ram reporting is enabled */ - unsigned _report_period_ms = 0; + uint64_t _report_period_ms = 0; /* version string from config, to be reflected in the report */ typedef String<64> Version; @@ -158,7 +158,7 @@ class Init::State_reporter : public Report_update_trigger * the user intends to limit the rate of state reports. If so, we * use the value of 'delay_ms' as interval. */ - unsigned const period_ms = max(1000U, _report_delay_ms); + uint64_t const period_ms = max(1000U, _report_delay_ms); bool const period_changed = (_report_period_ms != period_ms); bool const report_periodically = _report_detail->child_ram() || _report_detail->child_caps(); diff --git a/repos/os/src/server/dynamic_rom/main.cc b/repos/os/src/server/dynamic_rom/main.cc index 22496069f..95d4175da 100644 --- a/repos/os/src/server/dynamic_rom/main.cc +++ b/repos/os/src/server/dynamic_rom/main.cc @@ -120,8 +120,8 @@ class Dynamic_rom::Session_component : public Rpc_object if (curr_step.has_type("sleep") && curr_step.has_attribute("milliseconds")) { - unsigned long const milliseconds = - curr_step.attribute_value("milliseconds", 0UL); + Genode::uint64_t const milliseconds = + curr_step.attribute_value("milliseconds", (Genode::uint64_t)0); _timer.trigger_once(milliseconds*1000); _log("sleep ", milliseconds, " milliseconds"); diff --git a/repos/os/src/server/input_filter/chargen_source.h b/repos/os/src/server/input_filter/chargen_source.h index 804290f6e..33705607a 100644 --- a/repos/os/src/server/input_filter/chargen_source.h +++ b/repos/os/src/server/input_filter/chargen_source.h @@ -404,8 +404,8 @@ class Input_filter::Chargen_source : public Source, Source::Sink Xml_node node) : _destination(destination), _timer(timer), - _delay(node.attribute_value("delay_ms", 0UL)*1000), - _rate (node.attribute_value("rate_ms", 0UL)*1000) + _delay(node.attribute_value("delay_ms", (uint64_t)0)*1000), + _rate (node.attribute_value("rate_ms", (uint64_t)0)*1000) { } void schedule_repeat(Codepoint character) diff --git a/repos/os/src/server/nic_dump/interface.cc b/repos/os/src/server/nic_dump/interface.cc index c825cb009..5af99e90b 100644 --- a/repos/os/src/server/nic_dump/interface.cc +++ b/repos/os/src/server/nic_dump/interface.cc @@ -33,8 +33,8 @@ void Net::Interface::_handle_eth(void *const eth_base, if (_log_time) { Genode::Duration const new_time = _timer.curr_time(); - unsigned long const new_time_ms = new_time.trunc_to_plain_us().value / 1000; - unsigned long const old_time_ms = _curr_time.trunc_to_plain_us().value / 1000; + uint64_t const new_time_ms = new_time.trunc_to_plain_us().value / 1000; + uint64_t const old_time_ms = _curr_time.trunc_to_plain_us().value / 1000; log("\033[33m(", remote._label, " <- ", _label, ")\033[0m ", packet_log(eth, _log_cfg), " \033[33mtime ", new_time_ms, diff --git a/repos/os/src/server/nic_dump/main.cc b/repos/os/src/server/nic_dump/main.cc index 0f153df2e..e51ed4600 100644 --- a/repos/os/src/server/nic_dump/main.cc +++ b/repos/os/src/server/nic_dump/main.cc @@ -30,7 +30,7 @@ class Main Attached_rom_dataspace _config; Timer::Connection _timer; - Duration _curr_time { Microseconds(0UL) }; + Duration _curr_time { Microseconds(0) }; Heap _heap; Net::Root _root; diff --git a/repos/os/src/server/nic_router/dhcp_client.cc b/repos/os/src/server/nic_router/dhcp_client.cc index 74e83d406..0f8d81519 100644 --- a/repos/os/src/server/nic_router/dhcp_client.cc +++ b/repos/os/src/server/nic_router/dhcp_client.cc @@ -89,7 +89,7 @@ Microseconds Dhcp_client::_rerequest_timeout(unsigned lease_time_div_log2) { /* FIXME limit the time because of shortcomings in timeout framework */ enum { MAX_TIMEOUT_SEC = 3600 }; - unsigned long timeout_sec = _lease_time_sec >> lease_time_div_log2; + uint64_t timeout_sec = _lease_time_sec >> lease_time_div_log2; if (timeout_sec > MAX_TIMEOUT_SEC) { timeout_sec = MAX_TIMEOUT_SEC; @@ -102,7 +102,7 @@ Microseconds Dhcp_client::_rerequest_timeout(unsigned lease_time_div_log2) log("[?] prune re-request timeout of DHCP client"); } } } - return Microseconds(timeout_sec * 1000UL * 1000UL); + return Microseconds(timeout_sec * 1000 * 1000); } diff --git a/repos/os/src/server/nic_router/dhcp_client.h b/repos/os/src/server/nic_router/dhcp_client.h index d89c29c2b..758e5b6b1 100644 --- a/repos/os/src/server/nic_router/dhcp_client.h +++ b/repos/os/src/server/nic_router/dhcp_client.h @@ -41,7 +41,7 @@ class Net::Dhcp_client Interface &_interface; State _state { State::INIT }; Timer::One_shot_timeout _timeout; - unsigned long _lease_time_sec = 0; + Genode::uint64_t _lease_time_sec = 0; void _handle_dhcp_reply(Dhcp_packet &dhcp); diff --git a/repos/os/src/server/nic_router/dhcp_server.cc b/repos/os/src/server/nic_router/dhcp_server.cc index 7ac397c6f..1e3399fa4 100644 --- a/repos/os/src/server/nic_router/dhcp_server.cc +++ b/repos/os/src/server/nic_router/dhcp_server.cc @@ -63,13 +63,13 @@ Dhcp_server::Dhcp_server(Xml_node const node, Microseconds Dhcp_server::_init_ip_lease_time(Xml_node const node) { - unsigned long ip_lease_time_sec = - node.attribute_value("ip_lease_time_sec", 0UL); + uint64_t ip_lease_time_sec = + node.attribute_value("ip_lease_time_sec", (uint64_t)0); if (!ip_lease_time_sec) { ip_lease_time_sec = DEFAULT_IP_LEASE_TIME_SEC; } - return Microseconds((unsigned long)ip_lease_time_sec * 1000 * 1000); + return Microseconds((uint64_t)ip_lease_time_sec * 1000 * 1000); } diff --git a/repos/os/src/server/nic_router/xml_node.cc b/repos/os/src/server/nic_router/xml_node.cc index be7d7b80c..b2dbee155 100644 --- a/repos/os/src/server/nic_router/xml_node.cc +++ b/repos/os/src/server/nic_router/xml_node.cc @@ -17,11 +17,11 @@ using namespace Genode; -Microseconds Genode::read_sec_attr(Xml_node const node, - char const *name, - unsigned long const default_sec) +Microseconds Genode::read_sec_attr(Xml_node const node, + char const *name, + uint64_t const default_sec) { - unsigned long sec = node.attribute_value(name, 0UL); + uint64_t sec = node.attribute_value(name, (uint64_t)0); if (!sec) { sec = default_sec; } diff --git a/repos/os/src/server/nic_router/xml_node.h b/repos/os/src/server/nic_router/xml_node.h index c910af860..33cf34647 100644 --- a/repos/os/src/server/nic_router/xml_node.h +++ b/repos/os/src/server/nic_router/xml_node.h @@ -21,9 +21,9 @@ namespace Genode { - Microseconds read_sec_attr(Xml_node const node, - char const *name, - unsigned long const default_sec); + Microseconds read_sec_attr(Xml_node const node, + char const *name, + uint64_t const default_sec); } #endif /* _XML_NODE_H_ */ diff --git a/repos/os/src/server/trace_fs/main.cc b/repos/os/src/server/trace_fs/main.cc index 577956499..8205eb3f9 100644 --- a/repos/os/src/server/trace_fs/main.cc +++ b/repos/os/src/server/trace_fs/main.cc @@ -51,7 +51,7 @@ namespace Trace_fs { */ struct Trace_fs::Policy { - unsigned interval; /* in milliseconds */ + uint64_t interval; /* in milliseconds */ unsigned subject_limit; Genode::Number_of_bytes trace_quota; Genode::Number_of_bytes trace_meta_quota; @@ -65,7 +65,7 @@ struct Trace_fs::Policy static Policy from_xml(Xml_node node) { return Policy { - .interval = node.attribute_value("interval", 1000U), + .interval = node.attribute_value("interval", (uint64_t)1000), .subject_limit = node.attribute_value("subject_limit", 128U), .trace_quota = node.attribute_value("trace_quota", _mib(32)), .trace_meta_quota = node.attribute_value("trace_meta_quota", _kib(256)), @@ -649,7 +649,7 @@ class Trace_fs::Session_component : public Session_rpc_object bool _writeable; unsigned _subject_limit; - unsigned _poll_interval; + uint64_t _poll_interval; Timer::Connection _fs_update_timer; diff --git a/repos/os/src/server/vmm/main.cc b/repos/os/src/server/vmm/main.cc index 0f9b54a6f..d9cf55c9b 100644 --- a/repos/os/src/server/vmm/main.cc +++ b/repos/os/src/server/vmm/main.cc @@ -1035,7 +1035,7 @@ class Vmm *reg = 0; return; case SYS_24MHZ: /* 24 MHz counter */ - *reg = _timer.elapsed_ms() * 24000; + *reg = (Genode::uint32_t)_timer.elapsed_ms() * 24000; return; case SYS_MISC: *reg = 1 << 12; diff --git a/repos/os/src/test/block/bench/main.cc b/repos/os/src/test/block/bench/main.cc index fa9b4d76e..ec1fc72c0 100644 --- a/repos/os/src/test/block/bench/main.cc +++ b/repos/os/src/test/block/bench/main.cc @@ -48,8 +48,8 @@ class Throughput bool _read_done = false; bool _write_done = false; - unsigned long _start = 0; - unsigned long _stop = 0; + uint64_t _start = 0; + uint64_t _stop = 0; size_t _bytes = 0; Block::sector_t _current = 0; diff --git a/repos/os/src/test/block/client/main.cc b/repos/os/src/test/block/client/main.cc index f5a14fdfe..d1b8fcffe 100644 --- a/repos/os/src/test/block/client/main.cc +++ b/repos/os/src/test/block/client/main.cc @@ -91,7 +91,7 @@ class Test : Genode::Interface Test(Genode::Env &env, Genode::Heap &heap, Genode::size_t bulk_buffer_size, - unsigned timeout_ms) + Genode::uint64_t timeout_ms) : _ep(env.ep()), _alloc(&heap), _session(env, &_alloc, _shared_buffer_size(bulk_buffer_size)), @@ -122,7 +122,7 @@ struct Read_test : Test { bool done; - Read_test(Genode::Env &env, Genode::Heap &heap, unsigned timeo_ms) + Read_test(Genode::Env &env, Genode::Heap &heap, Genode::uint64_t timeo_ms) : Test(env, heap, BULK_BLK_NR*blk_sz, timeo_ms), done(false) { } void perform() override @@ -198,7 +198,7 @@ struct Write_test : Test Req_buffer read_packets { }; Req_buffer write_packets { }; - Write_test(Genode::Env &env, Genode::Heap &heap, unsigned timeo_ms) + Write_test(Genode::Env &env, Genode::Heap &heap, Genode::uint64_t timeo_ms) : Test(env, heap, BULK_BLK_NR*blk_sz, timeo_ms) { if (BULK_BLK_NR < BATCH*NR_PER_REQ || @@ -332,7 +332,7 @@ struct Violation_test : Test int p_in_fly; - Violation_test(Genode::Env &env, Genode::Heap &heap, unsigned timeo) + Violation_test(Genode::Env &env, Genode::Heap &heap, Genode::uint64_t timeo) : Test(env, heap, 20*blk_sz, timeo), p_in_fly(0) {} void req(Block::sector_t nr, Genode::size_t cnt, bool write) diff --git a/repos/os/src/test/bomb/main.cc b/repos/os/src/test/bomb/main.cc index afec480f3..6b310bf03 100644 --- a/repos/os/src/test/bomb/main.cc +++ b/repos/os/src/test/bomb/main.cc @@ -168,7 +168,7 @@ struct Bomb unsigned const rounds = config.xml().attribute_value("rounds", 1U); unsigned const generation = config.xml().attribute_value("generations", 1U); unsigned const children = config.xml().attribute_value("children", 2U); - unsigned const sleeptime = config.xml().attribute_value("sleep", 2000U); + uint64_t const sleeptime = config.xml().attribute_value("sleep", (uint64_t)2000); size_t const ram_demand = config.xml().attribute_value("demand", 1024UL * 1024); bool const master = config.xml().attribute_value("master", true); diff --git a/repos/os/src/test/fb_bench/main.cc b/repos/os/src/test/fb_bench/main.cc index 7500ee384..1b720e9e7 100644 --- a/repos/os/src/test/fb_bench/main.cc +++ b/repos/os/src/test/fb_bench/main.cc @@ -46,7 +46,7 @@ struct Test memset(buf[1], ~0, fb_ds.size()); } - void conclusion(unsigned kib, unsigned start_ms, unsigned end_ms) { + void conclusion(unsigned kib, uint64_t start_ms, uint64_t end_ms) { log("throughput: ", kib / (end_ms - start_ms), " MiB/sec"); } ~Test() { log("\nTEST ", id, " finished\n"); } @@ -67,7 +67,7 @@ struct Bytewise_ram_test : Test Bytewise_ram_test(Env &env, int id) : Test(env, id, brief) { unsigned kib = 0; - unsigned const start_ms = timer.elapsed_ms(); + uint64_t const start_ms = timer.elapsed_ms(); for (; timer.elapsed_ms() - start_ms < DURATION_MS;) { memcpy(buf[0], buf[1], fb_ds.size()); kib += fb_ds.size() / 1024; @@ -83,7 +83,7 @@ struct Bytewise_fb_test : Test Bytewise_fb_test(Env &env, int id) : Test(env, id, brief) { unsigned kib = 0; - unsigned const start_ms = timer.elapsed_ms(); + uint64_t const start_ms = timer.elapsed_ms(); for (unsigned i = 0; timer.elapsed_ms() - start_ms < DURATION_MS; i++) { memcpy(fb_ds.local_addr(), buf[i % 2], fb_ds.size()); kib += fb_ds.size() / 1024; @@ -99,7 +99,7 @@ struct Blit_test : Test Blit_test(Env &env, int id) : Test(env, id, brief) { unsigned kib = 0; - unsigned const start_ms = timer.elapsed_ms(); + uint64_t const start_ms = timer.elapsed_ms(); unsigned const w = fb_mode.width() * fb_mode.bytes_per_pixel(); unsigned const h = fb_mode.height(); for (unsigned i = 0; timer.elapsed_ms() - start_ms < DURATION_MS; i++) { @@ -117,7 +117,7 @@ struct Unaligned_blit_test : Test Unaligned_blit_test(Env &env, int id) : Test(env, id, brief) { unsigned kib = 0; - unsigned const start_ms = timer.elapsed_ms(); + uint64_t const start_ms = timer.elapsed_ms(); unsigned const w = fb_mode.width() * fb_mode.bytes_per_pixel(); unsigned const h = fb_mode.height(); for (unsigned i = 0; timer.elapsed_ms() - start_ms < DURATION_MS; i++) { diff --git a/repos/os/src/test/init/main.cc b/repos/os/src/test/init/main.cc index 46a92f070..b5d8afba8 100644 --- a/repos/os/src/test/init/main.cc +++ b/repos/os/src/test/init/main.cc @@ -279,7 +279,7 @@ struct Test::Main : Log_message_handler if (step.type() == "sleep") { if (!_timer_scheduled) { - unsigned long const timeout_ms = step.attribute_value("ms", 250UL); + uint64_t const timeout_ms = step.attribute_value("ms", (uint64_t)250); _timer.trigger_once(timeout_ms*1000); _timer_scheduled = true; } diff --git a/repos/os/src/test/input_filter/main.cc b/repos/os/src/test/input_filter/main.cc index 075ac4f0e..2030cfc08 100644 --- a/repos/os/src/test/input_filter/main.cc +++ b/repos/os/src/test/input_filter/main.cc @@ -264,7 +264,7 @@ struct Test::Main : Input_from_filter::Event_handler unsigned const _num_steps = _config.xml().num_sub_nodes(); unsigned _curr_step = 0; - unsigned long _went_to_sleep_time = 0; + uint64_t _went_to_sleep_time = 0; Xml_node _curr_step_xml() const { return _config.xml().sub_node(_curr_step); } @@ -349,7 +349,7 @@ struct Test::Main : Input_from_filter::Event_handler if (step.type() == "sleep") { if (_went_to_sleep_time == 0) { - unsigned long const timeout_ms = step.attribute_value("ms", 250UL); + uint64_t const timeout_ms = step.attribute_value("ms", (uint64_t)250); _went_to_sleep_time = _timer.elapsed_ms(); _timer.trigger_once(timeout_ms*1000); } @@ -420,9 +420,9 @@ struct Test::Main : Input_from_filter::Event_handler throw Exception(); } - unsigned long const duration = _curr_step_xml().attribute_value("ms", 0UL); - unsigned long const now = _timer.elapsed_ms(); - unsigned long const slept = now - _went_to_sleep_time; + uint64_t const duration = _curr_step_xml().attribute_value("ms", (uint64_t)0); + uint64_t const now = _timer.elapsed_ms(); + uint64_t const slept = now - _went_to_sleep_time; if (slept < duration) { warning("spurious wakeup from sleep"); diff --git a/repos/os/src/test/net_flood/dhcp_client.cc b/repos/os/src/test/net_flood/dhcp_client.cc index ceda41604..b9daa5cf9 100644 --- a/repos/os/src/test/net_flood/dhcp_client.cc +++ b/repos/os/src/test/net_flood/dhcp_client.cc @@ -92,13 +92,13 @@ Microseconds Dhcp_client::_rerequest_timeout(unsigned lease_time_div_log2) { /* FIXME limit the time because of shortcomings in timeout framework */ enum { MAX_TIMEOUT_SEC = 3600 }; - unsigned long timeout_sec = _lease_time_sec >> lease_time_div_log2; + uint64_t timeout_sec = _lease_time_sec >> lease_time_div_log2; if (timeout_sec > MAX_TIMEOUT_SEC) { timeout_sec = MAX_TIMEOUT_SEC; warning("Had to prune the state timeout of DHCP client"); } - return Microseconds(timeout_sec * 1000UL * 1000UL); + return Microseconds(timeout_sec * 1000 * 1000); } diff --git a/repos/os/src/test/net_flood/dhcp_client.h b/repos/os/src/test/net_flood/dhcp_client.h index 0f52d6ba9..e1bbd2ee9 100644 --- a/repos/os/src/test/net_flood/dhcp_client.h +++ b/repos/os/src/test/net_flood/dhcp_client.h @@ -68,8 +68,8 @@ class Net::Dhcp_client State _state { State::INIT }; Timer::One_shot_timeout _timeout; unsigned long _lease_time_sec = 0; - Genode::Microseconds const _discover_timeout { DISCOVER_TIMEOUT_SEC * 1000 * 1000 }; - Genode::Microseconds const _request_timeout { REQUEST_TIMEOUT_SEC * 1000 * 1000 }; + Genode::Microseconds const _discover_timeout { (Genode::uint64_t)DISCOVER_TIMEOUT_SEC * 1000 * 1000 }; + Genode::Microseconds const _request_timeout { (Genode::uint64_t)REQUEST_TIMEOUT_SEC * 1000 * 1000 }; Nic &_nic; Dhcp_client_handler &_handler; diff --git a/repos/os/src/test/net_flood/main.cc b/repos/os/src/test/net_flood/main.cc index df267a0a7..96105ff12 100644 --- a/repos/os/src/test/net_flood/main.cc +++ b/repos/os/src/test/net_flood/main.cc @@ -66,8 +66,8 @@ class Main : public Nic_handler, Port _dst_port { FIRST_DST_PORT }; size_t _ping_sz { _init_ping_sz() }; unsigned long _ping_cnt { 0 }; - unsigned long _sec { _config.attribute_value("sec", 10UL) }; - unsigned long _time_us { 0 }; + uint64_t _sec { _config.attribute_value("sec", (uint64_t)10) }; + uint64_t _time_us { 0 }; size_t _init_ping_sz() const; @@ -370,7 +370,7 @@ void Main::_send_ping(Duration time) } } catch (Net::Packet_stream_source::Packet_alloc_failed) { } - unsigned long const new_time_us = time.trunc_to_plain_us().value; + uint64_t const new_time_us = time.trunc_to_plain_us().value; if (new_time_us - _time_us > 1000000) { if (!_ping_cnt) { error("test failed (could not send packet for a second)"); diff --git a/repos/os/src/test/resource_yield/main.cc b/repos/os/src/test/resource_yield/main.cc index f97b42056..07f405e5b 100644 --- a/repos/os/src/test/resource_yield/main.cc +++ b/repos/os/src/test/resource_yield/main.cc @@ -77,7 +77,7 @@ class Test::Child Timer::Connection _timer { _env }; Signal_handler _periodic_timeout_handler; Signal_handler _yield_handler; - unsigned long const _period_ms; + uint64_t const _period_ms; void _handle_periodic_timeout(); void _handle_yield(); @@ -165,7 +165,7 @@ Test::Child::Child(Env &env, Xml_node config) _expand(config.attribute_value("expand", false)), _periodic_timeout_handler(_env.ep(), *this, &Child::_handle_periodic_timeout), _yield_handler(_env.ep(), *this, &Child::_handle_yield), - _period_ms(config.attribute_value("period_ms", 500UL)) + _period_ms(config.attribute_value("period_ms", (uint64_t)500)) { /* register yield signal handler */ _env.parent().yield_sigh(_yield_handler); diff --git a/repos/os/src/test/sd_card_bench/main.cc b/repos/os/src/test/sd_card_bench/main.cc index 427a8694e..3c8365762 100644 --- a/repos/os/src/test/sd_card_bench/main.cc +++ b/repos/os/src/test/sd_card_bench/main.cc @@ -50,7 +50,7 @@ struct Main Env &env; Packet_descriptor pkt { }; - unsigned long time_before_ms { }; + uint64_t time_before_ms { }; Timer::Connection timer { env }; Operation operation { READ }; Signal_handler
ack_handler { env.ep(), *this, &Main::update_state }; @@ -81,9 +81,9 @@ struct Main if (buf_off_done == buf_size) { /* print stats for the current request size */ - unsigned long const time_after_ms = timer.elapsed_ms(); - unsigned long const duration_ms = time_after_ms - time_before_ms; - size_t const kib_per_sec = (1000 * buf_size_kib) / + uint64_t const time_after_ms = timer.elapsed_ms(); + uint64_t const duration_ms = time_after_ms - time_before_ms; + size_t const kib_per_sec = (1000 * buf_size_kib) / duration_ms; log(" duration: ", duration_ms, " ms"); log(" amount: ", buf_size_kib, " KiB"); diff --git a/repos/os/src/test/signal/main.cc b/repos/os/src/test/signal/main.cc index 1a3928fee..4e16765ad 100644 --- a/repos/os/src/test/signal/main.cc +++ b/repos/os/src/test/signal/main.cc @@ -30,7 +30,7 @@ class Sender : Thread Timer::Connection _timer; Signal_transmitter _transmitter; - unsigned const _interval_ms; + uint64_t const _interval_ms; bool const _verbose; bool volatile _stop { false }; unsigned _submit_cnt { 0 }; @@ -56,7 +56,7 @@ class Sender : Thread Sender(Env &env, Signal_context_capability context, - unsigned interval_ms, + uint64_t interval_ms, bool verbose) : Thread(env, "sender", 16*1024), _timer(env), @@ -89,7 +89,7 @@ class Handler : Thread private: Timer::Connection _timer; - unsigned const _dispatch_ms; + uint64_t const _dispatch_ms; unsigned const _id; bool const _verbose; Signal_receiver &_receiver; @@ -120,7 +120,7 @@ class Handler : Thread Handler(Env &env, Signal_receiver &receiver, - unsigned dispatch_ms, + uint64_t dispatch_ms, bool verbose, unsigned id) : diff --git a/repos/os/src/test/timeout/main.cc b/repos/os/src/test/timeout/main.cc index 3b73bf904..af2fe5e9e 100644 --- a/repos/os/src/test/timeout/main.cc +++ b/repos/os/src/test/timeout/main.cc @@ -152,18 +152,20 @@ struct Duration_test : Test Test(env, error_cnt, done, id, brief) { log("tests with common duration values"); - enum : unsigned long { US_PER_HOUR = 1000UL * 1000 * 60 * 60 }; + enum : uint64_t { US_PER_HOUR = (uint64_t)1000 * 1000 * 60 * 60 }; + enum : uint64_t { US_PER_MS = (uint64_t)1000 }; /* create durations for corner cases */ - Duration min (Microseconds(0UL)); - Duration hour(Microseconds((unsigned long)US_PER_HOUR)); - Duration max (Microseconds(~0UL)); + Duration min (Microseconds(0)); + Duration hour (Microseconds((uint64_t)US_PER_HOUR)); + Duration max (Microseconds(~(uint64_t)0)); + Duration max_ms(Microseconds(~(uint64_t)0 - US_PER_MS + 1)); { /* create durations near the corner cases */ - Duration min_plus_1 (Microseconds(1UL)); - Duration hour_minus_1(Microseconds((unsigned long)US_PER_HOUR - 1)); - Duration hour_plus_1 (Microseconds((unsigned long)US_PER_HOUR + 1)); - Duration max_minus_1 (Microseconds(~0UL - 1)); + Duration min_plus_1 (Microseconds(1)); + Duration hour_minus_1(Microseconds((uint64_t)US_PER_HOUR - 1)); + Duration hour_plus_1 (Microseconds((uint64_t)US_PER_HOUR + 1)); + Duration max_minus_1 (Microseconds(~(uint64_t)0 - 1)); /* all must be greater than the minimum */ if (min_plus_1 .less_than(min)) { error(__func__, ":", __LINE__); error_cnt++; } @@ -186,97 +188,44 @@ struct Duration_test : Test if (hour_plus_1.less_than(hour )) { error(__func__, ":", __LINE__); error_cnt++; } } /* consistency when we double the values */ - Duration two_hours = hour; - Duration two_max = max; - two_hours.add(Microseconds((unsigned long)US_PER_HOUR)); - two_max .add(Microseconds(~0UL)); - if (two_hours.less_than(hour)) { error(__func__, ":", __LINE__); error_cnt++; } - if (two_max .less_than(max )) { error(__func__, ":", __LINE__); error_cnt++; } + Duration two_hours = hour; + Duration two_max = max; + Duration two_max_ms = max_ms; + two_hours.add(Microseconds((uint64_t)US_PER_HOUR)); + try { + two_max.add(Microseconds(1)); + error(__func__, ":", __LINE__); error_cnt++; + } catch (Duration::Overflow) { } + try { + two_max.add(Milliseconds(1)); + error(__func__, ":", __LINE__); error_cnt++; + } catch (Duration::Overflow) { } + try { + two_max_ms.add(Milliseconds(1)); + error(__func__, ":", __LINE__); error_cnt++; + } catch (Duration::Overflow) { } + + if (two_hours.less_than(hour)) { + error(__func__, ":", __LINE__); error_cnt++; } + + if (two_max.trunc_to_plain_us().value != max.trunc_to_plain_us().value) { + error(__func__, ":", __LINE__); error_cnt++; } + + if (two_max_ms.trunc_to_plain_us().value != max_ms.trunc_to_plain_us().value) { + error(__func__, ":", __LINE__); error_cnt++; } /* create durations near corner cases by increasing after construction */ - Duration hour_minus_1(Microseconds((unsigned long)US_PER_HOUR - 2)); - Duration hour_plus_1 (Microseconds((unsigned long)US_PER_HOUR)); - Duration max_minus_1 (Microseconds(~0UL - 2)); - Duration max_plus_1 (Microseconds(~0UL)); + Duration hour_minus_1(Microseconds((uint64_t)US_PER_HOUR - 2)); + Duration hour_plus_1 (Microseconds((uint64_t)US_PER_HOUR)); + Duration max_minus_1 (Microseconds(~(uint64_t)0 - 2)); hour_minus_1.add(Microseconds(1)); hour_plus_1 .add(Microseconds(1)); max_minus_1 .add(Microseconds(1)); - max_plus_1 .add(Microseconds(1)); /* consistency around corner cases */ if (hour .less_than(hour_minus_1)) { error(__func__, ":", __LINE__); error_cnt++; } if (hour_plus_1.less_than(hour )) { error(__func__, ":", __LINE__); error_cnt++; } if (max .less_than(max_minus_1 )) { error(__func__, ":", __LINE__); error_cnt++; } - if (max_plus_1 .less_than(max )) { error(__func__, ":", __LINE__); error_cnt++; } - - log("tests near maximum duration value (may take a while)"); - - /* - * This is a fast way to get the maximum possible duration - */ - enum { NR = 12 }; - Duration duration[NR] = { - Duration(Microseconds(1UL)), - Duration(Microseconds(1UL)), - Duration(Microseconds(1UL)), - Duration(Microseconds(1UL)), - Duration(Microseconds(1UL)), - Duration(Microseconds(1UL)), - Duration(Microseconds(1UL)), - Duration(Microseconds(1UL)), - Duration(Microseconds(1UL)), - Duration(Microseconds(1UL)), - Duration(Microseconds(0UL)), - Duration(Microseconds(0UL)) - }; - for (unsigned volatile step = 0; NR - step > 2; step++) { - - /* - * We increase all left durations equally, beginning with a big - * step width, until an overflow occurs. Then, we dismiss the - * duration that had the overflow and decrease the step width for - * the next round. With only 3 durations left, we decrease step - * width to 1 and do one more round. So, finally we have only 2 - * durations left. - */ - unsigned volatile duration_id = step; - unsigned nr_left = NR - step; - try { - while (1) { - for (; duration_id < NR; duration_id++) { - - if (nr_left > 4) { duration[duration_id].add(Milliseconds(~0UL / (step + 1))); } - else if (nr_left == 4) { duration[duration_id].add(Milliseconds(1000UL)); } - else if (nr_left < 4) { duration[duration_id].add(Microseconds(1UL)); } - } - duration_id = step; - } - } - catch (Duration::Overflow) { } - log(" step ", step, " done: duration ", duration_id, " dismissed", - ", durations ", step, "..", NR - 1, " left"); - } - - /* - * Now, both duration[NR - 2] and duration[NR - 1] contain one less - * than the maximum possible duration value. So, test consistency at - * this corner case. - */ - duration[NR - 2].add(Microseconds(1)); - if (duration[NR - 2].less_than(duration[NR - 1])) { error(__func__, ":", __LINE__); error_cnt++; } - if (duration[NR - 1].less_than(duration[NR - 2])) ; else { error(__func__, ":", __LINE__); error_cnt++; } - - /* test if we really had the expected durations */ - try { - duration[NR - 2].add(Microseconds(1)); - error(__func__, ":", __LINE__); error_cnt++; - } - catch (Duration::Overflow) { } - try { - duration[NR - 1].add(Microseconds(2)); - error(__func__, ":", __LINE__); error_cnt++; - } - catch (Duration::Overflow) { } Test::done.submit(); } @@ -310,12 +259,12 @@ struct Mixed_timeouts : Test * do not trigger during the lifetime of the test. */ Timeout const timeouts[NR_OF_TIMEOUTS] { - /* 0 */ { "Periodic 700 ms", Microseconds( 700000UL) }, - /* 1 */ { "Periodic 1000 ms", Microseconds(1000000UL) }, - /* 2 */ { "Periodic max ms", Microseconds( ~0UL) }, - /* 3 */ { "One-shot 3250 ms", Microseconds(3250000UL) }, - /* 4 */ { "One-shot 5200 ms", Microseconds(5200000UL) }, - /* 5 */ { "One-shot max ms", Microseconds( ~0UL) }, + /* 0 */ { "Periodic 700 ms", Microseconds( 700000) }, + /* 1 */ { "Periodic 1000 ms", Microseconds( 1000000) }, + /* 2 */ { "Periodic max ms", Microseconds(~(uint64_t)0) }, + /* 3 */ { "One-shot 3250 ms", Microseconds( 3250000) }, + /* 4 */ { "One-shot 5200 ms", Microseconds( 5200000) }, + /* 5 */ { "One-shot max ms", Microseconds(~(uint64_t)0) }, }; /* @@ -326,39 +275,39 @@ struct Mixed_timeouts : Test * have an empty name are treated as wildcards and match any timeout. */ Timeout_event const events[NR_OF_EVENTS] { - /* 0 */ { nullptr, Duration(Milliseconds( 0UL)) }, - /* 1 */ { nullptr, Duration(Milliseconds( 0UL)) }, - /* 2 */ { nullptr, Duration(Milliseconds( 0UL)) }, - /* 3 */ { &timeouts[0], Duration(Milliseconds( 700UL)) }, - /* 4 */ { &timeouts[1], Duration(Milliseconds(1000UL)) }, - /* 5 */ { &timeouts[0], Duration(Milliseconds(1400UL)) }, - /* 6 */ { nullptr, Duration(Milliseconds(2000UL)) }, - /* 7 */ { nullptr, Duration(Milliseconds(2100UL)) }, - /* 8 */ { &timeouts[0], Duration(Milliseconds(2800UL)) }, - /* 9 */ { &timeouts[1], Duration(Milliseconds(3000UL)) }, - /* 10 */ { &timeouts[3], Duration(Milliseconds(3250UL)) }, - /* 11 */ { &timeouts[0], Duration(Milliseconds(3500UL)) }, - /* 12 */ { &timeouts[1], Duration(Milliseconds(4000UL)) }, - /* 13 */ { &timeouts[0], Duration(Milliseconds(4200UL)) }, - /* 14 */ { nullptr, Duration(Milliseconds(4900UL)) }, - /* 15 */ { nullptr, Duration(Milliseconds(5000UL)) }, - /* 16 */ { &timeouts[4], Duration(Milliseconds(5200UL)) }, - /* 17 */ { &timeouts[0], Duration(Milliseconds(5600UL)) }, - /* 18 */ { &timeouts[1], Duration(Milliseconds(6000UL)) }, - /* 19 */ { &timeouts[0], Duration(Milliseconds(6300UL)) }, - /* 20 */ { &timeouts[3], Duration(Milliseconds(6500UL)) } + /* 0 */ { nullptr, Duration(Milliseconds( 0)) }, + /* 1 */ { nullptr, Duration(Milliseconds( 0)) }, + /* 2 */ { nullptr, Duration(Milliseconds( 0)) }, + /* 3 */ { &timeouts[0], Duration(Milliseconds( 700)) }, + /* 4 */ { &timeouts[1], Duration(Milliseconds(1000)) }, + /* 5 */ { &timeouts[0], Duration(Milliseconds(1400)) }, + /* 6 */ { nullptr, Duration(Milliseconds(2000)) }, + /* 7 */ { nullptr, Duration(Milliseconds(2100)) }, + /* 8 */ { &timeouts[0], Duration(Milliseconds(2800)) }, + /* 9 */ { &timeouts[1], Duration(Milliseconds(3000)) }, + /* 10 */ { &timeouts[3], Duration(Milliseconds(3250)) }, + /* 11 */ { &timeouts[0], Duration(Milliseconds(3500)) }, + /* 12 */ { &timeouts[1], Duration(Milliseconds(4000)) }, + /* 13 */ { &timeouts[0], Duration(Milliseconds(4200)) }, + /* 14 */ { nullptr, Duration(Milliseconds(4900)) }, + /* 15 */ { nullptr, Duration(Milliseconds(5000)) }, + /* 16 */ { &timeouts[4], Duration(Milliseconds(5200)) }, + /* 17 */ { &timeouts[0], Duration(Milliseconds(5600)) }, + /* 18 */ { &timeouts[1], Duration(Milliseconds(6000)) }, + /* 19 */ { &timeouts[0], Duration(Milliseconds(6300)) }, + /* 20 */ { &timeouts[3], Duration(Milliseconds(6500)) } }; struct { - unsigned long event_time_us { 0 }; - unsigned long time_us { 0 }; - Timeout const * timeout { nullptr }; + uint64_t event_time_us { 0 }; + uint64_t time_us { 0 }; + Timeout const * timeout { nullptr }; } results [NR_OF_EVENTS]; - Duration init_time { Microseconds(0) }; - unsigned event_id { 0 }; - unsigned long max_error_us { config.xml().attribute_value("precise_timeouts", true) ? - 50000UL : 200000UL }; + Duration init_time { Microseconds(0) }; + unsigned event_id { 0 }; + uint64_t max_error_us { config.xml().attribute_value("precise_timeouts", true) ? + (uint64_t)50000 : (uint64_t)200000 }; Timer::Periodic_timeout pt1 { timer, *this, &Mixed_timeouts::handle_pt1, timeouts[0].us }; Timer::Periodic_timeout pt2 { timer, *this, &Mixed_timeouts::handle_pt2, timeouts[1].us }; @@ -401,13 +350,13 @@ struct Mixed_timeouts : Test return; } for (unsigned i = 0; i < NR_OF_EVENTS; i++) { - unsigned long const event_time_us = results[i].event_time_us; - unsigned long const time_us = results[i].time_us; - unsigned long const error_us = max(time_us, event_time_us) - - min(time_us, event_time_us); - Timeout const *timeout = results[i].timeout; + uint64_t const event_time_us = results[i].event_time_us; + uint64_t const time_us = results[i].time_us; + uint64_t const error_us = max(time_us, event_time_us) - + min(time_us, event_time_us); + Timeout const *timeout = results[i].timeout; - log(time_us / 1000UL, " ms: ", timeout->name, " timeout triggered," + log(time_us / 1000, " ms: ", timeout->name, " timeout triggered," " error ", error_us, " us (max ", max_error_us, " us)"); if (error_us > max_error_us) { @@ -448,13 +397,13 @@ struct Fast_polling : Test enum { MAX_DELAY_ERR_US = 2000 }; enum { MAX_AVG_DELAY_ERR_US = 20 }; enum { MAX_POLL_LATENCY_US = 1000 }; - enum { BUF_SIZE = MAX_NR_OF_POLLS * sizeof(unsigned long) }; + enum { BUF_SIZE = MAX_NR_OF_POLLS * sizeof(uint64_t) }; struct Result_buffer { Env &env; Attached_ram_dataspace ram { env.ram(), env.rm(), BUF_SIZE }; - unsigned long volatile *value { ram.local_addr() }; + uint64_t volatile *value { ram.local_addr() }; Result_buffer(Env &env) : env(env) { } @@ -470,19 +419,19 @@ struct Fast_polling : Test Entrypoint main_ep; Signal_handler main_handler; - Timer::Connection timer_2 { env }; - unsigned long const timer_us { timer.elapsed_us() }; - unsigned long const timer_2_us { timer_2.elapsed_us() }; - bool const timer_2_delayed { timer_us > timer_2_us }; - unsigned long const timer_diff_us { timer_2_delayed ? - timer_2_us - timer_us : - timer_us - timer_2_us }; - Result_buffer local_us_1_buf { env }; - Result_buffer local_us_2_buf { env }; - Result_buffer remote_us_buf { env }; + Timer::Connection timer_2 { env }; + uint64_t const timer_us { timer.elapsed_us() }; + uint64_t const timer_2_us { timer_2.elapsed_us() }; + bool const timer_2_delayed { timer_us > timer_2_us }; + uint64_t const timer_diff_us { timer_2_delayed ? + timer_2_us - timer_us : + timer_us - timer_2_us }; + Result_buffer local_us_1_buf { env }; + Result_buffer local_us_2_buf { env }; + Result_buffer remote_us_buf { env }; - unsigned long max_avg_time_err_us { config.xml().attribute_value("precise_ref_time", true) ? - 1000UL : 2000UL }; + uint64_t max_avg_time_err_us { config.xml().attribute_value("precise_ref_time", true) ? + (uint64_t)1000 : (uint64_t)2000 }; unsigned const delay_loops_per_poll[NR_OF_ROUNDS] { 1, 1000, @@ -498,16 +447,16 @@ struct Fast_polling : Test { private: - unsigned long _avg { 0 }; - unsigned long _avg_cnt { 0 }; - unsigned long _acc { 0 }; - unsigned long _acc_cnt { 0 }; + uint64_t _avg { 0 }; + uint64_t _avg_cnt { 0 }; + uint64_t _acc { 0 }; + uint64_t _acc_cnt { 0 }; public: void flush() { - unsigned long acc_avg = _acc / _acc_cnt; + uint64_t acc_avg = _acc / _acc_cnt; if (!_avg_cnt) { _avg = _avg + acc_avg; } else { float acc_fac = (float)_acc_cnt / _avg_cnt; @@ -518,22 +467,22 @@ struct Fast_polling : Test _acc_cnt = 0; } - void add(unsigned long add) + void add(uint64_t add) { - if (add > (~0UL - _acc)) { + if (add > (~(uint64_t)0 - _acc)) { flush(); } _acc += add; _acc_cnt++; } - unsigned long avg() + uint64_t avg() { if (_acc_cnt) { flush(); } return _avg; } - unsigned long avg_cnt() + uint64_t avg_cnt() { if (_acc_cnt) { flush(); } @@ -541,7 +490,7 @@ struct Fast_polling : Test } }; - unsigned long delay_us(unsigned poll) + uint64_t delay_us(unsigned poll) { return local_us_1_buf.value[poll - 1] > local_us_1_buf.value[poll] ? local_us_1_buf.value[poll - 1] - local_us_1_buf.value[poll] : @@ -554,17 +503,17 @@ struct Fast_polling : Test for (unsigned long max_cnt = 1000UL * 1000UL; ; max_cnt *= 2) { /* measure consumed time of a limited busy loop */ - unsigned long volatile start_ms = timer_2.elapsed_ms(); + uint64_t volatile start_ms = timer_2.elapsed_ms(); for (unsigned long volatile cnt = 0; cnt < max_cnt; cnt++) { } - unsigned long volatile end_ms = timer_2.elapsed_ms(); + uint64_t volatile end_ms = timer_2.elapsed_ms(); /* * We only return the result if the loop was time intensive enough * and therefore representative. Otherwise we raise the loop- * counter limit and do a new estimation. */ - unsigned long diff_ms = end_ms - start_ms; - if (diff_ms > 1000UL) { + uint64_t diff_ms = end_ms - start_ms; + if (diff_ms > 1000) { return max_cnt / diff_ms; } } } @@ -595,8 +544,8 @@ struct Fast_polling : Test unsigned long nr_of_polls = MAX_NR_OF_POLLS; unsigned long delay_loops_per_poll_ = delay_loops_per_poll[round]; - unsigned long end_remote_us = timer_2.elapsed_us() + - MIN_ROUND_DURATION_MS * 1000UL; + uint64_t end_remote_us = timer_2.elapsed_us() + + MIN_ROUND_DURATION_MS * 1000; /* limit polling to our buffer capacity */ for (unsigned poll = 0; poll < nr_of_polls; poll++) { @@ -612,9 +561,9 @@ struct Fast_polling : Test * access wont raise the delay between the reading of the * different time values. */ - unsigned long volatile local_us_1; - unsigned long volatile local_us_2; - unsigned long volatile remote_us; + uint64_t volatile local_us_1; + uint64_t volatile local_us_2; + uint64_t volatile remote_us; /* read local time before the remote time reading */ local_us_1 = timer.curr_time().trunc_to_plain_us().value; @@ -668,7 +617,7 @@ struct Fast_polling : Test unsigned nr_of_bad_polls = 0; for (unsigned poll = 0; poll < nr_of_polls; poll++) { - unsigned long const poll_latency_us = + uint64_t const poll_latency_us = local_us_2_buf.value[poll] - local_us_1_buf.value[poll]; if (remote_us_buf.value[poll] && @@ -717,7 +666,7 @@ struct Fast_polling : Test * whole test round. */ Average_accumulator avg_time_err_us; - unsigned long max_time_err_us = 0UL; + uint64_t max_time_err_us = 0; for (unsigned poll = 0; poll < nr_of_polls; poll++) { @@ -729,11 +678,11 @@ struct Fast_polling : Test if (!remote_us_buf.value[poll]) { continue; } - unsigned long const remote_us = remote_us_buf.value[poll]; - unsigned long const local_us = local_us_1_buf.value[poll]; - unsigned long const time_err_us = remote_us > local_us ? - remote_us - local_us : - local_us - remote_us; + uint64_t const remote_us = remote_us_buf.value[poll]; + uint64_t const local_us = local_us_1_buf.value[poll]; + uint64_t const time_err_us = remote_us > local_us ? + remote_us - local_us : + local_us - remote_us; /* update max time error */ if (time_err_us > max_time_err_us) { @@ -743,14 +692,14 @@ struct Fast_polling : Test avg_time_err_us.add(time_err_us); } Average_accumulator avg_delay_err_us; - unsigned long avg_delay_us_ = avg_delay_us.avg(); + uint64_t avg_delay_us_ = avg_delay_us.avg(); /* * Calculate the average error of the delays compared to the * average delay (in microseconds and percent of the average * delay). */ - unsigned long max_delay_err_us = 0; + uint64_t max_delay_err_us = 0; for (unsigned poll = 1; poll < nr_of_polls; poll++) { /* skip if this result was dismissed */ @@ -759,10 +708,10 @@ struct Fast_polling : Test continue; } - unsigned long delay_us_ = delay_us(poll); - unsigned long delay_err_us = delay_us_ > avg_delay_us_ ? - delay_us_ - avg_delay_us_ : - avg_delay_us_ - delay_us_; + uint64_t delay_us_ = delay_us(poll); + uint64_t delay_err_us = delay_us_ > avg_delay_us_ ? + delay_us_ - avg_delay_us_ : + avg_delay_us_ - delay_us_; if (delay_err_us > max_delay_err_us) { max_delay_err_us = delay_err_us; } @@ -770,8 +719,8 @@ struct Fast_polling : Test avg_delay_err_us.add(delay_err_us); } - unsigned long const max_avg_delay_err_us = (unsigned long)MAX_AVG_DELAY_ERR_US + - avg_delay_us_ / 20; + uint64_t const max_avg_delay_err_us = (uint64_t)MAX_AVG_DELAY_ERR_US + + avg_delay_us_ / 20; bool const error_nr_of_good_polls = (nr_of_good_polls < MIN_NR_OF_POLLS); bool const error_nr_of_time_cmprs = (avg_time_err_us.avg_cnt() < MIN_TIME_COMPARISONS); @@ -785,14 +734,14 @@ struct Fast_polling : Test error_cnt += error_max_time_err; error_cnt += error_avg_delay_err; - log(error_nr_of_good_polls ? "\033[31mbad: " : "good: ", "nr of good polls ", nr_of_good_polls, " (min ", (unsigned)MIN_NR_OF_POLLS, ")\033[0m"); - log( " ", "nr of bad polls ", nr_of_bad_polls ); - log(error_nr_of_time_cmprs ? "\033[31mbad: " : "good: ", "nr of time comparisons ", avg_time_err_us.avg_cnt(), " (min ", (unsigned)MIN_TIME_COMPARISONS, ")\033[0m"); - log(error_avg_time_err ? "\033[31mbad: " : "good: ", "average time error ", avg_time_err_us.avg(), " us (max ", (unsigned long)max_avg_time_err_us, " us)\033[0m"); - log(error_max_time_err ? "\033[31mbad: " : "good: ", "maximum time error ", max_time_err_us, " us (max ", (unsigned long)MAX_TIME_ERR_US, " us)\033[0m"); - log( " ", "average delay ", avg_delay_us.avg(), " us" ); - log(error_avg_delay_err ? "\033[31mbad: " : "good: ", "average delay error ", avg_delay_err_us.avg(), " us (max ", max_avg_delay_err_us, " us)\033[0m"); - log( " ", "maximum delay error ", max_delay_err_us, " us" ); + log(error_nr_of_good_polls ? "\033[31mbad: " : "good: ", "nr of good polls ", nr_of_good_polls, " (min ", (unsigned)MIN_NR_OF_POLLS, ")\033[0m"); + log( " ", "nr of bad polls ", nr_of_bad_polls ); + log(error_nr_of_time_cmprs ? "\033[31mbad: " : "good: ", "nr of time comparisons ", avg_time_err_us.avg_cnt(), " (min ", (unsigned)MIN_TIME_COMPARISONS, ")\033[0m"); + log(error_avg_time_err ? "\033[31mbad: " : "good: ", "average time error ", avg_time_err_us.avg(), " us (max ", (uint64_t)max_avg_time_err_us, " us)\033[0m"); + log(error_max_time_err ? "\033[31mbad: " : "good: ", "maximum time error ", max_time_err_us, " us (max ", (uint64_t)MAX_TIME_ERR_US, " us)\033[0m"); + log( " ", "average delay ", avg_delay_us.avg(), " us" ); + log(error_avg_delay_err ? "\033[31mbad: " : "good: ", "average delay error ", avg_delay_err_us.avg(), " us (max ", max_avg_delay_err_us, " us)\033[0m"); + log( " ", "maximum delay error ", max_delay_err_us, " us" ); } done.submit(); diff --git a/repos/os/src/test/vfs_stress/main.cc b/repos/os/src/test/vfs_stress/main.cc index c2ba5230f..cc325dd87 100644 --- a/repos/os/src/test/vfs_stress/main.cc +++ b/repos/os/src/test/vfs_stress/main.cc @@ -541,7 +541,7 @@ void Component::construct(Genode::Env &env) MAX_DEPTH = config_xml.attribute_value("depth", 16U); - unsigned long elapsed_ms; + uint64_t elapsed_ms; Timer::Connection timer(env); /* populate the directory file system at / */ diff --git a/repos/os/xsd/timeout_types.xsd b/repos/os/xsd/timeout_types.xsd index 1eefb1281..d8848e070 100644 --- a/repos/os/xsd/timeout_types.xsd +++ b/repos/os/xsd/timeout_types.xsd @@ -4,7 +4,7 @@ - + diff --git a/repos/ports/src/noux/syscall.cc b/repos/ports/src/noux/syscall.cc index 0dd160320..67251b901 100644 --- a/repos/ports/src/noux/syscall.cc +++ b/repos/ports/src/noux/syscall.cc @@ -307,8 +307,8 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc) int _rd_array[in_fds_total]; int _wr_array[in_fds_total]; - unsigned long timeout_sec = _sysio.select_in.timeout.sec; - unsigned long timeout_usec = _sysio.select_in.timeout.usec; + Genode::uint64_t timeout_sec = _sysio.select_in.timeout.sec; + Genode::uint64_t timeout_usec = _sysio.select_in.timeout.usec; bool timeout_reached = false; diff --git a/repos/ports/src/virtualbox5/accloff/sup.cc b/repos/ports/src/virtualbox5/accloff/sup.cc index 800f605e5..032d49b2a 100644 --- a/repos/ports/src/virtualbox5/accloff/sup.cc +++ b/repos/ports/src/virtualbox5/accloff/sup.cc @@ -104,7 +104,7 @@ uint64_t genode_cpu_hz() { } -void genode_update_tsc(void (*update_func)(void), unsigned long update_us) +void genode_update_tsc(void (*update_func)(void), Genode::uint64_t update_us) { using namespace Genode; diff --git a/repos/ports/src/virtualbox5/spec/nova/sup.cc b/repos/ports/src/virtualbox5/spec/nova/sup.cc index 31d3f19b9..90e2cd402 100644 --- a/repos/ports/src/virtualbox5/spec/nova/sup.cc +++ b/repos/ports/src/virtualbox5/spec/nova/sup.cc @@ -706,7 +706,7 @@ uint64_t genode_cpu_hz() } -void genode_update_tsc(void (*update_func)(void), unsigned long update_us) +void genode_update_tsc(void (*update_func)(void), Genode::uint64_t update_us) { using namespace Genode; using namespace Nova; diff --git a/repos/ports/src/virtualbox5/sup.h b/repos/ports/src/virtualbox5/sup.h index 05f12958d..78b8de7a4 100644 --- a/repos/ports/src/virtualbox5/sup.h +++ b/repos/ports/src/virtualbox5/sup.h @@ -41,7 +41,7 @@ bool create_emt_vcpu(pthread_t * pthread, size_t stack, uint64_t genode_cpu_hz(); -void genode_update_tsc(void (*update_func)(void), unsigned long update_us); +void genode_update_tsc(void (*update_func)(void), Genode::uint64_t update_us); Genode::Cpu_session * get_vcpu_cpu_session();