mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01: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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,10 +20,11 @@
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
using addr_t = Genode::addr_t;
|
||||
using size_t = Genode::size_t;
|
||||
using capid_t = Genode::uint16_t;
|
||||
using time_t = unsigned long;
|
||||
using addr_t = Genode::addr_t;
|
||||
using size_t = Genode::size_t;
|
||||
using capid_t = Genode::uint16_t;
|
||||
using time_t = Genode::uint64_t;
|
||||
using timeout_t = Genode::uint32_t;
|
||||
|
||||
constexpr capid_t cap_id_invalid() { return 0; }
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Kernel
|
||||
{
|
||||
typedef Genode::uint32_t Call_arg;
|
||||
typedef Genode::uint32_t Call_ret;
|
||||
typedef Genode::uint64_t Call_ret_64;
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__SPEC__ARM__KERNEL__INTERFACE_SUPPORT_H_ */
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Kernel
|
||||
{
|
||||
typedef Genode::uint64_t Call_arg;
|
||||
typedef Genode::uint64_t Call_ret;
|
||||
typedef Genode::uint64_t Call_ret_64;
|
||||
}
|
||||
|
||||
#endif /* _KERNEL__INTERFACE_SUPPORT_H_ */
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Kernel
|
||||
{
|
||||
typedef Genode::uint64_t Call_arg;
|
||||
typedef Genode::uint64_t Call_ret;
|
||||
typedef Genode::uint64_t Call_ret_64;
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__SPEC__X86_64__KERNEL__INTERFACE_SUPPORT_H_ */
|
||||
|
||||
Reference in New Issue
Block a user