9#include <l4/re/util/debug>
11struct Err : L4Re::Util::Err
13 Err(Level l = Fatal) :
L4Re::Util::Err(l,
"VSwitch") {}
16class Dbg :
public L4Re::Util::Dbg
21 Verbosity_mask = (1UL << Verbosity_shift) - 1
26 enum Verbosity :
unsigned long
52 static_assert(Max_component * Verbosity_shift <=
sizeof(level) * 8,
53 "Too many components for level mask");
54 static_assert((Max_verbosity & Verbosity_mask) == Max_verbosity,
55 "Verbosity_shift to small for verbosity levels");
62 static void set_verbosity(
unsigned mask)
64 for (
unsigned i = 0; i < Max_component; ++i)
65 set_verbosity(i, mask);
74 static void set_verbosity(
unsigned c,
unsigned mask)
76 level &= ~(Verbosity_mask << (Verbosity_shift * c));
77 level |= (mask & Verbosity_mask) << (Verbosity_shift * c);
89 static bool is_active(
unsigned c,
unsigned mask)
90 {
return level & (mask & Verbosity_mask) << (Verbosity_shift * c); }
98 using L4Re::Util::Dbg::is_active;
100 Dbg(Component c = Core, Verbosity v = Warn,
char const *subsys =
"")
101 :
L4Re::Util::Dbg(v << (Verbosity_shift * c),
"SWI", subsys)
106 static void set_verbosity(
unsigned) {}
107 static void set_verbosity(
unsigned,
unsigned) {}
109 static bool is_active(
unsigned,
unsigned) {
return false; }
110 using L4Re::Util::Dbg::is_active;
112 Dbg(Component c = Core, Verbosity v = Warn,
char const *subsys =
"")
113 :
L4Re::Util::Dbg(v << (Verbosity_shift * c),
"", subsys)