mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 11:27:29 +00:00
base: tie quota_lim_downscale template to size_t
* Always use size_t instead of template type * Thereby we can remove 128-bit type from all architectures in base-hw Ref genodelabs/genode#5310
This commit is contained in:
parent
7770285aed
commit
6afe4f79a2
@ -33,7 +33,7 @@ Dataspace_capability Cpu_thread_component::utcb()
|
||||
Cpu_session::Quota Cpu_session_component::quota()
|
||||
{
|
||||
size_t const spu = Kernel::cpu_quota_us;
|
||||
size_t const u = quota_lim_downscale<sizet_arithm_t>(_quota, spu);
|
||||
size_t const u = quota_lim_downscale(_quota, spu);
|
||||
return { spu, u };
|
||||
}
|
||||
|
||||
|
@ -92,9 +92,6 @@ void Kernel::main_handle_kernel_entry()
|
||||
|
||||
void Kernel::main_initialize_and_handle_kernel_entry()
|
||||
{
|
||||
static_assert(sizeof(Core::sizet_arithm_t) >= 2 * sizeof(size_t),
|
||||
"Bad result type for size_t arithmetics.");
|
||||
|
||||
using Boot_info = Hw::Boot_info<Board::Boot_info>;
|
||||
|
||||
static volatile bool instance_initialized { false };
|
||||
|
@ -302,12 +302,11 @@ Cpu_job * Thread::helping_destination() {
|
||||
size_t Thread::_core_to_kernel_quota(size_t const quota) const
|
||||
{
|
||||
using Genode::Cpu_session;
|
||||
using Core::sizet_arithm_t;
|
||||
|
||||
/* we assert at timer construction that cpu_quota_us in ticks fits size_t */
|
||||
size_t const ticks = (size_t)
|
||||
_cpu->timer().us_to_ticks(Kernel::cpu_quota_us);
|
||||
return Cpu_session::quota_lim_downscale<sizet_arithm_t>(quota, ticks);
|
||||
return Cpu_session::quota_lim_downscale(quota, ticks);
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,8 +38,7 @@ namespace Board { class Address_space_id_allocator; }
|
||||
namespace Core {
|
||||
|
||||
struct Cpu;
|
||||
using sizet_arithm_t = __uint128_t;
|
||||
using uint128_t = __uint128_t;
|
||||
using uint128_t = __uint128_t;
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,8 +43,6 @@ namespace Core {
|
||||
* CPU driver for core
|
||||
*/
|
||||
class Cpu;
|
||||
|
||||
using sizet_arithm_t = __uint128_t;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,6 @@ namespace Board { class Address_space_id_allocator; }
|
||||
namespace Core {
|
||||
|
||||
class Cpu;
|
||||
using sizet_arithm_t = __uint128_t;
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,9 +204,8 @@ struct Genode::Cpu_session : Session
|
||||
/**
|
||||
* Scale down 'value' from the 'QUOTA_LIMIT' space to a space with 'limit'
|
||||
*/
|
||||
template<typename T = size_t>
|
||||
static size_t quota_lim_downscale(size_t const value, size_t const limit) {
|
||||
return (size_t)(((T)value * limit) >> Cpu_session::QUOTA_LIMIT_LOG2); }
|
||||
return (size_t)(((uint64_t)value * limit) >> Cpu_session::QUOTA_LIMIT_LOG2); }
|
||||
|
||||
|
||||
/*****************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user