mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-21 16:39:39 +00:00
hw: increase timing accuracy of kernel (fix #3081)
* Introduce 64-bit tick counter * Let the timer always count when possible, also if it already fired * Simplify the kernel syscall API to have one current time call, which returns the elapsed microseconds since boot
This commit is contained in:
committed by
Christian Helmuth
parent
2ecf1d887b
commit
80fa23da5e
@ -40,7 +40,6 @@ namespace Kernel
|
||||
constexpr Call_arg call_id_ack_cap() { return 14; }
|
||||
constexpr Call_arg call_id_delete_cap() { return 15; }
|
||||
constexpr Call_arg call_id_timeout() { return 16; }
|
||||
constexpr Call_arg call_id_timeout_age_us() { return 17; }
|
||||
constexpr Call_arg call_id_timeout_max_us() { return 18; }
|
||||
constexpr Call_arg call_id_time() { return 19; }
|
||||
|
||||
@ -80,6 +79,8 @@ namespace Kernel
|
||||
Call_arg arg_4,
|
||||
Call_arg arg_5);
|
||||
|
||||
Call_ret_64 call64(Call_arg arg_0);
|
||||
|
||||
|
||||
/**
|
||||
* Install timeout for calling thread
|
||||
@ -90,23 +91,12 @@ namespace Kernel
|
||||
* This call always overwrites the last timeout installed by the thread
|
||||
* if any.
|
||||
*/
|
||||
inline int timeout(time_t const duration_us, capid_t const sigid)
|
||||
inline int timeout(timeout_t const duration_us, capid_t const sigid)
|
||||
{
|
||||
return call(call_id_timeout(), duration_us, sigid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return time in microseconds since the caller installed its last timeout
|
||||
*
|
||||
* Must not be called if the installation is older than 'timeout_max_us'.
|
||||
*/
|
||||
inline time_t timeout_age_us()
|
||||
{
|
||||
return call(call_id_timeout_age_us());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return value of a free-running, uniform counter
|
||||
*
|
||||
@ -115,7 +105,7 @@ namespace Kernel
|
||||
*/
|
||||
inline time_t time()
|
||||
{
|
||||
return call(call_id_time());
|
||||
return call64(call_id_time());
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +117,7 @@ namespace Kernel
|
||||
*/
|
||||
inline time_t timeout_max_us()
|
||||
{
|
||||
return call(call_id_timeout_max_us());
|
||||
return call64(call_id_timeout_max_us());
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user