From 6d02c4c89f24ed053e10020162bdfce64ee76fda Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Fri, 12 Dec 2014 11:27:07 +0100 Subject: [PATCH] vbox: use power of two priority levels Avoids warnings of init in form of "priority band too small, losing least-significant priority bits" when virtualbox starts threads. Fixes #1323 --- repos/ports/src/virtualbox/thread.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/repos/ports/src/virtualbox/thread.cc b/repos/ports/src/virtualbox/thread.cc index 1663fa6cd..7dfca6b23 100644 --- a/repos/ports/src/virtualbox/thread.cc +++ b/repos/ports/src/virtualbox/thread.cc @@ -42,8 +42,12 @@ static Genode::Cpu_session * get_cpu_session(RTTHREADTYPE type) { if (con[type - 1]) return con[type - 1]; - long const prio = (RTTHREADTYPE_END - type) * - (Cpu_session::PRIORITY_LIMIT / RTTHREADTYPE_END); + unsigned const VIRTUAL_GENODE_VBOX_LEVELS = 16; + static_assert (RTTHREADTYPE_END < VIRTUAL_GENODE_VBOX_LEVELS, + "prio levels exceeds VIRTUAL_GENODE_VBOX_LEVELS"); + + long const prio = (VIRTUAL_GENODE_VBOX_LEVELS - type) * + Cpu_session::PRIORITY_LIMIT / VIRTUAL_GENODE_VBOX_LEVELS; char * data = new (env()->heap()) char[16];