diff --git a/repos/base-fiasco/src/core/include/map_local.h b/repos/base-fiasco/src/core/include/map_local.h
index 9a0c30317..8006eeaf1 100644
--- a/repos/base-fiasco/src/core/include/map_local.h
+++ b/repos/base-fiasco/src/core/include/map_local.h
@@ -63,8 +63,9 @@ namespace Genode {
L4_IPC_NEVER, &ipc_result);
if (L4_IPC_IS_ERROR(ipc_result)) {
- PWRN("could not locally remap 0x%lx to 0x%lx, error code is %ld",
- from_addr, to_addr, L4_IPC_ERROR(ipc_result));
+ warning("could not locally remap ", Hex(from_addr), " "
+ "to ", Hex(to_addr), ", "
+ "error code is ", L4_IPC_ERROR(ipc_result));
return false;
}
}
@@ -79,7 +80,7 @@ namespace Genode {
*/
inline void unmap_local(addr_t virt, size_t num_pages)
{
- PERR("unmap_local() called - not implemented yet");
+ error("unmap_local() called - not implemented yet");
}
}
diff --git a/repos/base-fiasco/src/core/include/platform_pd.h b/repos/base-fiasco/src/core/include/platform_pd.h
index a0f444887..51bf456a7 100644
--- a/repos/base-fiasco/src/core/include/platform_pd.h
+++ b/repos/base-fiasco/src/core/include/platform_pd.h
@@ -191,7 +191,7 @@ namespace Genode {
* On L4/Fiasco, we don't use directed unmap but rely on the
* in-kernel mapping database. See 'region_map_support.cc'.
*/
- void flush(addr_t, size_t) { PDBG("not implemented"); }
+ void flush(addr_t, size_t) { warning(__func__, " not implemented"); }
};
}
diff --git a/repos/base-fiasco/src/core/io_mem_session_support.cc b/repos/base-fiasco/src/core/io_mem_session_support.cc
index 8f247a829..ffe6b6b5c 100644
--- a/repos/base-fiasco/src/core/io_mem_session_support.cc
+++ b/repos/base-fiasco/src/core/io_mem_session_support.cc
@@ -83,7 +83,8 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
L4_IPC_NEVER, &result, &tag);
if (err || !l4_ipc_fpage_received(result)) {
- PERR("%d %d", err, l4_ipc_fpage_received(result));
+ error("map_local failed err=", err, " "
+ "(", l4_ipc_fpage_received(result), ")");
return 0;
}
diff --git a/repos/base-fiasco/src/core/irq_session_component.cc b/repos/base-fiasco/src/core/irq_session_component.cc
index 89202e51d..0797c9bf8 100644
--- a/repos/base-fiasco/src/core/irq_session_component.cc
+++ b/repos/base-fiasco/src/core/irq_session_component.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* core includes */
@@ -52,7 +52,7 @@ bool Irq_object::_associate()
L4_IPC_SHORT_MSG, &dw0, &dw1,
L4_IPC_BOTH_TIMEOUT_0, &result);
- if (err != L4_IPC_RETIMEOUT) PERR("IRQ association failed");
+ if (err != L4_IPC_RETIMEOUT) error("IRQ association failed");
return (err == L4_IPC_RETIMEOUT);
}
@@ -74,7 +74,7 @@ void Irq_object::_wait_for_irq()
L4_IPC_SHORT_MSG, &dw0, &dw1,
L4_IPC_NEVER, &result);
- if (L4_IPC_IS_ERROR(result)) PERR("Ipc error %lx", L4_IPC_ERROR(result));
+ if (L4_IPC_IS_ERROR(result)) error("Ipc error ", L4_IPC_ERROR(result));
} while (L4_IPC_IS_ERROR(result));
}
@@ -89,7 +89,7 @@ void Irq_object::start()
void Irq_object::entry()
{
if (!_associate()) {
- PERR("Could not associate with IRQ 0x%x", _irq);
+ error("Could not associate with IRQ ", _irq);
return;
}
@@ -133,7 +133,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
throw Root::Unavailable();
if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).error()) {
- PERR("Unavailable IRQ 0x%x requested", _irq_number);
+ error("Unavailable IRQ ", _irq_number, " requested");
throw Root::Unavailable();
}
@@ -143,7 +143,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
Irq_session_component::~Irq_session_component()
{
- PERR("Not yet implemented.");
+ error("Not yet implemented.");
}
diff --git a/repos/base-fiasco/src/core/pager.cc b/repos/base-fiasco/src/core/pager.cc
index 8aa7655f3..267d86614 100644
--- a/repos/base-fiasco/src/core/pager.cc
+++ b/repos/base-fiasco/src/core/pager.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
/* core includes */
#include
@@ -45,7 +45,7 @@ void Ipc_pager::wait_for_fault()
L4_IPC_NEVER, &result);
if (L4_IPC_IS_ERROR(result))
- PERR("Ipc error %lx", L4_IPC_ERROR(result));
+ error(__func__, ": IPC error ", Hex(L4_IPC_ERROR(result)));
} while (L4_IPC_IS_ERROR(result));
}
@@ -62,7 +62,7 @@ void Ipc_pager::reply_and_wait_for_fault()
L4_IPC_SEND_TIMEOUT_0, &result);
if (L4_IPC_IS_ERROR(result)) {
- PERR("Ipc error %lx", L4_IPC_ERROR(result));
+ error(__func__, ": IPC error ", Hex(L4_IPC_ERROR(result)));
/* ignore all errors and wait for next proper message */
wait_for_fault();
diff --git a/repos/base-fiasco/src/core/platform.cc b/repos/base-fiasco/src/core/platform.cc
index 96c2636bd..77161896a 100644
--- a/repos/base-fiasco/src/core/platform.cc
+++ b/repos/base-fiasco/src/core/platform.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
#include
#include
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
/* core includes */
#include
@@ -44,11 +45,6 @@ namespace Fiasco {
using namespace Genode;
-static const bool verbose = true;
-static const bool verbose_core_pf = false;
-static const bool verbose_region_alloc = false;
-
-
/***********************************
** Core address space management **
***********************************/
@@ -107,21 +103,22 @@ static void _core_pager_loop()
if (pfa < L4_PAGESIZE) {
/* NULL pointer access */
- PERR("Possible null pointer %s in %x.%02x at %lx IP %lx",
- rw ? "WRITE" : "READ", (int)t.id.task, (int)t.id.lthread, pfa, dw1);
+ error("possible null pointer ", rw ? "WRITE" : "READ", " "
+ "in ", (int)t.id.task, ".", (int)t.id.lthread, " "
+ "at ", Hex(pfa), " IP ", dw1);
/* do not unblock faulter */
send_reply = false;
continue;
} else if (!_core_address_ranges().valid_addr(pfa)) {
/* page-fault address is not in RAM */
- PERR("%s access outside of RAM in %x.%02x at %lx IP %lx",
- rw ? "WRITE" : "READ", (int)t.id.task, (int)t.id.lthread, pfa, dw1);
+ error(rw ? "WRITE" : "READ", " access outside of RAM "
+ "in ", (int)t.id.task, ".", (int)t.id.lthread, " "
+ "at ", Hex(pfa), " IP ", dw1);
/* do not unblock faulter */
send_reply = false;
continue;
- } else if (verbose_core_pf)
- PDBG("pfa=%lx ip=%lx thread %x.%02x", pfa, dw1, (int)t.id.task, (int)t.id.lthread);
+ }
/* my pf handler is sigma0 - just touch the appropriate page */
if (rw)
@@ -205,24 +202,11 @@ struct Region
};
-/**
- * Log region
- */
-static inline void print_region(Region r)
-{
- printf("[%08lx,%08lx) %08lx", r.start, r.end, r.end - r.start);
-}
-
-
/**
* Add region to allocator
*/
static inline void add_region(Region r, Range_allocator &alloc)
{
- if (verbose_region_alloc) {
- printf("%p add: ", &alloc); print_region(r); printf("\n");
- }
-
/* adjust region */
addr_t start = trunc_page(r.start);
addr_t end = round_page(r.end);
@@ -236,10 +220,6 @@ static inline void add_region(Region r, Range_allocator &alloc)
*/
static inline void remove_region(Region r, Range_allocator &alloc)
{
- if (verbose_region_alloc) {
- printf("%p remove: ", &alloc); print_region(r); printf("\n");
- }
-
/* adjust region */
addr_t start = trunc_page(r.start);
addr_t end = round_page(r.end);
@@ -350,7 +330,7 @@ static Fiasco::l4_kernel_info_t *get_kip()
bool amok = false;
if (err) {
- printf("IPC error %d\n", err);
+ raw("IPC error ", err, " while accessing the KIP");
amok = true;
}
if (!l4_ipc_fpage_received(r)) {
@@ -367,16 +347,6 @@ static Fiasco::l4_kernel_info_t *get_kip()
if (kip->magic != L4_KERNEL_INFO_MAGIC)
panic("Sigma0 mapped something but not the KIP");
- if (verbose) {
- printf("\n");
- printf("KIP @ %p\n", kip);
- printf(" magic: %08x\n", kip->magic);
- printf(" version: %08x\n", kip->version);
- printf(" sigma0 "); printf(" esp: %08lx eip: %08lx\n", kip->sigma0_esp, kip->sigma0_eip);
- printf(" sigma1 "); printf(" esp: %08lx eip: %08lx\n", kip->sigma1_esp, kip->sigma1_eip);
- printf(" root "); printf(" esp: %08lx eip: %08lx\n", kip->root_esp, kip->root_eip);
- }
-
return kip;
}
@@ -392,7 +362,7 @@ void Platform::_setup_basics()
/* update multi-boot info pointer from KIP */
addr_t mb_info_addr = kip->user_ptr;
- if (verbose) printf("MBI @ 0x%lx\n", mb_info_addr);
+ log("MBI @ ", Hex(mb_info_addr));
/* parse memory descriptors - look for virtual memory configuration */
/* XXX we support only one VM region (here and also inside RM) */
@@ -451,10 +421,9 @@ void Platform::_setup_rom()
Rom_module *new_rom = new(core_mem_alloc()) Rom_module(rom);
_rom_fs.insert(new_rom);
- if (verbose)
- printf(" mod[%d] [%p,%p) %s\n", i,
- (void *)new_rom->addr(), ((char *)new_rom->addr()) + new_rom->size(),
- new_rom->name());
+ log(" mod[", i, "] ",
+ Hex_range(new_rom->addr(), new_rom->size()), " ",
+ new_rom->name());
/* zero remainder of last ROM page */
size_t count = L4_PAGESIZE - rom.size() % L4_PAGESIZE;
@@ -484,21 +453,21 @@ Platform::Platform() :
if (initialized) panic("Platform constructed twice!");
initialized = true;
+ init_log();
+
_setup_basics();
_setup_mem_alloc();
_setup_io_port_alloc();
_setup_irq_alloc();
_setup_rom();
- if (verbose) {
- printf(":ram_alloc: "); _ram_alloc()->dump_addr_tree();
- printf(":region_alloc: "); _region_alloc()->dump_addr_tree();
- printf(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
- printf(":io_port: "); _io_port_alloc()->dump_addr_tree();
- printf(":irq: "); _irq_alloc()->dump_addr_tree();
- printf(":rom_fs: "); _rom_fs.print_fs();
- printf(":core ranges: "); _core_address_ranges()()->dump_addr_tree();
- }
+ log(":ram_alloc: "); _ram_alloc()->dump_addr_tree();
+ log(":region_alloc: "); _region_alloc()->dump_addr_tree();
+ log(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
+ log(":io_port: "); _io_port_alloc()->dump_addr_tree();
+ log(":irq: "); _irq_alloc()->dump_addr_tree();
+ log(":rom_fs: "); _rom_fs.print_fs();
+ log(":core ranges: "); _core_address_ranges()()->dump_addr_tree();
Fiasco::l4_threadid_t myself = Fiasco::l4_myself();
diff --git a/repos/base-fiasco/src/core/platform_pd.cc b/repos/base-fiasco/src/core/platform_pd.cc
index 783a7c5cb..9442674ce 100644
--- a/repos/base-fiasco/src/core/platform_pd.cc
+++ b/repos/base-fiasco/src/core/platform_pd.cc
@@ -34,9 +34,6 @@ using namespace Fiasco;
using namespace Genode;
-static const bool verbose = false;
-
-
/**************************
** Static class members **
**************************/
@@ -189,7 +186,7 @@ int Platform_pd::_alloc_thread(int thread_id, Platform_thread *thread)
void Platform_pd::_free_thread(int thread_id)
{
if (!_threads[thread_id])
- PWRN("double-free of thread %x.%x detected", _pd_id, thread_id);
+ warning("double-free of thread ", Hex(_pd_id), ".", Hex(thread_id), " detected");
_threads[thread_id] = 0;
}
@@ -207,7 +204,7 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
int t = _alloc_thread(thread_id, thread);
if (t < 0) {
- PERR("thread alloc failed");
+ error("thread alloc failed");
return false;
}
thread_id = t;
@@ -218,7 +215,6 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
/* finally inform thread about binding */
thread->bind(thread_id, l4_thread_id, this);
- if (verbose) _debug_log_threads();
return true;
}
@@ -231,8 +227,6 @@ void Platform_pd::unbind_thread(Platform_thread *thread)
thread->unbind();
_free_thread(thread_id);
-
- if (verbose) _debug_log_threads();
}
@@ -248,7 +242,6 @@ Platform_pd::Platform_pd(Allocator * md_alloc, char const *,
int ret = _alloc_pd(pd_id);
if (ret < 0) {
- _debug_log_pds();
panic("pd alloc failed");
}
@@ -268,27 +261,3 @@ Platform_pd::~Platform_pd()
_free_pd();
}
-
-/***********************
- ** Debugging support **
- ***********************/
-
-void Platform_pd::_debug_log_threads()
-{
- int i;
- printf("[%02x] ", _pd_id);
- for (i = 0; i < THREAD_MAX; ++i) {
- printf("%c", !_threads[i] ? '.' : 'X');
- if (i == 63) printf("\n ");
- }
- printf("\n");
-}
-
-
-void Platform_pd::_debug_log_pds()
-{
- int i;
- for (i = 0; i < PD_MAX; ++i)
- printf("[%02x] %d %d %d\n", i, _pds()[i].reserved, _pds()[i].free,
- _pds()[i].version);
-}
diff --git a/repos/base-fiasco/src/core/platform_thread.cc b/repos/base-fiasco/src/core/platform_thread.cc
index e1eeed7a5..5b7d2e13a 100644
--- a/repos/base-fiasco/src/core/platform_thread.cc
+++ b/repos/base-fiasco/src/core/platform_thread.cc
@@ -15,7 +15,7 @@
*/
/* Genode includes */
-#include
+#include
#include
#include
@@ -52,7 +52,8 @@ int Platform_thread::start(void *ip, void *sp)
&old_eflags, &dummy, &dummy,
0, l4_utcb_get());
if (old_eflags == ~0UL)
- PWRN("old eflags == ~0 on ex_regs %x.%x", (int)thread.id.task, (int)thread.id.lthread);
+ warning("old eflags == ~0 on ex_regs ",
+ Hex(thread.id.task), ".", Hex(thread.id.lthread));
fiasco_register_thread_name(thread, _name);
return 0;
@@ -61,13 +62,13 @@ int Platform_thread::start(void *ip, void *sp)
void Platform_thread::pause()
{
- PDBG("not implemented");
+ warning(__func__, " not implemented");
}
void Platform_thread::resume()
{
- PDBG("not implemented");
+ warning(__func__, " not implemented");
}
@@ -99,7 +100,8 @@ void Platform_thread::unbind()
&old_eflags, &dummy, &dummy,
0, l4_utcb_get());
if (old_eflags == ~0UL)
- PWRN("old eflags == ~0 on ex_regs %x.%x", (int)thread.id.task, (int)thread.id.lthread);
+ warning("old eflags == ~0 on ex_regs ",
+ Hex(thread.id.task), ".", Hex(thread.id.lthread));
_thread_id = THREAD_INVALID;
_l4_thread_id = L4_INVALID_ID;
@@ -109,7 +111,7 @@ void Platform_thread::unbind()
void Platform_thread::state(Thread_state s)
{
- PDBG("Not implemented");
+ warning(__func__, " not implemented");
throw Cpu_thread::State_access_failed();
}
@@ -129,7 +131,8 @@ Thread_state Platform_thread::state()
&old_eflags, &ip, &sp,
L4_THREAD_EX_REGS_NO_CANCEL, l4_utcb_get());
if (old_eflags == ~0UL)
- PWRN("old eflags == ~0 on ex_regs %x.%x", (int)thread.id.task, (int)thread.id.lthread);
+ warning("old eflags == ~0 on ex_regs ",
+ Hex(thread.id.task), ".", Hex(thread.id.lthread));
/* fill thread state structure */
s.ip = ip;
diff --git a/repos/base-fiasco/src/lib/base/ipc.cc b/repos/base-fiasco/src/lib/base/ipc.cc
index 6d5719b85..a176055a2 100644
--- a/repos/base-fiasco/src/lib/base/ipc.cc
+++ b/repos/base-fiasco/src/lib/base/ipc.cc
@@ -12,7 +12,6 @@
*/
/* Genode includes */
-#include
#include
#include
#include
@@ -176,7 +175,7 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
if (L4_IPC_ERROR(ipc_result) == L4_IPC_RECANCELED)
throw Genode::Blocking_canceled();
- PERR("ipc_call error %lx", L4_IPC_ERROR(ipc_result));
+ error("ipc_call error ", Hex(L4_IPC_ERROR(ipc_result)));
throw Genode::Ipc_error();
}
@@ -204,7 +203,7 @@ void Genode::ipc_reply(Native_capability caller, Rpc_exception_code exc,
L4_IPC_SEND_TIMEOUT_0, &result);
if (L4_IPC_IS_ERROR(result))
- PERR("ipc_send error %lx, ignored", L4_IPC_ERROR(result));
+ error("ipc_send error ", Hex(L4_IPC_ERROR(result)), ", ignored");
}
@@ -251,7 +250,7 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
* incoming message.
*/
if (L4_IPC_IS_ERROR(ipc_result)) {
- PERR("ipc_reply_and_wait error %lx", L4_IPC_ERROR(ipc_result));
+ error("ipc_reply_and_wait error ", Hex(L4_IPC_ERROR(ipc_result)));
} else {
need_to_wait = false;
}
@@ -265,7 +264,7 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
L4_IPC_NEVER, &ipc_result);
if (L4_IPC_IS_ERROR(ipc_result)) {
- PERR("ipc_wait error %lx", L4_IPC_ERROR(ipc_result));
+ error("ipc_wait error ", Hex(L4_IPC_ERROR(ipc_result)));
} else {
need_to_wait = false;
}
diff --git a/repos/base-foc/src/core/include/map_local.h b/repos/base-foc/src/core/include/map_local.h
index f742cc7cc..74e22bf39 100644
--- a/repos/base-foc/src/core/include/map_local.h
+++ b/repos/base-foc/src/core/include/map_local.h
@@ -107,12 +107,12 @@ namespace Genode {
l4_msgtag_t tag = l4_msgtag(L4_PROTO_SIGMA0, 2, 0, 0);
tag = l4_ipc_call(L4_BASE_PAGER_CAP, l4_utcb(), tag, L4_IPC_NEVER);
if (l4_ipc_error(tag, l4_utcb())) {
- PERR("Ipc error %ld", l4_ipc_error(tag, l4_utcb()));
+ error("Ipc error ", l4_ipc_error(tag, l4_utcb()));
return false;
}
if (l4_msgtag_items(tag) < 1) {
- PERR("Got no mapping!");
+ error("got no mapping!");
return false;
}
diff --git a/repos/base-foc/src/core/include/platform_pd.h b/repos/base-foc/src/core/include/platform_pd.h
index 2fbcce33a..9a2dd8003 100644
--- a/repos/base-foc/src/core/include/platform_pd.h
+++ b/repos/base-foc/src/core/include/platform_pd.h
@@ -112,7 +112,7 @@ namespace Genode {
* On Fiasco.OC, we don't use directed unmap but rely on the
* in-kernel mapping database. See 'region_map_support.cc'.
*/
- void flush(addr_t, size_t) { PDBG("not implemented"); }
+ void flush(addr_t, size_t) { warning(__func__, " not implemented"); }
};
}
diff --git a/repos/base-foc/src/core/io_mem_session_support.cc b/repos/base-foc/src/core/io_mem_session_support.cc
index cc82bbf83..f7b5cbd3f 100644
--- a/repos/base-foc/src/core/io_mem_session_support.cc
+++ b/repos/base-foc/src/core/io_mem_session_support.cc
@@ -39,7 +39,7 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
return 0;
if (!map_local_io(base, (addr_t)local_base, size >> get_page_size_log2())) {
- PERR("map_local_io failed\n");
+ error("map_local_io failed");
return 0;
}
diff --git a/repos/base-foc/src/core/ipc_pager.cc b/repos/base-foc/src/core/ipc_pager.cc
index 3f2abc5fa..2b041bb0b 100644
--- a/repos/base-foc/src/core/ipc_pager.cc
+++ b/repos/base-foc/src/core/ipc_pager.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* core includes */
@@ -82,7 +82,7 @@ void Ipc_pager::wait_for_fault()
_parse(label);
return;
}
- PERR("Ipc error %d in pagefault from %lx", err, label & ~0x3);
+ error("Ipc error ", err, " in pagefault from ", Hex(label & ~0x3));
} while (true);
}
@@ -115,7 +115,7 @@ void Ipc_pager::reply_and_wait_for_fault()
&label, L4_IPC_SEND_TIMEOUT_0);
int err = l4_ipc_error(_tag, l4_utcb());
if (err) {
- PERR("Ipc error %d in pagefault from %lx", err, label & ~0x3);
+ error("Ipc error ", err, " in pagefault from ", Hex(label & ~0x3));
wait_for_fault();
} else
_parse(label);
diff --git a/repos/base-foc/src/core/irq_session_component.cc b/repos/base-foc/src/core/irq_session_component.cc
index b48e18b3d..f03dcd187 100644
--- a/repos/base-foc/src/core/irq_session_component.cc
+++ b/repos/base-foc/src/core/irq_session_component.cc
@@ -14,7 +14,7 @@
*/
/* Genode includes */
-#include
+#include
#include
#include
@@ -100,9 +100,8 @@ bool Genode::Irq_object::associate(unsigned irq, bool msi,
_polarity = polarity;
using namespace Fiasco;
- if (l4_error(l4_factory_create_irq(L4_BASE_FACTORY_CAP,
- _capability()))) {
- PERR("l4_factory_create_irq failed!");
+ if (l4_error(l4_factory_create_irq(L4_BASE_FACTORY_CAP, _capability()))) {
+ error("l4_factory_create_irq failed!");
return false;
}
@@ -111,7 +110,7 @@ bool Genode::Irq_object::associate(unsigned irq, bool msi,
gsi |= L4_ICU_FLAG_MSI;
if (l4_error(l4_icu_bind(L4_BASE_ICU_CAP, gsi, _capability()))) {
- PERR("Binding IRQ %u to the ICU failed", _irq);
+ error("Binding IRQ ", _irq, " to the ICU failed");
return false;
}
@@ -121,13 +120,13 @@ bool Genode::Irq_object::associate(unsigned irq, bool msi,
if (l4_error(l4_irq_attach(_capability(), reinterpret_cast(this),
Interrupt_handler::handler_cap()))) {
- PERR("Error attaching to IRQ %u", _irq);
+ error("cannot attach to IRQ ", _irq);
return false;
}
if (_msi_addr && l4_error(l4_icu_msi_info(L4_BASE_ICU_CAP, gsi,
&_msi_data))) {
- PERR("Error getting MSI info");
+ error("cannot get MSI info");
return false;
}
@@ -142,7 +141,7 @@ void Genode::Irq_object::ack_irq()
int err;
l4_msgtag_t tag = l4_irq_unmask(_capability());
if ((err = l4_ipc_error(tag, l4_utcb())))
- PERR("IRQ unmask: %d\n", err);
+ error("IRQ unmask: ", err);
}
@@ -167,10 +166,10 @@ Genode::Irq_object::~Irq_object()
gsi |= L4_ICU_FLAG_MSI;
if (l4_error(l4_irq_detach(_capability())))
- PERR("Error detaching IRQ");
+ error("cannot detach IRQ");
if (l4_error(l4_icu_unbind(L4_BASE_ICU_CAP, gsi, _capability())))
- PERR("Error unbinding IRQ");
+ error("cannot unbind IRQ");
cap_map()->remove(_cap);
}
@@ -191,13 +190,13 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
long msi = Arg_string::find_arg(args, "device_config_phys").long_value(0);
if (msi) {
if (msi_alloc.get(irq_args.irq_number(), 1)) {
- PERR("Unavailable MSI %ld requested.", irq_args.irq_number());
+ error("unavailable MSI ", irq_args.irq_number(), " requested");
throw Root::Unavailable();
}
msi_alloc.set(irq_args.irq_number(), 1);
} else {
if (!irq_alloc || irq_alloc->alloc_addr(1, irq_args.irq_number()).error()) {
- PERR("Unavailable IRQ %ld requested.", irq_args.irq_number());
+ error("unavailable IRQ ", irq_args.irq_number(), " requested");
throw Root::Unavailable();
}
}
@@ -263,7 +262,7 @@ void Interrupt_handler::entry()
while (true) {
tag = l4_ipc_wait(l4_utcb(), &label, L4_IPC_NEVER);
if ((err = l4_ipc_error(tag, l4_utcb())))
- PERR("IRQ receive: %d\n", err);
+ error("IRQ receive: ", err);
else {
Irq_object * irq_object = reinterpret_cast(label);
irq_object->notify();
diff --git a/repos/base-foc/src/core/pager.cc b/repos/base-foc/src/core/pager.cc
index eb6f521e5..b998bc5a4 100644
--- a/repos/base-foc/src/core/pager.cc
+++ b/repos/base-foc/src/core/pager.cc
@@ -15,7 +15,7 @@
/* Genode includes */
#include
-#include
+#include
#include
/* core includes */
@@ -48,12 +48,12 @@ void Pager_entrypoint::entry()
apply(_pager.badge(), [&] (Pager_object *obj) {
/* the pager_object might be destroyed, while we got the message */
if (!obj) {
- PWRN("No pager object found!");
+ warning("no pager object found!");
return;
}
switch (_pager.msg_type()) {
-
+
case Ipc_pager::PAGEFAULT:
case Ipc_pager::EXCEPTION:
{
@@ -69,8 +69,9 @@ void Pager_entrypoint::entry()
/* handle request */
if (obj->pager(_pager)) {
/* could not resolv - leave thread in pagefault */
- PDBG("Could not resolve pf=%p ip=%p",
- (void*)_pager.fault_addr(), (void*)_pager.fault_ip());
+ warning("could not resolve "
+ "pf=", Hex(_pager.fault_addr()), " ",
+ "ip=", Hex(_pager.fault_ip()));
} else {
_pager.set_reply_dst(Native_thread(obj->badge()));
reply_pending = true;
@@ -131,7 +132,7 @@ void Pager_entrypoint::entry()
}
default:
- PERR("Got unknown message type %x!", _pager.msg_type());
+ error("got unknown message type ", Hex(_pager.msg_type()));
}
});
};
diff --git a/repos/base-foc/src/core/platform.cc b/repos/base-foc/src/core/platform.cc
index 1dbac6c97..f9f470579 100644
--- a/repos/base-foc/src/core/platform.cc
+++ b/repos/base-foc/src/core/platform.cc
@@ -13,7 +13,7 @@
*/
/* Genode includes */
-#include
+#include
#include
#include
#include
@@ -21,6 +21,7 @@
/* base-internal includes */
#include
#include
+#include
/* core includes */
#include
@@ -47,11 +48,6 @@ static l4_kernel_info_t *kip;
using namespace Genode;
-static const bool verbose = true;
-static const bool verbose_core_pf = false;
-static const bool verbose_region_alloc = false;
-
-
/***********************************
** Core address space management **
***********************************/
@@ -90,7 +86,7 @@ static void _core_pager_loop()
tag = l4_ipc_wait(utcb, &label, L4_IPC_NEVER);
if (!tag.is_page_fault()) {
- PWRN("Received something different than a pagefault, ignoring ...");
+ warning("received something different than a pagefault, ignoring ...");
continue;
}
@@ -102,21 +98,20 @@ static void _core_pager_loop()
if (pfa < (l4_umword_t)L4_PAGESIZE) {
/* NULL pointer access */
- PERR("Possible null pointer %s at %lx IP %lx",
- rw ? "WRITE" : "READ", pfa, ip);
+ error("Possible null pointer ", rw ? "WRITE" : "READ", " "
+ "at ", Hex(pfa), " IP ", Hex(ip));
/* do not unblock faulter */
send_reply = false;
continue;
} else if (!_core_address_ranges().valid_addr(pfa)) {
/* page-fault address is not in RAM */
- PERR("%s access outside of RAM at %lx IP %lx",
- rw ? "WRITE" : "READ", pfa, ip);
+ error(rw ? "WRITE" : "READ", " access outside of RAM "
+ "at ", Hex(pfa), " IP ", Hex(ip));
/* do not unblock faulter */
send_reply = false;
continue;
- } else if (verbose_core_pf)
- PDBG("pfa=%lx ip=%lx", pfa, ip);
+ }
/* my pf handler is sigma0 - just touch the appropriate page */
if (rw)
@@ -162,7 +157,7 @@ Platform::Core_pager::Core_pager(Platform_pd *core_pd, Sigma0 *sigma0)
l4_thread_control_exc_handler(thread().local.data()->kcap());
l4_msgtag_t tag = l4_thread_control_commit(L4_BASE_THREAD_CAP);
if (l4_msgtag_has_error(tag))
- PWRN("l4_thread_control_commit failed!");
+ warning("l4_thread_control_commit failed!");
}
@@ -195,24 +190,11 @@ struct Region
};
-/**
- * Log region
- */
-static inline void print_region(Region r)
-{
- printf("[%08lx,%08lx) %08lx", r.start, r.end, r.end - r.start);
-}
-
-
/**
* Add region to allocator
*/
static inline void add_region(Region r, Range_allocator &alloc)
{
- if (verbose_region_alloc) {
- printf("%p add: ", &alloc); print_region(r); printf("\n");
- }
-
/* adjust region */
addr_t start = trunc_page(r.start);
addr_t end = round_page(r.end);
@@ -226,10 +208,6 @@ static inline void add_region(Region r, Range_allocator &alloc)
*/
static inline void remove_region(Region r, Range_allocator &alloc)
{
- if (verbose_region_alloc) {
- printf("%p remove: ", &alloc); print_region(r); printf("\n");
- }
-
/* adjust region */
addr_t start = trunc_page(r.start);
addr_t end = round_page(r.end);
@@ -366,15 +344,10 @@ void Platform::_setup_basics()
if (kip->magic != L4_KERNEL_INFO_MAGIC)
panic("Sigma0 mapped something but not the KIP");
- if (verbose) {
- printf("\n");
- printf("KIP @ %p\n", kip);
- printf(" magic: %08zx\n", (size_t)kip->magic);
- printf(" version: %08zx\n", (size_t)kip->version);
- printf(" sigma0 "); printf(" esp: %08lx eip: %08lx\n", kip->sigma0_esp, kip->sigma0_eip);
- printf(" sigma1 "); printf(" esp: %08lx eip: %08lx\n", kip->sigma1_esp, kip->sigma1_eip);
- printf(" root "); printf(" esp: %08lx eip: %08lx\n", kip->root_esp, kip->root_eip);
- }
+ log("");
+ log("KIP @ ", kip);
+ log(" magic: ", Hex(kip->magic));
+ log(" version: ", Hex(kip->version));
/* add KIP as ROM module */
_kip_rom = Rom_module((addr_t)kip, L4_PAGESIZE, "l4v2_kip");
@@ -382,7 +355,7 @@ void Platform::_setup_basics()
/* update multi-boot info pointer from KIP */
addr_t mb_info_addr = kip->user_ptr;
- if (verbose) printf("MBI @ %lx\n", mb_info_addr);
+ log("MBI @ ", Hex(mb_info_addr));
/* parse memory descriptors - look for virtual memory configuration */
/* XXX we support only one VM region (here and also inside RM) */
@@ -447,11 +420,6 @@ void Platform::_setup_rom()
/* map module */
touch_ro((const void*)new_rom->addr(), new_rom->size());
- if (verbose)
- printf(" mod[%d] [%p,%p) %s\n", i,
- (void *)new_rom->addr(), ((char *)new_rom->addr()) + new_rom->size(),
- new_rom->name());
-
/* zero remainder of last ROM page */
size_t count = L4_PAGESIZE - rom.size() % L4_PAGESIZE;
if (count != L4_PAGESIZE)
@@ -485,21 +453,21 @@ Platform::Platform() :
if (initialized) panic("Platform constructed twice!");
initialized = true;
+ init_log();
+
_setup_basics();
_setup_mem_alloc();
_setup_io_port_alloc();
_setup_irq_alloc();
_setup_rom();
- if (verbose) {
- printf(":ram_alloc: "); _ram_alloc()->dump_addr_tree();
- printf(":region_alloc: "); _region_alloc()->dump_addr_tree();
- printf(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
- printf(":io_port: "); _io_port_alloc()->dump_addr_tree();
- printf(":irq: "); _irq_alloc()->dump_addr_tree();
- printf(":rom_fs: "); _rom_fs.print_fs();
- printf(":core ranges: "); _core_address_ranges()()->dump_addr_tree();
- }
+ log(":ram_alloc: "); _ram_alloc()->dump_addr_tree();
+ log(":region_alloc: "); _region_alloc()->dump_addr_tree();
+ log(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
+ log(":io_port: "); _io_port_alloc()->dump_addr_tree();
+ log(":irq: "); _irq_alloc()->dump_addr_tree();
+ log(":rom_fs: "); _rom_fs.print_fs();
+ log(":core ranges: "); _core_address_ranges()()->dump_addr_tree();
Core_cap_index* pdi =
reinterpret_cast(cap_map()->insert(_cap_id_alloc.alloc(), Fiasco::L4_BASE_TASK_CAP));
@@ -546,7 +514,7 @@ Affinity::Space Platform::affinity_space() const
l4_msgtag_t res = l4_scheduler_info(L4_BASE_SCHEDULER_CAP, &cpus_max,
&cpus);
if (l4_error(res)) {
- PERR("could not detect number of CPUs - assuming 1 CPU");
+ error("could not detect number of CPUs - assuming 1 CPU");
return 1;
}
diff --git a/repos/base-foc/src/core/platform_pd.cc b/repos/base-foc/src/core/platform_pd.cc
index c80b80961..c675f0e6a 100644
--- a/repos/base-foc/src/core/platform_pd.cc
+++ b/repos/base-foc/src/core/platform_pd.cc
@@ -77,7 +77,7 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
return true;
}
- PERR("thread alloc failed");
+ error("thread alloc failed");
return false;
}
@@ -124,7 +124,7 @@ Platform_pd::Platform_pd(Allocator *, char const *)
l4_msgtag_t tag = l4_factory_create_task(L4_BASE_FACTORY_CAP,
_task.local.data()->kcap(), utcb_area);
if (l4_msgtag_has_error(tag))
- PERR("pd creation failed");
+ error("pd creation failed");
}
diff --git a/repos/base-foc/src/core/platform_thread.cc b/repos/base-foc/src/core/platform_thread.cc
index aea50d2b2..47e664a87 100644
--- a/repos/base-foc/src/core/platform_thread.cc
+++ b/repos/base-foc/src/core/platform_thread.cc
@@ -13,7 +13,7 @@
/* Genode includes */
#include
-#include
+#include
#include
/* core includes */
@@ -241,7 +241,7 @@ void Platform_thread::_create_thread()
l4_msgtag_t tag = l4_factory_create_thread(L4_BASE_FACTORY_CAP,
_thread.local.data()->kcap());
if (l4_msgtag_has_error(tag))
- PERR("cannot create more thread kernel-objects!");
+ error("cannot create more thread kernel-objects!");
/* create initial gate for thread */
_gate.local = thread_cap_factory().alloc(_thread.local);
diff --git a/repos/base-foc/src/core/rpc_cap_factory.cc b/repos/base-foc/src/core/rpc_cap_factory.cc
index cce7ab30f..5ec9ed53a 100644
--- a/repos/base-foc/src/core/rpc_cap_factory.cc
+++ b/repos/base-foc/src/core/rpc_cap_factory.cc
@@ -71,7 +71,7 @@ void Cap_mapping::map(Fiasco::l4_cap_idx_t task)
l4_obj_fpage(local.data()->kcap(), 0, L4_FPAGE_RWX),
((l4_cap_idx_t)remote) | L4_ITEM_MAP);
if (l4_msgtag_has_error(tag))
- PERR("mapping cap failed");
+ error("mapping cap failed");
}
@@ -119,7 +119,7 @@ Native_capability Rpc_cap_factory::alloc(Native_capability ep)
idx->kcap(),
ref->pt()->thread().local.data()->kcap(), id);
if (l4_msgtag_has_error(tag)) {
- PERR("l4_factory_create_gate failed!");
+ error("l4_factory_create_gate failed!");
cap_map()->remove(idx);
platform_specific()->cap_id_alloc()->free(id);
return cap;
@@ -132,7 +132,7 @@ Native_capability Rpc_cap_factory::alloc(Native_capability ep)
idx->pt(ref->pt());
cap = Native_capability(*idx);
} catch (Cap_id_allocator::Out_of_ids) {
- PERR("Out of capability ids");
+ error("out of capability IDs");
}
/*
@@ -224,7 +224,7 @@ void Genode::Capability_map::remove(Genode::Cap_index* i)
l4_obj_fpage(i->kcap(), 0, L4_FPAGE_RWX),
L4_FP_ALL_SPACES | L4_FP_DELETE_OBJ);
if (l4_msgtag_has_error(tag))
- PERR("destruction of ipc-gate %lx failed!", (unsigned long) i->kcap());
+ error("destruction of ipc-gate ", i->kcap(), " failed!");
platform_specific()->cap_id_alloc()->free(i->id());
diff --git a/repos/base-foc/src/core/signal_source_component.cc b/repos/base-foc/src/core/signal_source_component.cc
index 8ec92bd49..2c9b17c00 100644
--- a/repos/base-foc/src/core/signal_source_component.cc
+++ b/repos/base-foc/src/core/signal_source_component.cc
@@ -13,7 +13,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* core includes */
@@ -56,7 +56,7 @@ void Signal_source_component::submit(Signal_context_component *context,
Signal_source::Signal Signal_source_component::wait_for_signal()
{
if (_signal_queue.empty()) {
- PWRN("unexpected call of wait_for_signal");
+ warning("unexpected call of wait_for_signal");
return Signal(0, 0);
}
@@ -79,7 +79,7 @@ Signal_source_component::Signal_source_component(Rpc_entrypoint *ep)
l4_msgtag_t res = l4_factory_create_irq(L4_BASE_FACTORY_CAP,
_blocking_semaphore.data()->kcap());
if (l4_error(res))
- PERR("Allocation of irq object failed!");
+ error("Allocation of irq object failed!");
}
diff --git a/repos/base-foc/src/core/spec/x86/platform.cc b/repos/base-foc/src/core/spec/x86/platform.cc
index 6f0691d30..3694fc094 100644
--- a/repos/base-foc/src/core/spec/x86/platform.cc
+++ b/repos/base-foc/src/core/spec/x86/platform.cc
@@ -13,7 +13,7 @@
*/
/* Genode includes */
-#include
+#include
#include
#include "platform.h"
@@ -84,5 +84,5 @@ void Genode::Platform::setup_irq_mode(unsigned irq_number, unsigned trigger,
* Set mode
*/
if (l4_error(l4_icu_set_mode(L4_BASE_ICU_CAP, irq_number, mode)))
- PERR("Setting mode for IRQ%u failed", irq_number);
+ error("setting mode for IRQ ", irq_number, " failed");
}
diff --git a/repos/base-foc/src/test/cap_integrity/main.cc b/repos/base-foc/src/test/cap_integrity/main.cc
index 761a23ad3..868c8b739 100644
--- a/repos/base-foc/src/test/cap_integrity/main.cc
+++ b/repos/base-foc/src/test/cap_integrity/main.cc
@@ -15,6 +15,7 @@
/* Genode includes */
#include
+#include
#include
#include
@@ -26,7 +27,7 @@ using namespace Fiasco;
int main(int argc, char **argv)
{
- printf("--- capability integrity test ---\n");
+ log("--- capability integrity test ---");
enum { COUNT = 1000 };
@@ -48,6 +49,6 @@ int main(int argc, char **argv)
} catch(...) { }
}
- printf("--- finished capability integrity test ---\n");
+ log("--- finished capability integrity test ---");
return 0;
}
diff --git a/repos/base-hw/src/base/muen/sinfo.cc b/repos/base-hw/src/base/muen/sinfo.cc
index 1d989b097..61c7feefe 100644
--- a/repos/base-hw/src/base/muen/sinfo.cc
+++ b/repos/base-hw/src/base/muen/sinfo.cc
@@ -11,7 +11,7 @@
* under the terms of the GNU General Public License version 2.
*/
-#include
+#include
#include
#include
@@ -24,16 +24,16 @@ static bool log_channel(
void *data)
{
if (channel->has_event || channel->has_vector) {
- PDBG("muen-sinfo: [%s with %s %03d] %s\n",
- channel->writable ? "writer" : "reader",
- channel->has_event ? "event " : "vector",
- channel->has_event ? channel->event_number : channel->vector,
- channel->name);
+ Genode::log("muen-sinfo: [",
+ channel->writable ? "writer" : "reader", " with ",
+ channel->has_event ? "event " : "vector", " ",
+ channel->has_event ? channel->event_number : channel->vector,
+ "] ", channel->name);
} else {
- PDBG("muen-sinfo: [%s with no %s ] %s\n",
- channel->writable ? "writer" : "reader",
- channel->writable ? "event " : "vector",
- channel->name);
+ Genode::log("muen-sinfo: [",
+ channel->writable ? "writer" : "reader", " with no ",
+ channel->writable ? "event " : "vector", " ",
+ "] ", channel->name);
}
return true;
@@ -41,14 +41,14 @@ static bool log_channel(
/* Log memory region information */
-static bool log_memregion(
- const struct Genode::Sinfo::Memregion_info * const region,
- void *data)
+static bool log_memregion(const struct Genode::Sinfo::Memregion_info * const region,
+ void *data)
{
- PDBG("muen-sinfo: [addr 0x%016llx size 0x%016llx %s%s] %s\n",
- region->address, region->size,
- region->writable ? "rw" : "ro",
- region->executable ? "x" : "-", region->name);
+ Genode::log("muen-sinfo: [addr ", Genode::Hex(region->address), " "
+ "size ", Genode::Hex(region->size), " ",
+ region->writable ? "rw" : "ro",
+ region->executable ? "x" : "-",
+ "] ", region->name);
return true;
}
@@ -72,7 +72,7 @@ Sinfo::Sinfo(const addr_t base_addr)
sinfo = ((subject_info_type *)base_addr);
if (!check_magic()) {
- PERR("muen-sinfo: Subject information MAGIC mismatch\n");
+ Genode::error("muen-sinfo: Subject information MAGIC mismatch");
return;
}
}
@@ -207,19 +207,19 @@ uint64_t Sinfo::get_sched_end(void)
void Sinfo::log_status()
{
if (!sinfo) {
- PINF("Sinfo API not initialized");
+ Genode::log("Sinfo API not initialized");
return;
}
if (!check_magic()) {
- PINF("Sinfo MAGIC not found");
+ Genode::log("Sinfo MAGIC not found");
return;
}
- PINF("muen-sinfo: Subject information exports %d memory region(s)\n",
- sinfo->memregion_count);
+ Genode::log("muen-sinfo: Subject information exports ",
+ sinfo->memregion_count, " memory region(s)");
for_each_memregion(log_memregion, 0);
- PINF("muen-sinfo: Subject information exports %d channel(s)\n",
- sinfo->channel_info_count);
+ Genode::log("muen-sinfo: Subject information exports ",
+ sinfo->channel_info_count, " channel(s)");
for_each_channel(log_channel, 0);
}
diff --git a/repos/base-hw/src/core/core_region_map.cc b/repos/base-hw/src/core/core_region_map.cc
index 62e8bdac8..dee1c9e00 100644
--- a/repos/base-hw/src/core/core_region_map.cc
+++ b/repos/base-hw/src/core/core_region_map.cc
@@ -38,12 +38,12 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
size_t page_rounded_size = (size + get_page_size() - 1) & get_page_mask();
if (use_local_addr) {
- PERR("Parameter 'use_local_addr' not supported within core");
+ error("Parameter 'use_local_addr' not supported within core");
return nullptr;
}
if (offset) {
- PERR("Parameter 'offset' not supported within core");
+ error("Parameter 'offset' not supported within core");
return nullptr;
}
@@ -52,8 +52,8 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
if (!platform()->region_alloc()->alloc_aligned(page_rounded_size,
&virt_addr,
get_page_size_log2()).ok()) {
- PERR("Could not allocate virtual address range in core of size %zd\n",
- page_rounded_size);
+ error("could not allocate virtual address range in core of size ",
+ page_rounded_size);
return nullptr;
}
diff --git a/repos/base-hw/src/core/include/assert.h b/repos/base-hw/src/core/include/assert.h
index cb6419784..25057842b 100644
--- a/repos/base-hw/src/core/include/assert.h
+++ b/repos/base-hw/src/core/include/assert.h
@@ -15,7 +15,7 @@
#define _CORE__INCLUDE__ASSERT_H_
/* Genode includes */
-#include
+#include
/**
* Suppress assertions in release version
@@ -43,9 +43,9 @@
do { \
if (DO_ASSERT) { \
if (!(expression)) { \
- PERR("Assertion failed: "#expression""); \
- PERR(" File: %s:%d", __FILE__, __LINE__); \
- PERR(" Function: %s", __PRETTY_FUNCTION__); \
+ Genode::error("Assertion failed: "#expression""); \
+ Genode::error(" File: ", __FILE__, ":", __LINE__); \
+ Genode::error(" Function: ", __PRETTY_FUNCTION__); \
while (1) ; \
} \
} \
diff --git a/repos/base-hw/src/core/include/cpu_thread_allocator.h b/repos/base-hw/src/core/include/cpu_thread_allocator.h
index c30eee1e3..4fae23b33 100644
--- a/repos/base-hw/src/core/include/cpu_thread_allocator.h
+++ b/repos/base-hw/src/core/include/cpu_thread_allocator.h
@@ -14,7 +14,7 @@
#ifndef _CORE__INCLUDE__CPU_THREAD_ALLOCATOR_H_
#define _CORE__INCLUDE__CPU_THREAD_ALLOCATOR_H_
-#include
+#include
#include
namespace Genode
@@ -49,14 +49,16 @@ namespace Genode
void free(void *addr, size_t size) override {
_alloc->free(addr, size); }
- size_t consumed() const override {
- PDBG("Unexpected call");
+ size_t consumed() const override
+ {
+ warning(__func__, "unexpectedly called");
while (1) ;
return 0;
}
- size_t overhead(size_t size) const override {
- PDBG("Unexpected call");
+ size_t overhead(size_t size) const override
+ {
+ warning(__func__, "unexpectedly called");
while (1) ;
return 0;
}
diff --git a/repos/base-hw/src/core/include/signal_broker.h b/repos/base-hw/src/core/include/signal_broker.h
index 4ee20657d..af8c161c8 100644
--- a/repos/base-hw/src/core/include/signal_broker.h
+++ b/repos/base-hw/src/core/include/signal_broker.h
@@ -81,7 +81,7 @@ class Genode::Signal_broker
auto lambda = [&] (Signal_source_component *s) {
if (!s) {
- PERR("unknown signal source");
+ error("unknown signal source");
return;
}
@@ -104,7 +104,7 @@ class Genode::Signal_broker
{
auto lambda = [&] (Signal_source_component *s) {
if (!s) {
- PERR("unknown signal source");
+ error("unknown signal source");
throw Invalid_signal_source();
}
@@ -124,7 +124,7 @@ class Genode::Signal_broker
auto lambda = [&] (Signal_context_component *c) {
if (!c) {
- PERR("unknown signal context");
+ error("unknown signal context");
return;
}
diff --git a/repos/base-hw/src/core/include/spec/riscv/translation_table.h b/repos/base-hw/src/core/include/spec/riscv/translation_table.h
index 4d95c7ce2..d1c24d011 100644
--- a/repos/base-hw/src/core/include/spec/riscv/translation_table.h
+++ b/repos/base-hw/src/core/include/spec/riscv/translation_table.h
@@ -1,4 +1,4 @@
-/**
+/*
* \brief RISCV Sv39 page table format
* \author Sebastian Sumpf
* \date 2015-08-04
@@ -17,6 +17,7 @@
/* Genode includes */
#include
#include
+#include
/* Core includes */
#include
@@ -175,7 +176,7 @@ class Sv39::Level_x_translation_table
/* sanity check vo bits 38 to 63 must be equal */
addr_t sanity = vo >> 38;
if (sanity != 0 && sanity != 0x3ffffff) {
- PERR("Invalid virtual address: %lx", vo);
+ Genode::error("invalid virtual address: ", vo);
throw Invalid_range();
}
@@ -302,7 +303,7 @@ class Sv39::Level_x_translation_table
Level_x_translation_table()
{
if (!_aligned((addr_t)this, ALIGNM_LOG2)) {
- PWRN("misaligned address");
+ Genode::warning("misaligned address");
throw Misaligned();
}
@@ -371,7 +372,7 @@ namespace Sv39 {
{
if ((vo & ~BLOCK_MASK) || (pa & ~BLOCK_MASK) ||
size < BLOCK_SIZE) {
- PWRN("invalid range");
+ Genode::warning("invalid range");
throw Invalid_range();
}
diff --git a/repos/base-hw/src/core/include/spec/rpi/pic.h b/repos/base-hw/src/core/include/spec/rpi/pic.h
index d86d458eb..354e8500d 100644
--- a/repos/base-hw/src/core/include/spec/rpi/pic.h
+++ b/repos/base-hw/src/core/include/spec/rpi/pic.h
@@ -15,6 +15,7 @@
#define _CORE__INCLUDE__SPEC__RPI__PIC_H_
/* Genode includes */
+#include
#include
/* core includes */
@@ -101,7 +102,7 @@ class Genode::Usb_dwc_otg : Mmio
stat_cnt++;
if (stat_cnt == 8000) {
- PLOG("kicked: %d filtered: %d triggered: %d", kick_cnt, filter_cnt, trigger_cnt);
+ log("kicked: ", kick_cnt, " filtered: ", filter_cnt, " triggered: ", trigger_cnt);
stat_cnt = 0;
}
diff --git a/repos/base-hw/src/core/include/spec/x86_64/muen/board.h b/repos/base-hw/src/core/include/spec/x86_64/muen/board.h
index 406591874..1efb08902 100644
--- a/repos/base-hw/src/core/include/spec/x86_64/muen/board.h
+++ b/repos/base-hw/src/core/include/spec/x86_64/muen/board.h
@@ -14,6 +14,8 @@
#ifndef _CORE__INCLUDE__SPEC__X86_64__MUEN__BOARD_H_
#define _CORE__INCLUDE__SPEC__X86_64__MUEN__BOARD_H_
+#include
+
namespace Genode
{
struct Board
@@ -31,7 +33,7 @@ namespace Genode
TIMER_VECTOR_USER = 50,
};
- void init() { }
+ void init() { Genode::init_log(); }
};
}
diff --git a/repos/base-hw/src/core/include/spec/x86_64/muen/timer.h b/repos/base-hw/src/core/include/spec/x86_64/muen/timer.h
index 17064e431..bf38e967a 100644
--- a/repos/base-hw/src/core/include/spec/x86_64/muen/timer.h
+++ b/repos/base-hw/src/core/include/spec/x86_64/muen/timer.h
@@ -15,7 +15,7 @@
#define _CORE__INCLUDE__SPEC__X86_64__MUEN__TIMER_H_
/* base includes */
-#include
+#include
#include
/* core includes */
@@ -70,18 +70,19 @@ class Genode::Timer
struct Sinfo::Memregion_info region;
if (!sinfo()->get_memregion_info("timed_event", ®ion)) {
- PERR("muen-timer: Unable to retrieve timed event region");
+ error("muen-timer: Unable to retrieve timed event region");
throw Invalid_region();
}
_event_page = (Subject_timed_event *)region.address;
_event_page->event_nr = Board::TIMER_EVENT_KERNEL;
- PINF("muen-timer: Page @0x%llx, frequency %llu kHz, event %u",
- region.address, _tics_per_ms, _event_page->event_nr);
+ log("muen-timer: Page @", Hex(region.address), ", "
+ "frequency ", _tics_per_ms, " kHz, "
+ "event ", (unsigned)_event_page->event_nr);
if (sinfo()->get_memregion_info("monitor_timed_event", ®ion)) {
- PINF("muen-timer: Found guest timed event page @0x%llx"
- " -> enabling preemption", region.address);
+ log("muen-timer: Found guest timed event page @", Hex(region.address),
+ " -> enabling preemption");
_guest_event_page = (Subject_timed_event *)region.address;
_guest_event_page->event_nr = Board::TIMER_EVENT_PREEMPT;
}
diff --git a/repos/base-hw/src/core/include/vm_root.h b/repos/base-hw/src/core/include/vm_root.h
index 09f0551a4..d7497b043 100644
--- a/repos/base-hw/src/core/include/vm_root.h
+++ b/repos/base-hw/src/core/include/vm_root.h
@@ -16,6 +16,7 @@
/* Genode includes */
#include
+#include
/* core includes */
#include
diff --git a/repos/base-hw/src/core/irq_session_component.cc b/repos/base-hw/src/core/irq_session_component.cc
index 6a6ec421f..5ba0f2790 100644
--- a/repos/base-hw/src/core/irq_session_component.cc
+++ b/repos/base-hw/src/core/irq_session_component.cc
@@ -45,7 +45,7 @@ void Irq_session_component::ack_irq()
void Irq_session_component::sigh(Signal_context_capability cap)
{
if (_sig_cap.valid()) {
- PWRN("signal handler already registered for IRQ %u", _irq_number);
+ warning("signal handler already registered for IRQ ", _irq_number);
return;
}
@@ -53,7 +53,7 @@ void Irq_session_component::sigh(Signal_context_capability cap)
if (Kernel::new_irq((addr_t)&_kernel_object, _irq_number,
Capability_space::capid(_sig_cap)))
- PWRN("invalid signal handler for IRQ %u", _irq_number);
+ warning("invalid signal handler for IRQ ", _irq_number);
}
@@ -86,7 +86,7 @@ Irq_session_component::Irq_session_component(Range_allocator * const irq_alloc,
/* allocate interrupt */
if (_irq_alloc->alloc_addr(1, _irq_number).error()) {
- PERR("unavailable interrupt %d requested", _irq_number);
+ error("unavailable interrupt ", _irq_number, " requested");
throw Root::Invalid_args();
}
diff --git a/repos/base-hw/src/core/kernel/clock.cc b/repos/base-hw/src/core/kernel/clock.cc
index f6ddcf841..fd048963f 100644
--- a/repos/base-hw/src/core/kernel/clock.cc
+++ b/repos/base-hw/src/core/kernel/clock.cc
@@ -79,7 +79,6 @@ time_t Clock::update_time()
/* update time */
time_t const old_value = _last_timeout_duration;
time_t const new_value = _timer->value(_cpu_id);
-// PERR("%lu %lu", old_value, new_value);
time_t const duration = old_value > new_value ? old_value - new_value : 1;
_time += duration;
return duration;
diff --git a/repos/base-hw/src/core/kernel/cpu_scheduler.cc b/repos/base-hw/src/core/kernel/cpu_scheduler.cc
index 3d27302ce..d918bb0f6 100644
--- a/repos/base-hw/src/core/kernel/cpu_scheduler.cc
+++ b/repos/base-hw/src/core/kernel/cpu_scheduler.cc
@@ -11,6 +11,9 @@
* under the terms of the GNU General Public License version 2.
*/
+/* Genode includes */
+#include
+
/* core includes */
#include
#include
@@ -189,7 +192,7 @@ void Cpu_scheduler::remove(Share * const s)
*
*/
if (s == _head) {
- PERR("Removing the head of the CPU scheduler isn't supported by now.");
+ Genode::error("Removing the head of the CPU scheduler isn't supported by now.");
while (1) ;
}
if (s->_ready) { _fills.remove(s); }
diff --git a/repos/base-hw/src/core/kernel/ipc_node.cc b/repos/base-hw/src/core/kernel/ipc_node.cc
index 869c55957..45bad4fdc 100644
--- a/repos/base-hw/src/core/kernel/ipc_node.cc
+++ b/repos/base-hw/src/core/kernel/ipc_node.cc
@@ -176,7 +176,7 @@ void Ipc_node::send_request(Ipc_node * const callee, capid_t capid, bool help,
unsigned rcv_caps)
{
if (_state != INACTIVE) {
- PERR("IPC send request: bad state");
+ Genode::error("IPC send request: bad state");
return;
}
Genode::Allocator &slab = pd()->platform_pd()->capability_slab();
@@ -202,8 +202,8 @@ Ipc_node * Ipc_node::helping_sink() {
bool Ipc_node::await_request(unsigned rcv_caps)
{
- if (_state != INACTIVE) {
- PERR("IPC await request: bad state");
+ if (_state != INACTIVE) {
+ Genode::error("IPC await request: bad state");
return true;
}
Genode::Allocator &slab = pd()->platform_pd()->capability_slab();
diff --git a/repos/base-hw/src/core/kernel/pd.cc b/repos/base-hw/src/core/kernel/pd.cc
index ae09dcfb1..fbeb7fa08 100644
--- a/repos/base-hw/src/core/kernel/pd.cc
+++ b/repos/base-hw/src/core/kernel/pd.cc
@@ -14,6 +14,7 @@
/* core includes */
#include
+#include
#include
/* Genode includes */
@@ -62,7 +63,7 @@ void Mode_transition_control::map(Genode::Translation_table * tt,
tt->insert_translation(Genode::trunc_page(VIRT_BASE), phys_base, SIZE,
Genode::Page_flags::mode_transition(), alloc);
} catch(...) {
- PERR("Inserting exception vector in page table failed!"); }
+ Genode::error("inserting exception vector in page table failed!"); }
}
diff --git a/repos/base-hw/src/core/pager.cc b/repos/base-hw/src/core/pager.cc
index b108be7b3..30b9eed70 100644
--- a/repos/base-hw/src/core/pager.cc
+++ b/repos/base-hw/src/core/pager.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
/* core includes*/
#include
@@ -86,9 +86,10 @@ void Pager_object::unresolved_page_fault_occurred()
{
Platform_thread * const pt = (Platform_thread *)badge();
if (pt && pt->pd())
- PERR("%s -> %s: unresolved pagefault at ip=%lx sp=%lx fault address=%lx",
- pt->pd()->label(), pt->label(), pt->kernel_object()->ip,
- pt->kernel_object()->sp, pt->kernel_object()->fault_addr());
+ error(pt->pd()->label(), " -> ", pt->label(), ": unresolved pagefault at "
+ "ip=", pt->kernel_object()->ip, " "
+ "sp=", pt->kernel_object()->sp, " "
+ "fault address=", pt->kernel_object()->fault_addr());
}
Pager_object::Pager_object(Cpu_session_capability cpu_session_cap,
diff --git a/repos/base-hw/src/core/platform.cc b/repos/base-hw/src/core/platform.cc
index ce650d5fa..a06c6594f 100644
--- a/repos/base-hw/src/core/platform.cc
+++ b/repos/base-hw/src/core/platform.cc
@@ -200,7 +200,7 @@ Platform::Platform()
void Core_parent::exit(int exit_value)
{
- log(__PRETTY_FUNCTION__, "not implemented");
+ warning(__PRETTY_FUNCTION__, "not implemented");
while (1);
}
diff --git a/repos/base-hw/src/core/platform_pd.cc b/repos/base-hw/src/core/platform_pd.cc
index c2c473d8c..90755d94e 100644
--- a/repos/base-hw/src/core/platform_pd.cc
+++ b/repos/base-hw/src/core/platform_pd.cc
@@ -58,7 +58,7 @@ bool Hw::Address_space::insert_translation(addr_t virt, addr_t phys,
}
}
} catch(...) {
- PERR("Invalid mapping %p -> %p (%zx)", (void*)phys, (void*)virt, size);
+ error("invalid mapping ", Hex(phys), " -> ", Hex(virt), " (", size, ")");
}
return false;
}
@@ -74,7 +74,7 @@ void Hw::Address_space::flush(addr_t virt, size_t size)
/* update translation caches */
Kernel::update_pd(_kernel_pd);
} catch(...) {
- PERR("tried to remove invalid region!");
+ error("tried to remove invalid region!");
}
}
@@ -164,7 +164,7 @@ Platform_pd::Platform_pd(Allocator * md_alloc, char const *label)
_label(label)
{
if (!_cap.valid()) {
- PERR("failed to create kernel object");
+ error("failed to create kernel object");
throw Root::Unavailable();
}
}
@@ -216,10 +216,9 @@ void Core_platform_pd::_map(addr_t start, addr_t end, bool io_mem)
try {
_table()->insert_translation(start, start, size, flags, _table_alloc());
} catch(Allocator::Out_of_memory) {
- PERR("Translation table needs to much RAM");
+ error("translation table needs to much RAM");
} catch(...) {
- PERR("Invalid mapping %p -> %p (%zx)", (void*)start,
- (void*)start, size);
+ error("invalid mapping ", Hex(start), " size=", size);
}
}
diff --git a/repos/base-hw/src/core/platform_thread.cc b/repos/base-hw/src/core/platform_thread.cc
index 78e5a99c1..92600c63e 100644
--- a/repos/base-hw/src/core/platform_thread.cc
+++ b/repos/base-hw/src/core/platform_thread.cc
@@ -69,7 +69,7 @@ Platform_thread::Platform_thread(const char * const label,
/* create UTCB for a core thread */
void *utcb_phys;
if (!platform()->ram_alloc()->alloc(sizeof(Native_utcb), &utcb_phys)) {
- PERR("failed to allocate UTCB");
+ error("failed to allocate UTCB");
throw Cpu_session::Out_of_metadata();
}
map_local((addr_t)utcb_phys, (addr_t)_utcb_core_addr,
@@ -94,7 +94,7 @@ Platform_thread::Platform_thread(size_t const quota,
_utcb = core_env()->ram_session()->alloc(sizeof(Native_utcb),
CACHED);
} catch (...) {
- PERR("failed to allocate UTCB");
+ error("failed to allocate UTCB");
throw Cpu_session::Out_of_metadata();
}
_utcb_core_addr = (Native_utcb *)core_env()->rm_session()->attach(_utcb);
@@ -107,7 +107,7 @@ void Platform_thread::join_pd(Platform_pd * pd, bool const main_thread,
{
/* check if thread is already in another protection domain */
if (_pd && _pd != pd) {
- PERR("thread already in another protection domain");
+ error("thread already in another protection domain");
return;
}
@@ -139,7 +139,7 @@ int Platform_thread::start(void * const ip, void * const sp)
/* lock the address space */
Locked_ptr locked_ptr(_address_space);
if (!locked_ptr.valid()) {
- PERR("invalid RM client");
+ error("invalid RM client");
return -1;
};
Page_flags const flags = Page_flags::apply_mapping(true, CACHED, false);
@@ -147,7 +147,7 @@ int Platform_thread::start(void * const ip, void * const sp)
Hw::Address_space * as = static_cast(&*locked_ptr);
if (!as->insert_translation((addr_t)_utcb_pd_addr, dsc->phys_addr(),
sizeof(Native_utcb), flags)) {
- PERR("failed to attach UTCB");
+ error("failed to attach UTCB");
return -1;
}
return 0;
@@ -161,7 +161,7 @@ int Platform_thread::start(void * const ip, void * const sp)
/* start executing new thread */
if (!_pd) {
- PWRN("No protection domain associated!");
+ error("no protection domain associated!");
return -1;
}
@@ -190,7 +190,7 @@ void Platform_thread::pager(Pager_object * const pager)
if (route_thread_event(kernel_object(), Thread_event_id::FAULT,
pager ? Capability_space::capid(pager->cap())
: cap_id_invalid()))
- PERR("failed to set pager object for thread %s", label());
+ error("failed to set pager object for thread ", label());
_pager = pager;
}
diff --git a/repos/base-hw/src/core/ram_session_support.cc b/repos/base-hw/src/core/ram_session_support.cc
index 1d0336142..625af91a6 100644
--- a/repos/base-hw/src/core/ram_session_support.cc
+++ b/repos/base-hw/src/core/ram_session_support.cc
@@ -16,7 +16,7 @@
*/
/* Genode includes */
-#include
+#include
/* core includes */
#include
@@ -35,15 +35,15 @@ void Ram_session_component::_clear_ds (Dataspace_component * ds)
/* allocate range in core's virtual address space */
void *virt_addr;
if (!platform()->region_alloc()->alloc(page_rounded_size, &virt_addr)) {
- PERR("could not allocate virtual address range in core of size %zd\n",
- page_rounded_size);
+ error("could not allocate virtual address range in core of size ",
+ page_rounded_size);
return;
}
/* map the dataspace's physical pages to corresponding virtual addresses */
size_t num_pages = page_rounded_size >> get_page_size_log2();
if (!map_local(ds->phys_addr(), (addr_t)virt_addr, num_pages)) {
- PERR("core-local memory mapping failed");
+ error("core-local memory mapping failed");
return;
}
@@ -59,7 +59,7 @@ void Ram_session_component::_clear_ds (Dataspace_component * ds)
/* unmap dataspace from core */
if (!unmap_local((addr_t)virt_addr, num_pages))
- PERR("could not unmap core-local address range at %p", virt_addr);
+ error("could not unmap core-local address range at ", virt_addr);
/* free core's virtual address space */
platform()->region_alloc()->free(virt_addr, page_rounded_size);
diff --git a/repos/base-hw/src/core/spec/arm/kernel/thread.cc b/repos/base-hw/src/core/spec/arm/kernel/thread.cc
index 25d09c203..a41451dfd 100644
--- a/repos/base-hw/src/core/spec/arm/kernel/thread.cc
+++ b/repos/base-hw/src/core/spec/arm/kernel/thread.cc
@@ -39,15 +39,15 @@ void Thread::exception(unsigned const cpu)
return;
case UNDEFINED_INSTRUCTION:
if (_cpu->retry_undefined_instr(*this)) { return; }
- PWRN("%s -> %s: undefined instruction at ip=%p",
- pd_label(), label(), (void*)ip);
+ Genode::warning(pd_label(), " -> ", label(), ": "
+ "undefined instruction at ip=", Genode::Hex(ip));
_stop();
return;
case RESET:
return;
default:
- PWRN("%s -> %s: triggered an unknown exception %lu",
- pd_label(), label(), (unsigned long)cpu_exception);
+ Genode::warning(pd_label(), " -> ", label(), ": "
+ "triggered an unknown exception ", cpu_exception);
_stop();
return;
}
@@ -61,21 +61,24 @@ void Thread::_mmu_exception()
_fault_pd = (addr_t)_pd->platform_pd();
_fault_signal = (addr_t)_fault.signal_context();
- /**
- * core should never raise a page-fault,
- * if this happens print out an error message with debug information
+ /*
+ * Core should never raise a page-fault. If this happens, print out an
+ * error message with debug information.
*/
if (_pd == Kernel::core_pd())
- PERR("Pagefault in core thread (%s): ip=%p fault=%p",
- label(), (void*)ip, (void*)_fault_addr);
+ Genode::error("page fault in core thread (", label(), "): "
+ "ip=", Genode::Hex(ip), " fault=", Genode::Hex(_fault_addr));
_fault.submit();
return;
}
- PERR("%s -> %s: raised unhandled %s DFSR=0x%08x ISFR=0x%08x "
- "DFAR=0x%08x ip=0x%08lx sp=0x%08lx", pd_label(), label(),
- cpu_exception == DATA_ABORT ? "data abort" : "prefetch abort",
- Cpu::Dfsr::read(), Cpu::Ifsr::read(), Cpu::Dfar::read(), ip, sp);
+ Genode::error(pd_label(), " -> ", label(), ": raised unhandled ",
+ cpu_exception == DATA_ABORT ? "data abort" : "prefetch abort", " "
+ "DFSR=", Genode::Hex(Cpu::Dfsr::read()), " "
+ "ISFR=", Genode::Hex(Cpu::Ifsr::read()), " "
+ "DFAR=", Genode::Hex(Cpu::Dfar::read()), " "
+ "ip=", Genode::Hex(ip), " "
+ "sp=", Genode::Hex(sp));
}
diff --git a/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc b/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc
index 55c50f1ed..e3998e188 100644
--- a/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc
+++ b/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc
@@ -11,6 +11,7 @@
* under the terms of the GNU General Public License version 2.
*/
+#include
#include
#include
#include
@@ -59,7 +60,7 @@ struct Kernel::Vm_irq : Kernel::Irq
Cpu_job & job = cpu_pool()->executing_cpu()->scheduled_job();
Vm *vm = dynamic_cast(&job);
if (!vm)
- PERR("VM timer interrupt while VM is not runnning!");
+ Genode::error("VM timer interrupt while VM is not runnning!");
else
vm->inject_irq(_irq_nr);
}
diff --git a/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.cc b/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.cc
index 22b5013c5..7cac81dac 100644
--- a/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.cc
+++ b/repos/base-hw/src/core/spec/arm_v7/virtualization/vm_session_component.cc
@@ -30,7 +30,7 @@ void Vm_session_component::exception_handler(Signal_context_capability handler)
if (!create((void*)_ds.core_local_addr(), Capability_space::capid(handler),
cma->phys_addr(_table)))
- PWRN("Cannot instantiate vm kernel object, invalid signal context?");
+ Genode::warning("Cannot instantiate vm kernel object, invalid signal context?");
}
@@ -42,10 +42,10 @@ void Vm_session_component::_attach(addr_t phys_addr, addr_t vm_addr, size_t size
_table->insert_translation(vm_addr, phys_addr, size, pflags, _tt_alloc);
return;
} catch(Allocator::Out_of_memory) {
- PERR("Translation table needs to much RAM");
+ Genode::error("Translation table needs to much RAM");
} catch(...) {
- PERR("Invalid mapping %p -> %p (%zx)", (void*)phys_addr,
- (void*)vm_addr, size);
+ Genode::error("Invalid mapping ", Genode::Hex(phys_addr), " -> ",
+ Genode::Hex(vm_addr), " (", size, ")");
}
}
@@ -86,7 +86,7 @@ Vm_session_component::Vm_session_component(Rpc_entrypoint *ds_ep,
/* get some aligned space for the translation table */
if (!cma->alloc_aligned(sizeof(Translation_table), (void**)&tt,
Translation_table::ALIGNM_LOG2).ok()) {
- PERR("failed to allocate kernel object");
+ error("failed to allocate kernel object");
throw Root::Quota_exceeded();
}
diff --git a/repos/base-hw/src/core/spec/arndale/platform_services.cc b/repos/base-hw/src/core/spec/arndale/platform_services.cc
index 08e9a9dd8..32d358a94 100644
--- a/repos/base-hw/src/core/spec/arndale/platform_services.cc
+++ b/repos/base-hw/src/core/spec/arndale/platform_services.cc
@@ -13,6 +13,7 @@
/* Genode includes */
#include
+#include
/* Core includes */
#include
diff --git a/repos/base-hw/src/core/spec/x86/kernel/cpu.cc b/repos/base-hw/src/core/spec/x86/kernel/cpu.cc
index cc1e5cabd..e78e72314 100644
--- a/repos/base-hw/src/core/spec/x86/kernel/cpu.cc
+++ b/repos/base-hw/src/core/spec/x86/kernel/cpu.cc
@@ -12,6 +12,12 @@
* under the terms of the GNU General Public License version 2.
*/
+/* Genode includes */
+#include
+
+/* base-internal includes */
+#include /* init_log() */
+
/* core includes */
#include
#include
@@ -35,13 +41,15 @@ void Kernel::Cpu::init(Pic &pic, Kernel::Pd &core_pd, Genode::Board&)
fpu().init();
+ Genode::init_log();
+
/*
- * Please do not remove the PINF(), because the serial constructor requires
+ * Please do not remove the log(), because the serial constructor requires
* access to the Bios Data Area, which is available in the initial
* translation table set, but not in the final tables used after
* Cr3::write().
*/
- PINF("Switch to core's final translation table");
+ Genode::log("Switch to core's final translation table");
Cr3::write(Cr3::init((addr_t)core_pd.translation_table()));
diff --git a/repos/base-hw/src/core/spec/x86_64/kernel/thread.cc b/repos/base-hw/src/core/spec/x86_64/kernel/thread.cc
index 07fa8e359..225f5a702 100644
--- a/repos/base-hw/src/core/spec/x86_64/kernel/thread.cc
+++ b/repos/base-hw/src/core/spec/x86_64/kernel/thread.cc
@@ -24,13 +24,13 @@ void Kernel::Thread::_mmu_exception()
_fault_signal = (addr_t)_fault.signal_context();
_fault_addr = Cpu::Cr2::read();
- /**
- * core should never raise a page-fault,
- * if this happens print out an error message with debug information
+ /*
+ * Core should never raise a page-fault. If this happens, print out an
+ * error message with debug information.
*/
if (_pd == Kernel::core_pd())
- PERR("Pagefault in core thread (%s): ip=%p fault=%p",
- label(), (void*)ip, (void*)_fault_addr);
+ Genode::error("page fault in core thread (", label(), "): "
+ "ip=", Genode::Hex(ip), " fault=", Genode::Hex(_fault_addr));
_fault.submit();
return;
diff --git a/repos/base-hw/src/core/spec/x86_64/muen/platform_support.cc b/repos/base-hw/src/core/spec/x86_64/muen/platform_support.cc
index 301be48b3..22796bdde 100644
--- a/repos/base-hw/src/core/spec/x86_64/muen/platform_support.cc
+++ b/repos/base-hw/src/core/spec/x86_64/muen/platform_support.cc
@@ -82,11 +82,11 @@ bool Platform::get_msi_params(const addr_t mmconf, addr_t &address,
struct Sinfo::Dev_info dev_info;
if (!sinfo()->get_dev_info(sid, &dev_info)) {
- PERR("error retrieving Muen info for device with SID 0x%x", sid);
+ error("error retrieving Muen info for device with SID ", Hex(sid));
return false;
}
if (!dev_info.msi_capable) {
- PERR("device 0x%x not configured for MSI", sid);
+ error("device ", Hex(sid), " not configured for MSI");
return false;
}
@@ -94,8 +94,8 @@ bool Platform::get_msi_params(const addr_t mmconf, addr_t &address,
address = Msi_address::to_msi_addr(dev_info.irte_start);
irq_number = dev_info.irq_start;
- PDBG("enabling MSI for device with SID 0x%x: IRTE %d, IRQ %d",
- sid, dev_info.irte_start, irq_number);
+ log("enabling MSI for device with SID ", Hex(sid), ": "
+ "IRTE ", dev_info.irte_start, ", IRQ ", irq_number);
return true;
}
@@ -110,7 +110,7 @@ Native_region * Platform::_ram_regions(unsigned const i)
if (!result.size) {
struct Sinfo::Memregion_info region;
if (!sinfo()->get_memregion_info("ram", ®ion)) {
- PERR("Unable to retrieve base-hw ram region");
+ error("Unable to retrieve base-hw ram region");
return 0;
}
diff --git a/repos/base-hw/src/core/thread_start.cc b/repos/base-hw/src/core/thread_start.cc
index ade5500fe..20b8b5242 100644
--- a/repos/base-hw/src/core/thread_start.cc
+++ b/repos/base-hw/src/core/thread_start.cc
@@ -38,7 +38,7 @@ void Thread::start()
{
/* start thread with stack pointer at the top of stack */
if (native_thread().platform_thread->start((void *)&_thread_start, stack_top()))
- PERR("failed to start thread");
+ error("failed to start thread");
}
diff --git a/repos/base-hw/src/lib/base/signal.cc b/repos/base-hw/src/lib/base/signal.cc
index 6d058fb86..fc0d5c78d 100644
--- a/repos/base-hw/src/lib/base/signal.cc
+++ b/repos/base-hw/src/lib/base/signal.cc
@@ -40,7 +40,7 @@ namespace Genode {
** Signal context **
********************/
-void Signal_context::submit(unsigned) { PERR("not implemented"); }
+void Signal_context::submit(unsigned) { Genode::error("not implemented"); }
/************************
@@ -67,7 +67,7 @@ Signal_receiver::Signal_receiver()
_cap = env()->pd_session()->alloc_signal_source();
},
[&] () {
- PINF("upgrading quota donation for PD session");
+ log("upgrading quota donation for PD session");
env()->parent()->upgrade(env()->pd_session_cap(), "ram_quota=8K");
}
);
@@ -105,7 +105,7 @@ Signal_context_capability Signal_receiver::manage(Signal_context * const c)
return c->_cap;
},
[&] () {
- PINF("upgrading quota donation for PD session");
+ log("upgrading quota donation for PD session");
env()->parent()->upgrade(env()->pd_session_cap(), "ram_quota=8K");
}
);
@@ -118,7 +118,7 @@ void Signal_receiver::block_for_signal()
{
/* wait for a signal */
if (Kernel::await_signal(Capability_space::capid(_cap))) {
- PERR("failed to receive signal");
+ Genode::error("failed to receive signal");
return;
}
/* read signal data */
@@ -137,4 +137,4 @@ void Signal_receiver::block_for_signal()
}
-void Signal_receiver::local_submit(Signal::Data) { PERR("not implemented"); }
+void Signal_receiver::local_submit(Signal::Data) { Genode::error("not implemented"); }
diff --git a/repos/base-hw/src/lib/base/thread_start.cc b/repos/base-hw/src/lib/base/thread_start.cc
index 554ff5f1c..cfc4b1adf 100644
--- a/repos/base-hw/src/lib/base/thread_start.cc
+++ b/repos/base-hw/src/lib/base/thread_start.cc
@@ -14,7 +14,7 @@
/* Genode includes */
#include
-#include
+#include
#include
#include
#include
@@ -58,7 +58,7 @@ void Thread::_init_platform_thread(size_t weight, Type type)
/* remap initial main-thread UTCB according to stack-area spec */
try { rm->attach_at(Hw::_main_thread_utcb_ds, utcb_new, utcb_size); }
catch(...) {
- PERR("failed to re-map UTCB");
+ error("failed to re-map UTCB");
while (1) ;
}
/* adjust initial object state in case of a main thread */
@@ -92,7 +92,7 @@ void Thread::start()
stack_virtual_size() - size - stack_area_virtual_base();
env_stack_area_region_map->attach_at(ds, dst, size);
} catch (...) {
- PERR("failed to attach userland stack");
+ error("failed to attach userland stack");
sleep_forever();
}
/* start thread with its initial IP and aligned SP */
diff --git a/repos/base-linux/src/core/include/platform_thread.h b/repos/base-linux/src/core/include/platform_thread.h
index 9e2f6ec6a..7de061ee5 100644
--- a/repos/base-linux/src/core/include/platform_thread.h
+++ b/repos/base-linux/src/core/include/platform_thread.h
@@ -118,13 +118,13 @@ namespace Genode {
Thread_state state()
{
- PDBG("Not implemented");
+ warning("Not implemented");
throw Cpu_thread::State_access_failed();
}
void state(Thread_state)
{
- PDBG("Not implemented");
+ warning("Not implemented");
throw Cpu_thread::State_access_failed();
}
diff --git a/repos/base-linux/src/core/native_pd_component.cc b/repos/base-linux/src/core/native_pd_component.cc
index b46f0fd76..10da60425 100644
--- a/repos/base-linux/src/core/native_pd_component.cc
+++ b/repos/base-linux/src/core/native_pd_component.cc
@@ -13,7 +13,7 @@
/* Genode includes */
#include
-#include
+#include
#include
/* core-local includes */
@@ -112,7 +112,7 @@ void Native_pd_component::_start(Dataspace_component &ds)
int tmp_binary_fd = lx_open(filename, O_CREAT | O_EXCL | O_WRONLY, S_IRWXU);
if (tmp_binary_fd < 0) {
- PERR("Could not create file '%s'", filename);
+ error("Could not create file '", filename, "'");
return; /* XXX reflect error to client */
}
@@ -205,6 +205,6 @@ void Native_pd_component::start(Capability binary)
if (ds)
_start(*ds);
else
- PERR("failed to lookup binary to start");
+ error("failed to lookup binary to start");
});
};
diff --git a/repos/base-linux/src/core/platform.cc b/repos/base-linux/src/core/platform.cc
index 9ba8ae68d..d32695bfc 100644
--- a/repos/base-linux/src/core/platform.cc
+++ b/repos/base-linux/src/core/platform.cc
@@ -173,7 +173,7 @@ namespace Genode {
* as well as in Genode processes.
*/
if (socket_pair.server_sd != -1 || socket_pair.client_sd != -1)
- PERR("%s called for IPC server which should never happen", __func__);
+ error(__func__, " called for IPC server which should never happen");
}
}
diff --git a/repos/base-linux/src/core/platform_thread.cc b/repos/base-linux/src/core/platform_thread.cc
index 77ce98bf0..bca3f133a 100644
--- a/repos/base-linux/src/core/platform_thread.cc
+++ b/repos/base-linux/src/core/platform_thread.cc
@@ -14,7 +14,7 @@
/* Genode includes */
#include
#include
-#include
+#include
/* local includes */
#include "platform_thread.h"
@@ -100,20 +100,19 @@ Platform_thread::~Platform_thread()
void Platform_thread::cancel_blocking()
{
- PDBG("send cancel-blocking signal to %ld\n", _tid);
lx_tgkill(_pid, _tid, LX_SIGUSR1);
}
void Platform_thread::pause()
{
- PDBG("not implemented");
+ warning(__func__, "not implemented");
}
void Platform_thread::resume()
{
- PDBG("not implemented");
+ warning(__func__, "not implemented");
}
diff --git a/repos/base-linux/src/include/base/internal/region_registry.h b/repos/base-linux/src/include/base/internal/region_registry.h
index a1f48262a..56df325ca 100644
--- a/repos/base-linux/src/include/base/internal/region_registry.h
+++ b/repos/base-linux/src/include/base/internal/region_registry.h
@@ -15,7 +15,7 @@
#define _INCLUDE__BASE__INTERNAL__REGION_REGISTRY_
#include
-#include
+#include
namespace Genode {
class Region;
@@ -97,8 +97,7 @@ class Genode::Region_registry
if (!_map[i].used()) break;
if (i == MAX_REGIONS) {
- PERR("maximum number of %d regions reached",
- MAX_REGIONS);
+ error("maximum number of ", (unsigned)MAX_REGIONS, " regions reached");
return -1;
}
diff --git a/repos/base-linux/src/include/base/internal/stack_area.h b/repos/base-linux/src/include/base/internal/stack_area.h
index 76f7f4a32..69a9efd2a 100644
--- a/repos/base-linux/src/include/base/internal/stack_area.h
+++ b/repos/base-linux/src/include/base/internal/stack_area.h
@@ -52,7 +52,7 @@ static inline void flush_stack_area()
int ret;
if ((ret = lx_munmap(base, size)) < 0) {
- PERR("%s: failed ret=%d", __func__, ret);
+ error(__func__, ": failed ret=", ret);
throw Region_map::Region_conflict();
}
}
@@ -71,9 +71,7 @@ static inline Genode::addr_t reserve_stack_area()
/* reserve at local address failed - unmap incorrect mapping */
if (addr_in != addr_out) {
lx_munmap((void *)addr_out, size);
-
- PERR("%s: failed addr_in=%p addr_out=%p ret=%ld)", __func__,
- addr_in, addr_out, (long)addr_out);
+ error(__func__, ": failed addr_in=", addr_in, " addr_out=", addr_out);
throw Region_map::Region_conflict();
}
diff --git a/repos/base-linux/src/lib/base/child_process.cc b/repos/base-linux/src/lib/base/child_process.cc
index e3d374d60..773c778c7 100644
--- a/repos/base-linux/src/lib/base/child_process.cc
+++ b/repos/base-linux/src/lib/base/child_process.cc
@@ -14,7 +14,7 @@
/* Genode includes */
#include
#include
-#include
+#include
#include
/* base-internal includes */
@@ -79,7 +79,7 @@ Child::Process::Process(Dataspace_capability elf_ds,
addr_t elf_addr;
try { elf_addr = local_rm.attach(elf_ds); }
catch (Region_map::Attach_failed) {
- PERR("local attach of ELF executable failed"); throw; }
+ error("local attach of ELF executable failed"); throw; }
/* setup ELF object and read program entry pointer */
Elf_binary elf(elf_addr);
@@ -97,7 +97,7 @@ Child::Process::Process(Dataspace_capability elf_ds,
if (dynamically_linked) {
if (!ldso_ds.valid()) {
- PERR("attempt to start dynamic executable without dynamic linker");
+ error("attempt to start dynamic executable without dynamic linker");
throw Missing_dynamic_linker();
}
diff --git a/repos/base-linux/src/lib/base/region_map_mmap.cc b/repos/base-linux/src/lib/base/region_map_mmap.cc
index 11e83ddf4..6af7d6520 100644
--- a/repos/base-linux/src/lib/base/region_map_mmap.cc
+++ b/repos/base-linux/src/lib/base/region_map_mmap.cc
@@ -98,8 +98,8 @@ addr_t Region_map_mmap::_reserve_local(bool use_local_addr,
if ((use_local_addr && addr_in != addr_out)
|| (((long)addr_out < 0) && ((long)addr_out > -4095))) {
- PERR("_reserve_local: lx_mmap failed (addr_in=%p,addr_out=%p/%ld)",
- addr_in, addr_out, (long)addr_out);
+ error("_reserve_local: lx_mmap failed "
+ "(addr_in=", addr_in, ",addr_out=", addr_out, "/", (long)addr_out, ")");
throw Region_map::Region_conflict();
}
@@ -139,8 +139,9 @@ void *Region_map_mmap::_map_local(Dataspace_capability ds,
if ((use_local_addr && addr_in != addr_out)
|| (((long)addr_out < 0) && ((long)addr_out > -4095))) {
- PERR("_map_local: lx_mmap failed (addr_in=%p,addr_out=%p/%ld) overmap=%d",
- addr_in, addr_out, (long)addr_out, overmap);
+ error("_map_local: lx_mmap failed"
+ "(addr_in=", addr_in, ", addr_out=", addr_out, "/", (long)addr_out, ") "
+ "overmap=", overmap);
throw Region_map::Region_conflict();
}
@@ -151,7 +152,7 @@ void *Region_map_mmap::_map_local(Dataspace_capability ds,
void Region_map_mmap::_add_to_rmap(Region const ®ion)
{
if (_rmap.add_region(region) < 0) {
- PERR("_add_to_rmap: could not add region to sub RM session");
+ error("_add_to_rmap: could not add region to sub RM session");
throw Region_conflict();
}
}
@@ -167,12 +168,12 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
/* only support attach_at for sub RM sessions */
if (_sub_rm && !use_local_addr) {
- PERR("Region_map_mmap::attach: attaching w/o local addr not supported\n");
+ error("Region_map_mmap::attach: attaching w/o local addr not supported");
throw Out_of_metadata();
}
if (offset < 0) {
- PERR("Region_map_mmap::attach: negative offset not supported\n");
+ error("Region_map_mmap::attach: negative offset not supported");
throw Region_conflict();
}
@@ -204,7 +205,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
* Case 4
*/
if (is_sub_rm_session(ds)) {
- PERR("Region_map_mmap::attach: nesting sub RM sessions is not supported");
+ error("Region_map_mmap::attach: nesting sub RM sessions is not supported");
throw Invalid_dataspace();
}
@@ -213,7 +214,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
* sub RM session
*/
if (region_size + (addr_t)local_addr > _size) {
- PERR("Region_map_mmap::attach: dataspace does not fit in sub RM session");
+ error("Region_map_mmap::attach: dataspace does not fit in sub RM session");
throw Region_conflict();
}
@@ -249,7 +250,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
* Detect if sub RM session is already attached
*/
if (rm->_base) {
- PERR("Region_map_mmap::attach: mapping a sub RM session twice is not supported");
+ error("Region_map_mmap::attach: mapping a sub RM session twice is not supported");
throw Out_of_metadata();
}
diff --git a/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc b/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc
index bc61b845d..3862cbb8d 100644
--- a/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc
+++ b/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc
@@ -12,7 +12,6 @@
*/
/* Genode includes */
-#include
#include
#include
#include
@@ -307,32 +306,32 @@ namespace Genode {
void wait_for_construction()
{
- PERR("wait_for_construction() called for an adopted thread");
+ error("wait_for_construction() called for an adopted thread");
}
void constructed()
{
- PERR("constructed() called for an adopted thread");
+ error("constructed() called for an adopted thread");
}
void wait_for_start()
{
- PERR("wait_for_start() called for an adopted thread");
+ error("wait_for_start() called for an adopted thread");
}
void started()
{
- PERR("started() called for an adopted thread");
+ error("started() called for an adopted thread");
}
void wait_for_join()
{
- PERR("wait_for_join() called for an adopted thread");
+ error("wait_for_join() called for an adopted thread");
}
void joined()
{
- PERR("joined() called for an adopted thread");
+ error("joined() called for an adopted thread");
}
};
}
@@ -464,8 +463,7 @@ Thread::Thread(size_t weight, const char *name, size_t stack_size,
int const ret = pthread_create(&meta_data->pt, 0, thread_start, meta_data);
if (ret) {
- PERR("pthread_create failed (returned %d, errno=%d)",
- ret, errno);
+ error("pthread_create failed (returned ", ret, ", errno=", errno, ")");
destroy(env()->heap(), meta_data);
throw Out_of_stack_space();
}
@@ -511,8 +509,8 @@ Thread::~Thread()
if (needs_join) {
int const ret = pthread_join(native_thread().meta_data->pt, 0);
if (ret)
- PWRN("pthread_join unexpectedly returned with %d (errno=%d)",
- ret, errno);
+ warning("pthread_join unexpectedly returned "
+ "with ", ret, " (errno=", errno, ")");
}
Thread_meta_data_created *meta_data =
diff --git a/repos/base-linux/src/lib/syscall/linux_syscalls.h b/repos/base-linux/src/lib/syscall/linux_syscalls.h
index bb1148a10..4962c60ef 100644
--- a/repos/base-linux/src/lib/syscall/linux_syscalls.h
+++ b/repos/base-linux/src/lib/syscall/linux_syscalls.h
@@ -57,7 +57,7 @@ extern "C" void wait_for_continue(void);
char str[128]; \
Genode::snprintf(str, sizeof(str), \
ESC_ERR fmt ESC_END "\n", ##__VA_ARGS__); \
- Genode::raw((char const *)str); \
+ Genode::raw(Genode::Cstring(str)); \
} while (0)
diff --git a/repos/base-linux/src/test/lx_hybrid_errno/main.cc b/repos/base-linux/src/test/lx_hybrid_errno/main.cc
index 9c55711a6..663ca7131 100644
--- a/repos/base-linux/src/test/lx_hybrid_errno/main.cc
+++ b/repos/base-linux/src/test/lx_hybrid_errno/main.cc
@@ -7,7 +7,7 @@
/* Genode includes */
#include
#include
-#include
+#include
/* libc includes */
#include
@@ -32,7 +32,7 @@ struct Thread : Genode::Thread_deprecated
struct stat buf;
int ret = stat("", &buf);
- Genode::printf("thread: stat returned %d, errno=%d\n", ret, errno);
+ Genode::log("thread: stat returned ", ret, ", errno=", errno);
/*
* Let main thread procees
@@ -56,13 +56,13 @@ struct Unexpected_errno_change { };
*/
void Component::construct(Genode::Env &env)
{
- Genode::printf("--- thread-local errno test ---\n");
+ Genode::log("--- thread-local errno test ---");
static Genode::Lock barrier(Genode::Lock::LOCKED);
int const orig_errno = errno;
- Genode::printf("main: before thread creation, errno=%d\n", orig_errno);
+ Genode::log("main: before thread creation, errno=", orig_errno);
/* create thread, which modifies its thread-local errno value */
static Thread thread(barrier);
@@ -70,14 +70,14 @@ void Component::construct(Genode::Env &env)
/* block until the thread performed a 'stat' syscall */
barrier.lock();
- Genode::printf("main: after thread completed, errno=%d\n", errno);
+ Genode::log("main: after thread completed, errno=", errno);
if (orig_errno != errno) {
- PERR("unexpected change of main thread's errno value");
+ Genode::error("unexpected change of main thread's errno value");
throw Unexpected_errno_change();
}
- Genode::printf("--- finished thread-local errno test ---\n");
+ Genode::log("--- finished thread-local errno test ---");
exit_status = 0;
env.ep().schedule_suspend(exit_on_suspended, nullptr);
}
diff --git a/repos/base-linux/src/test/lx_hybrid_pthread_ipc/main.cc b/repos/base-linux/src/test/lx_hybrid_pthread_ipc/main.cc
index 2186c75b2..5928e83d7 100644
--- a/repos/base-linux/src/test/lx_hybrid_pthread_ipc/main.cc
+++ b/repos/base-linux/src/test/lx_hybrid_pthread_ipc/main.cc
@@ -14,7 +14,7 @@
/* Genode includes */
#include
#include
-#include
+#include
/* libc includes */
#include
@@ -31,7 +31,7 @@ static Genode::Lock *main_wait_lock()
static void *pthread_entry(void *)
{
- PINF("first message");
+ Genode::log("first message");
/*
* Without the lazy initialization of 'Thread' objects for threads
@@ -42,7 +42,7 @@ static void *pthread_entry(void *)
* will appear in the LOG output.
*/
- PINF("second message");
+ Genode::log("second message");
main_wait_lock()->unlock();
return 0;
@@ -61,7 +61,7 @@ Genode::size_t Component::stack_size() { return 16*1024*sizeof(long); }
*/
void Component::construct(Genode::Env &env)
{
- Genode::printf("--- pthread IPC test ---\n");
+ Genode::log("--- pthread IPC test ---");
/* create thread w/o Genode's thread API */
pthread_t pth;
@@ -70,7 +70,7 @@ void Component::construct(Genode::Env &env)
/* wait until 'pthread_entry' finished */
main_wait_lock()->lock();
- Genode::printf("--- finished pthread IPC test ---\n");
+ Genode::log("--- finished pthread IPC test ---");
exit_status = 0;
env.ep().schedule_suspend(exit_on_suspended, nullptr);
}
diff --git a/repos/base-linux/src/test/lx_rmap/main.cc b/repos/base-linux/src/test/lx_rmap/main.cc
index 5d68878a6..a6052e9ad 100644
--- a/repos/base-linux/src/test/lx_rmap/main.cc
+++ b/repos/base-linux/src/test/lx_rmap/main.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
#include
#include
@@ -57,18 +57,18 @@ int main()
size_t size(end - beg);
- PLOG("blob region region [%016lx,%016lx) size=%zx", beg, end, size);
+ log("blob region region ", Hex_range(beg, size), " size=", size);
/* RAM dataspace attachment overlapping binary */
try {
Ram_dataspace_capability ds(env()->ram_session()->alloc(size));
- PLOG("before RAM dataspace attach");
+ log("before RAM dataspace attach");
env()->rm_session()->attach_at(ds, beg);
- PERR("after RAM dataspace attach -- ERROR");
+ error("after RAM dataspace attach -- ERROR");
sleep_forever();
} catch (Region_map::Region_conflict) {
- PLOG("OK caught Region_conflict exception");
+ log("OK caught Region_conflict exception");
}
/* empty managed dataspace overlapping binary */
@@ -77,12 +77,12 @@ int main()
Region_map_client rm(rm_connection.create(size));
Dataspace_capability ds(rm.dataspace());
- PLOG("before sub-RM dataspace attach");
+ log("before sub-RM dataspace attach");
env()->rm_session()->attach_at(ds, beg);
- PERR("after sub-RM dataspace attach -- ERROR");
+ error("after sub-RM dataspace attach -- ERROR");
sleep_forever();
} catch (Region_map::Region_conflict) {
- PLOG("OK caught Region_conflict exception");
+ log("OK caught Region_conflict exception");
}
/* sparsely populated managed dataspace in free VM area */
@@ -94,14 +94,14 @@ int main()
Dataspace_capability ds(rm.dataspace());
- PLOG("before populated sub-RM dataspace attach");
+ log("before populated sub-RM dataspace attach");
char *addr = (char *)env()->rm_session()->attach(ds) + 0x1000;
- PLOG("after populated sub-RM dataspace attach / before touch");
+ log("after populated sub-RM dataspace attach / before touch");
char const val = *addr;
*addr = 0x55;
- PLOG("after touch (%x/%x)", val, *addr);
+ log("after touch (", val, "/", *addr, ")");
} catch (Region_map::Region_conflict) {
- PERR("Caught Region_conflict exception -- ERROR");
+ error("Caught Region_conflict exception -- ERROR");
sleep_forever();
}
}
diff --git a/repos/base-linux/src/test/region_map_mmap/main.cc b/repos/base-linux/src/test/region_map_mmap/main.cc
index 2aeeca07e..a39ced5bf 100644
--- a/repos/base-linux/src/test/region_map_mmap/main.cc
+++ b/repos/base-linux/src/test/region_map_mmap/main.cc
@@ -12,7 +12,7 @@
*/
#include
-#include
+#include
#include
#include
@@ -23,31 +23,28 @@ static void test_linux_rmmap_bug()
using namespace Genode;
- PLOG("line: %d", __LINE__);
+ log("line: ", __LINE__);
Ram_connection ram;
#if 1 /* transfer quota */
- PLOG("line: %d", __LINE__);
+ log("line: ", __LINE__);
ram.ref_account(env()->ram_session_cap());
env()->ram_session()->transfer_quota(ram.cap(), QUOTA);
#endif
- PLOG("line: %d", __LINE__);
+ log("line: ", __LINE__);
for (unsigned i = 0; i < ROUNDS; ++i) {
Ram_dataspace_capability ds(ram.alloc(CHUNK));
- PLOG("%d of %d pages allocated", (i + 1), ROUNDS);
+ log(i + 1, " of ", (unsigned)ROUNDS, " pages allocated");
}
- PLOG("Done.");
+ log("Done.");
}
int main()
{
- Genode::printf("--- test-rm_session_mmap started ---\n");
-
-// Timer::Connection timer;
-// timer.msleep(1000);
+ Genode::log("--- test-rm_session_mmap started ---");
test_linux_rmmap_bug();
}
diff --git a/repos/base-nova/include/nova/util.h b/repos/base-nova/include/nova/util.h
index b2372efc7..ff3a286df 100644
--- a/repos/base-nova/include/nova/util.h
+++ b/repos/base-nova/include/nova/util.h
@@ -14,7 +14,7 @@
#ifndef _INCLUDE__NOVA__UTIL_H_
#define _INCLUDE__NOVA__UTIL_H_
-#include
+#include
#include
__attribute__((always_inline))
@@ -51,7 +51,8 @@ inline void request_event_portal(Genode::Native_capability const &cap,
utcb->crd_rcv = orig_crd;
if (res)
- PERR("request of event (%lu) capability selector failed (res=%u)", event, res);
+ Genode::error("request of event (", event, ") ",
+ "capability selector failed (res=", res, ")");
}
@@ -111,6 +112,6 @@ inline void delegate_vcpu_portals(Genode::Native_capability const &cap,
utcb->crd_rcv = orig_crd;
if (res)
- PERR("setting exception portals for vCPU failed %u", res);
+ Genode::error("setting exception portals for vCPU failed res=", res);
}
#endif /* _INCLUDE__NOVA__UTIL_H_ */
diff --git a/repos/base-nova/src/core/core_region_map.cc b/repos/base-nova/src/core/core_region_map.cc
index 8cbc8f99d..a4e120e74 100644
--- a/repos/base-nova/src/core/core_region_map.cc
+++ b/repos/base-nova/src/core/core_region_map.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
/* core includes */
#include
@@ -58,12 +58,12 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
throw Invalid_dataspace();
if (use_local_addr) {
- PERR("Parameter 'use_local_addr' not supported within core");
+ error("Parameter 'use_local_addr' not supported within core");
return nullptr;
}
if (offset) {
- PERR("Parameter 'offset' not supported within core");
+ error("Parameter 'offset' not supported within core");
return nullptr;
}
diff --git a/repos/base-nova/src/core/include/nova_util.h b/repos/base-nova/src/core/include/nova_util.h
index f1390af57..6a386e06d 100644
--- a/repos/base-nova/src/core/include/nova_util.h
+++ b/repos/base-nova/src/core/include/nova_util.h
@@ -17,7 +17,7 @@
#define _CORE__INCLUDE__NOVA_UTIL_H_
/* Genode includes */
-#include
+#include
/* NOVA includes */
#include
@@ -26,8 +26,6 @@
#include
#include
-enum { verbose_local_map = false };
-
/**
* Return boot CPU number. It is required if threads in core should be placed
* on the same CPU as the main thread.
@@ -82,11 +80,17 @@ static int map_local(Nova::Utcb *utcb, Nova::Crd src_crd, Nova::Crd dst_crd,
Nova::uint8_t res = Nova::call(echo()->pt_sel());
if (res != Nova::NOVA_OK || utcb->msg_words() != 1 || !utcb->msg[0] ||
utcb->msg_items() != 1) {
- PERR("Failure - map_local 0x%lx:%lu:%u->0x%lx:%lu:%u - call result=%x"
- " utcb=%x:%x:%lx !!! utcb=%p kern=%u",
- src_crd.addr(), src_crd.order(), src_crd.type(),
- dst_crd.addr(), dst_crd.order(), dst_crd.type(), res,
- utcb->msg_items(), utcb->msg_words(), utcb->msg[0], utcb, kern_pd);
+
+ typedef Genode::Hex Hex;
+ error("map_local failed ",
+ Hex(src_crd.addr()), ":", Hex(src_crd.order()), ":", Hex(src_crd.type()), "->",
+ Hex(dst_crd.addr()), ":", Hex(dst_crd.order()), ":", Hex(dst_crd.type()), " - ",
+ "result=", Hex(res), " "
+ "msg=", Hex(utcb->msg_items()), ":",
+ Hex(utcb->msg_words()), ":",
+ Hex(utcb->msg[0]), " !!! "
+ "utcb=", utcb, " "
+ "kern=", kern_pd);
return res > 0 ? res : -1;
}
/* clear receive window */
@@ -136,10 +140,6 @@ inline int map_local(Nova::Utcb *utcb,
bool kern_pd = false, bool dma_mem = false,
bool write_combined = false)
{
- if (verbose_local_map)
- Genode::printf("::map_local: from %lx to %lx, %zd pages from kernel %u\n",
- from_start, to_start, num_pages, kern_pd);
-
using namespace Nova;
using namespace Genode;
@@ -169,10 +169,6 @@ inline int map_local(Nova::Utcb *utcb,
if ((to_end - to_curr) < (1UL << order))
order = log2(to_end - to_curr);
- if (verbose_local_map)
- Genode::printf("::map_local: order %zx %lx:%lx %lx:%lx\n",
- order, from_curr, from_end, to_curr, to_end);
-
int const res = map_local(utcb,
Mem_crd((from_curr >> 12), order - get_page_size_log2(), permission),
Mem_crd((to_curr >> 12), order - get_page_size_log2(), permission),
@@ -207,13 +203,10 @@ inline void unmap_local(Nova::Utcb *utcb, Genode::addr_t start,
Genode::addr_t base = start >> get_page_size_log2();
if (start & (get_page_size() - 1)) {
- PERR("unmap failed - unaligned address specified");
+ error("unmap failed - unaligned address specified");
return;
}
- if (verbose_local_map)
- PINF("Unmapping local: range 0x%lx+0x%zx", base, num_pages);
-
while (num_pages) {
unsigned char const base_bit = lsb_bit(base);
unsigned char const order_bit = min(log2(num_pages), 31U);
@@ -221,10 +214,6 @@ inline void unmap_local(Nova::Utcb *utcb, Genode::addr_t start,
Mem_crd const crd(base, order, rwx);
- if (verbose_local_map)
- PINF("Unmapping local: 0x%lx+0x%lx", crd.base(),
- 1UL << crd.order());
-
unmap_local(crd, self);
num_pages -= 1UL << order;
diff --git a/repos/base-nova/src/core/include/platform.h b/repos/base-nova/src/core/include/platform.h
index f804af2aa..b1ca4ea0a 100644
--- a/repos/base-nova/src/core/include/platform.h
+++ b/repos/base-nova/src/core/include/platform.h
@@ -19,8 +19,6 @@
#include
#include
-#include
-
namespace Genode {
class Platform : public Platform_generic
diff --git a/repos/base-nova/src/core/include/util.h b/repos/base-nova/src/core/include/util.h
index 8575de895..d56262925 100644
--- a/repos/base-nova/src/core/include/util.h
+++ b/repos/base-nova/src/core/include/util.h
@@ -52,12 +52,12 @@ namespace Genode {
inline void backtrace()
{
using namespace Genode;
- printf("\nbacktrace\n");
- printf(" %p\n", __builtin_return_address(0));
- printf(" %p\n", __builtin_return_address(1));
- printf(" %p\n", __builtin_return_address(2));
- printf(" %p\n", __builtin_return_address(3));
- printf(" %p\n", __builtin_return_address(4));
+ log("\nbacktrace");
+ log(" ", __builtin_return_address(0));
+ log(" ", __builtin_return_address(1));
+ log(" ", __builtin_return_address(2));
+ log(" ", __builtin_return_address(3));
+ log(" ", __builtin_return_address(4));
}
diff --git a/repos/base-nova/src/core/irq_session_component.cc b/repos/base-nova/src/core/irq_session_component.cc
index 992ac2876..b74a06713 100644
--- a/repos/base-nova/src/core/irq_session_component.cc
+++ b/repos/base-nova/src/core/irq_session_component.cc
@@ -14,7 +14,7 @@
*/
/* Genode includes */
-#include
+#include
/* core includes */
#include
@@ -36,7 +36,7 @@ static bool irq_ctrl(Genode::addr_t irq_sel,
msi_addr, msi_data, sig_sel);
if (res != Nova::NOVA_OK)
- PERR("setting up MSI failed - error %u", res);
+ error("setting up MSI failed - error ", res);
/* nova syscall interface specifies msi addr/data to be 32bit */
msi_addr = msi_addr & ~0U;
@@ -61,7 +61,7 @@ static void deassociate(Genode::addr_t irq_sel)
addr_t dummy1 = 0, dummy2 = 0;
if (!irq_ctrl(irq_sel, dummy1, dummy2, irq_sel))
- PWRN("Irq could not be de-associated");
+ warning("Irq could not be de-associated");
}
@@ -129,7 +129,7 @@ void Irq_object::sigh(Signal_context_capability cap)
void Irq_object::ack_irq()
{
if (Nova::NOVA_OK != Nova::sm_ctrl(irq_sel(), Nova::SEMAPHORE_DOWN))
- PERR("Unmasking irq of selector 0x%lx failed", irq_sel());
+ error("Unmasking irq of selector ", irq_sel(), " failed");
}
@@ -145,7 +145,7 @@ void Irq_object::start(unsigned irq, Genode::addr_t const device_phys)
int ret = map_local((Nova::Utcb *)Thread::myself()->utcb(),
src, dst, MAP_FROM_KERNEL_TO_CORE);
if (ret) {
- PERR("Getting IRQ from kernel failed - %u", irq);
+ error("getting IRQ from kernel failed - ", irq);
throw Root::Unavailable();
}
@@ -217,7 +217,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
}
if (!irq_alloc || irq_alloc->alloc_addr(1, irq_number).error()) {
- PERR("Unavailable IRQ 0x%lx requested", irq_number);
+ error("unavailable IRQ ", irq_number, " requested");
throw Root::Unavailable();
}
diff --git a/repos/base-nova/src/core/pager.cc b/repos/base-nova/src/core/pager.cc
index 65508bb4d..685fa7308 100644
--- a/repos/base-nova/src/core/pager.cc
+++ b/repos/base-nova/src/core/pager.cc
@@ -71,6 +71,31 @@ static unsigned which_cpu(Pager_activation_base * pager)
}
+/**
+ * Utility for the formatted output of page-fault information
+ */
+struct Page_fault_info
+{
+ char const * const pd;
+ char const * const thread;
+ unsigned const cpu;
+ addr_t const ip, addr;
+
+ Page_fault_info(char const *pd, char const *thread, unsigned cpu,
+ addr_t ip, addr_t addr)
+ : pd(pd), thread(thread), cpu(cpu), ip(ip), addr(addr) { }
+
+ void print(Genode::Output &out) const
+ {
+ Genode::print(out, "pd='", pd, "' "
+ "thread='", thread, "' "
+ "cpu=", cpu, " "
+ "ip=", Hex(ip), " "
+ "address=", Hex(addr));
+ }
+};
+
+
void Pager_object::_page_fault_handler(addr_t pager_obj)
{
Ipc_pager ipc_pager;
@@ -105,11 +130,13 @@ void Pager_object::_page_fault_handler(addr_t pager_obj)
const char * client_thread = obj->client_thread();
const char * client_pd = obj->client_pd();
+ Page_fault_info const fault_info(client_pd, client_thread,
+ which_cpu(pager_thread),
+ ipc_pager.fault_ip(), ipc_pager.fault_addr());
+
/* region manager fault - to be handled */
if (ret == 1) {
- PDBG("page fault, pd '%s', thread '%s', cpu %u, ip=%lx, fault "
- "address=0x%lx", client_pd, client_thread, which_cpu(pager_thread),
- ipc_pager.fault_ip(), ipc_pager.fault_addr());
+ log("page fault, ", fault_info);
utcb->set_msg_word(0);
utcb->mtd = 0;
@@ -121,10 +148,7 @@ void Pager_object::_page_fault_handler(addr_t pager_obj)
/* unhandled case */
obj->_state.mark_dead();
- PWRN("unresolvable page fault, pd '%s', thread '%s', cpu %u, ip=%lx, "
- "fault address=0x%lx ret=%u", client_pd, client_thread,
- which_cpu(pager_thread), ipc_pager.fault_ip(), ipc_pager.fault_addr(),
- ret);
+ warning("unresolvable page fault, ", fault_info, " ret=", ret);
Native_capability pager_cap = obj->Object_pool::Entry::cap();
@@ -165,11 +189,13 @@ void Pager_object::exception(uint8_t exit_id)
/* nobody handles this exception - so thread will be stopped finally */
_state.mark_dead();
- PWRN("unresolvable exception %u, pd '%s', thread '%s', cpu %u, "
- "ip=0x%lx, %s", exit_id, client_pd(), client_thread(),
- which_cpu(pager_thread), fault_ip,
- res == 0xFF ? "no signal handler" :
- (res == NOVA_OK ? "" : "recall failed"));
+ warning("unresolvable exception ", exit_id, ", "
+ "pd '", client_pd(), "', "
+ "thread '", client_thread(), "', "
+ "cpu ", which_cpu(pager_thread), ", "
+ "ip=", Hex(fault_ip), " ",
+ res == 0xFF ? "no signal handler"
+ : (res == NOVA_OK ? "" : "recall failed"));
Nova::revoke(Obj_crd(exc_pt_sel_client(), NUM_INITIAL_PT_LOG2));
@@ -291,7 +317,7 @@ void Pager_object::_invoke_handler(addr_t pager_obj)
Obj_crd snd(cap.base(), 0);
Obj_crd rcv(obj->_client_exc_vcpu + event * items_count + i, 0);
if (map_local(utcb, snd, rcv))
- PWRN("could not remap vCPU portal 0x%x", i);
+ warning("could not remap vCPU portal ", Hex(i));
}
}
@@ -379,7 +405,7 @@ void Pager_object::wake_up()
uint8_t res = sm_ctrl(sel_sm_block_pause(), SEMAPHORE_UP);
if (res != NOVA_OK)
- PWRN("canceling blocked client failed (thread sm)");
+ warning("canceling blocked client failed (thread sm)");
}
@@ -387,14 +413,14 @@ void Pager_object::client_cancel_blocking()
{
uint8_t res = sm_ctrl(exc_pt_sel_client() + SM_SEL_EC, SEMAPHORE_UP);
if (res != NOVA_OK)
- PWRN("canceling blocked client failed (thread sm)");
+ warning("canceling blocked client failed (thread sm)");
if (!_state.has_signal_sm())
return;
res = sm_ctrl(exc_pt_sel_client() + PT_SEL_STARTUP, SEMAPHORE_UP);
if (res != NOVA_OK)
- PWRN("canceling blocked client failed (signal sm)");
+ warning("canceling blocked client failed (signal sm)");
}
@@ -440,7 +466,7 @@ void Pager_object::cleanup_call()
utcb->set_msg_word(0);
utcb->mtd = 0;
if (uint8_t res = call(sel_pt_cleanup()))
- PERR("%8p - cleanup call to pager failed res=%d", utcb, res);
+ error(utcb, " - cleanup call to pager failed res=", res);
}
@@ -477,7 +503,7 @@ void Exception_handlers::register_handler(Pager_object *obj, Mtd mtd,
{
unsigned use_cpu = obj->location.xpos();
if (!kernel_hip()->is_cpu_enabled(use_cpu) || !pager_threads[use_cpu]) {
- PWRN("invalid CPU parameter used in pager object");
+ warning("invalid CPU parameter used in pager object");
throw Region_map::Invalid_thread();
}
@@ -562,14 +588,14 @@ Pager_object::Pager_object(Cpu_session_capability cpu_session_cap,
/* ypos information not supported by now */
if (location.ypos()) {
- PWRN("Unsupported location %ux%u", location.xpos(), location.ypos());
+ warning("unsupported location ", location.xpos(), "x", location.ypos());
throw Region_map::Invalid_thread();
}
/* place Pager_object on specified CPU by selecting proper pager thread */
unsigned use_cpu = location.xpos();
if (!kernel_hip()->is_cpu_enabled(use_cpu) || !pager_threads[use_cpu]) {
- PWRN("invalid CPU parameter used in pager object");
+ warning("invalid CPU parameter used in pager object");
throw Region_map::Invalid_thread();
}
@@ -603,7 +629,7 @@ Pager_object::Pager_object(Cpu_session_capability cpu_session_cap,
res = create_portal(sel_pt_cleanup(), pd_sel, ec_sel, Mtd(0),
reinterpret_cast(_invoke_handler), this);
if (res != Nova::NOVA_OK) {
- PERR("could not create pager cleanup portal, error = %u\n", res);
+ error("could not create pager cleanup portal, error=", res);
throw Region_map::Invalid_thread();
}
@@ -661,10 +687,11 @@ uint8_t Pager_object::handle_oom(addr_t transfer_from,
/* request current kernel quota usage of source pd */
Nova::pd_ctrl_debug(transfer_from, limit_source, usage_source);
- PINF("oom - '%s':'%s' (%lu/%lu) - transfer %u pages from '%s':'%s' "
- "(%lu/%lu)", dst_pd, dst_thread,
- usage_before, limit_before, QUOTA_TRANSFER_PAGES,
- src_pd, src_thread, usage_source, limit_source);
+ log("oom - '", dst_pd, "':'", dst_thread, "' "
+ "(", usage_before, "/", limit_before, ") - "
+ "transfer ", (long)QUOTA_TRANSFER_PAGES, " pages "
+ "from '", src_pd, "':'", src_thread, "' "
+ "(", usage_source, "/", limit_source, ")");
}
uint8_t res = Nova::NOVA_PD_OOM;
@@ -687,9 +714,10 @@ uint8_t Pager_object::handle_oom(addr_t transfer_from,
}
}
- PWRN("kernel memory quota upgrade failed - trigger memory free up for "
- "causing '%s':'%s' - donator is '%s':'%s', policy=%u",
- dst_pd, dst_thread, src_pd, src_thread, policy);
+ warning("kernel memory quota upgrade failed - trigger memory free up for "
+ "causing '", dst_pd, "':'", dst_thread, "' - "
+ "donator is '", src_pd, "':'", src_thread, "', "
+ "policy=", (int)policy);
/* if nothing helps try to revoke memory */
enum { REMOTE_REVOKE = true, PD_SELF = true };
@@ -760,14 +788,14 @@ void Pager_object::_oom_handler(addr_t pager_dst, addr_t pager_src,
assert |= utcb->msg_words();
if (assert) {
- PERR("unknown OOM case - stop core pager thread");
+ error("unknown OOM case - stop core pager thread");
utcb->set_msg_word(0);
reply(myself->stack_top(), myself->native_thread().exc_pt_sel + Nova::SM_SEL_EC);
}
/* be strict in case of the -strict- STOP policy - stop causing thread */
if (policy == STOP) {
- PERR("PD has insufficient kernel memory left - stop thread");
+ error("PD has insufficient kernel memory left - stop thread");
utcb->set_msg_word(0);
reply(myself->stack_top(), obj_dst->sel_sm_block_pause());
}
@@ -780,7 +808,7 @@ void Pager_object::_oom_handler(addr_t pager_dst, addr_t pager_src,
switch (pager_src) {
case SRC_PD_UNKNOWN:
/* should not happen on Genode - we create and know every PD in core */
- PERR("Unknown PD has insufficient kernel memory left - stop thread");
+ error("Unknown PD has insufficient kernel memory left - stop thread");
utcb->set_msg_word(0);
reply(myself->stack_top(), myself->native_thread().exc_pt_sel + Nova::SM_SEL_EC);
@@ -819,8 +847,9 @@ void Pager_object::_oom_handler(addr_t pager_dst, addr_t pager_src,
utcb->set_msg_word(0);
if (res != Nova::NOVA_PD_OOM)
- PERR("Upgrading kernel memory failed, policy %u, error %u "
- "- stop thread finally", policy, res);
+ error("upgrading kernel memory failed, policy ", (int)policy, ", "
+ "error ", (int)res, " - stop thread finally");
+
/* else: caller will get blocked until RCU period is over */
/* block caller in semaphore */
@@ -843,7 +872,7 @@ addr_t Pager_object::get_oom_portal()
return pt_oom;
}
- PERR("creating portal for out of memory notification failed");
+ error("creating portal for out of memory notification failed");
return 0;
}
@@ -889,10 +918,10 @@ void Pager_activation_base::entry() { }
Pager_entrypoint::Pager_entrypoint(Rpc_cap_factory &cap_factory)
: _cap_factory(cap_factory)
{
- /* sanity check space for pager threads */
+ /* sanity check for pager threads */
if (kernel_hip()->cpu_max() > PAGER_CPUS) {
- PERR("kernel supports more CPUs (%u) than Genode (%u)",
- kernel_hip()->cpu_max(), PAGER_CPUS);
+ error("kernel supports more CPUs (", kernel_hip()->cpu_max(), ") "
+ "than Genode (", (unsigned)PAGER_CPUS, ")");
nova_die();
}
@@ -916,7 +945,7 @@ Pager_capability Pager_entrypoint::manage(Pager_object *obj)
/* let handle pager_object of pager thread on same CPU */
unsigned use_cpu = obj->location.xpos();
if (!kernel_hip()->is_cpu_enabled(use_cpu) || !pager_threads[use_cpu]) {
- PWRN("invalid CPU parameter used in pager object");
+ warning("invalid CPU parameter used in pager object");
return Pager_capability();
}
Native_capability pager_thread_cap =
diff --git a/repos/base-nova/src/core/platform.cc b/repos/base-nova/src/core/platform.cc
index 98ccf9b4d..287b9d9b0 100644
--- a/repos/base-nova/src/core/platform.cc
+++ b/repos/base-nova/src/core/platform.cc
@@ -14,7 +14,6 @@
*/
/* Genode includes */
-#include
#include
#include
#include
@@ -30,6 +29,7 @@
/* base-internal includes */
#include
#include
+#include
/* NOVA includes */
#include
@@ -124,13 +124,12 @@ static void page_fault_handler()
(pf_type & Ipc_pager::ERR_W) ? Region_map::State::WRITE_FAULT
: Region_map::State::READ_FAULT, 0);
- printf("\nstack pointer 0x%lx, qualifiers 0x%lx %s%s%s%s%s\n",
- pf_sp, pf_type,
- pf_type & Ipc_pager::ERR_I ? "I" : "i",
- pf_type & Ipc_pager::ERR_R ? "R" : "r",
- pf_type & Ipc_pager::ERR_U ? "U" : "u",
- pf_type & Ipc_pager::ERR_W ? "W" : "w",
- pf_type & Ipc_pager::ERR_P ? "P" : "p");
+ log("\nstack pointer ", Hex(pf_sp), ", qualifiers ", Hex(pf_type), " ",
+ pf_type & Ipc_pager::ERR_I ? "I" : "i",
+ pf_type & Ipc_pager::ERR_R ? "R" : "r",
+ pf_type & Ipc_pager::ERR_U ? "U" : "u",
+ pf_type & Ipc_pager::ERR_W ? "W" : "w",
+ pf_type & Ipc_pager::ERR_P ? "P" : "p");
if ((stack_area_virtual_base() <= pf_sp) &&
(pf_sp < stack_area_virtual_base() +
@@ -144,8 +143,7 @@ static void page_fault_handler()
Nova::Utcb * utcb_fault = reinterpret_cast(utcb_addr_f);
unsigned last_items = utcb_fault->msg_items();
- printf("faulter utcb %p, last message item count %u\n",
- utcb_fault, last_items);
+ log("faulter utcb ", utcb_fault, ", last message item count ", last_items);
for (unsigned i = 0; i < last_items; i++) {
Nova::Utcb::Item * item = utcb_fault->get_item(i);
@@ -156,11 +154,13 @@ static void page_fault_handler()
if (crd.is_null())
continue;
- printf("%u - type=%x rights=0x%x region=0x%lx+0x%lx "
- "hotspot %lx(%lx) - %s\n", i, crd.type(), crd.rights(),
- crd.addr(), 1UL << (12 +crd.order()),
- crd.hotspot(item->hotspot), item->hotspot,
- item->is_del() ? "delegated" : "translated");
+ log(i, " - "
+ "type=", Hex(crd.type()), " "
+ "rights=", Hex(crd.rights()), " "
+ "region=", Hex(crd.addr()), "+", Hex(1UL << (12 + crd.order())), " "
+ "hotspot=", Hex(crd.hotspot(item->hotspot)),
+ "(", Hex(item->hotspot), ")"
+ " - ", item->is_del() ? "delegated" : "translated");
}
}
@@ -187,11 +187,13 @@ static void page_fault_handler()
};
int count = 1;
- printf(" #%d %08lx %08lx\n", count++, pf_sp, pf_ip);
+ log(" #", count++, " ", Hex(pf_sp, Hex::PREFIX, Hex::PAD), " ",
+ Hex(pf_ip, Hex::PREFIX, Hex::PAD));
Core_img dump(pf_sp);
while (dump.ip_valid()) {
- printf(" #%d %p %08lx\n", count++, dump.ip(), *dump.ip());
+ log(" #", count++, " ", Hex((addr_t)dump.ip(), Hex::PREFIX, Hex::PAD),
+ " ", Hex(*dump.ip(), Hex::PREFIX, Hex::PAD));
dump.next_ip();
}
@@ -237,7 +239,7 @@ static void init_core_page_fault_handler()
CORE_PAGER_UTCB_ADDR, core_pager_stack_top(),
EXC_BASE, GLOBAL);
if (ret)
- PDBG("create_ec returned %u", ret);
+ log(__func__, ": create_ec returned ", ret);
/* set up page-fault portal */
create_pt(PT_SEL_PAGE_FAULT, __core_pd_sel, ec_sel,
@@ -308,6 +310,7 @@ Platform::Platform() :
/*
* Now that we can access the I/O ports for comport 0, printf works...
*/
+ init_log();
/*
* remap main utcb to default utcb address
@@ -316,26 +319,26 @@ Platform::Platform() :
*/
if (map_local(__main_thread_utcb, (addr_t)__main_thread_utcb,
(addr_t)main_thread_utcb(), 1, Rights(true, true, false))) {
- PERR("could not remap utcb of main thread");
+ error("could not remap utcb of main thread");
nova_die();
}
/* sanity checks */
if (hip->sel_exc + 3 > NUM_INITIAL_PT_RESERVED) {
- printf("configuration error\n");
+ error("configuration error (NUM_INITIAL_PT_RESERVED)");
nova_die();
}
/* map idle SCs */
unsigned const log2cpu = log2(hip->cpu_max());
if ((1U << log2cpu) != hip->cpu_max()) {
- PERR("number of max CPUs is not of power of 2");
+ error("number of max CPUs is not of power of 2");
nova_die();
}
sc_idle_base = cap_map()->insert(log2cpu + 1);
if (sc_idle_base & ((1UL << log2cpu) - 1)) {
- PERR("unaligned sc_idle_base value %lx", sc_idle_base);
+ error("unaligned sc_idle_base value ", Hex(sc_idle_base));
nova_die();
}
if(map_local(__main_thread_utcb, Obj_crd(0, log2cpu),
@@ -353,7 +356,7 @@ Platform::Platform() :
uint8_t res = Nova::sc_ctrl(sc_idle_base + i, n_time);
if (res != Nova::NOVA_OK) {
sc_init = false;
- printf("%u %u %llu - failed\n", i, res, n_time);
+ error(i, " ", res, " ", n_time, " - failed");
}
}
if (!sc_init)
@@ -371,13 +374,13 @@ Platform::Platform() :
if (verbose_boot_info) {
if (hip->has_feature_vmx())
- printf("Hypervisor features VMX\n");
+ log("Hypervisor features VMX");
if (hip->has_feature_svm())
- printf("Hypervisor features SVM\n");
- printf("Hypervisor reports %ux%u CPU%c - boot CPU is %lu\n",
- _cpus.width(), _cpus.height(), _cpus.total() > 1 ? 's' : ' ', boot_cpu());
+ log("Hypervisor features SVM");
+ log("Hypervisor reports ", _cpus.width(), "x", _cpus.height(), " "
+ "CPU", _cpus.total() > 1 ? "s" : " ", " - boot CPU is ", boot_cpu());
if (!cpuid_invariant_tsc())
- PWRN("CPU has no invariant TSC.");
+ warning("CPU has no invariant TSC.");
}
/* initialize core allocators */
@@ -385,7 +388,7 @@ Platform::Platform() :
/ hip->mem_desc_size;
if (verbose_boot_info)
- printf("Hypervisor info page contains %zd memory descriptors:\n", num_mem_desc);
+ log("Hypervisor info page contains ", num_mem_desc, " memory descriptors:");
addr_t mem_desc_base = ((addr_t)hip + hip->mem_desc_offset);
@@ -429,9 +432,10 @@ Platform::Platform() :
if (stack_area_virtual_base() <= check[i] &&
check[i] < stack_area_virtual_base() + stack_area_virtual_size())
{
- PERR("overlapping area - [%lx, %lx) vs %lx",
- stack_area_virtual_base(), stack_area_virtual_base() +
- stack_area_virtual_size(), check[i]);
+ error("overlapping area - ",
+ Hex_range(stack_area_virtual_base(),
+ stack_area_virtual_size()), " vs ",
+ Hex(check[i]));
nova_die();
}
}
@@ -447,9 +451,12 @@ Platform::Platform() :
for (unsigned i = 0; i < num_mem_desc; i++, mem_desc++) {
if (mem_desc->type != Hip::Mem_desc::AVAILABLE_MEMORY) continue;
- if (verbose_boot_info)
- printf("detected physical memory: 0x%16llx - size: 0x%llx\n",
- mem_desc->addr, mem_desc->size);
+ if (verbose_boot_info) {
+ addr_t const base = mem_desc->addr;
+ size_t const size = mem_desc->size;
+ log("detected physical memory: ", Hex(base, Hex::PREFIX, Hex::PAD),
+ " - size: ", Hex(size, Hex::PREFIX, Hex::PAD));
+ }
if (!mem_desc->size) continue;
@@ -465,7 +472,8 @@ Platform::Platform() :
size = trunc_page(mem_desc->addr + mem_desc->size) - base;
if (verbose_boot_info)
- printf("use physical memory: 0x%16lx - size: 0x%zx\n", base, size);
+ log("use physical memory: ", Hex(base, Hex::PREFIX, Hex::PAD),
+ " - size: ", Hex(size, Hex::PREFIX, Hex::PAD));
_io_mem_alloc.remove_range(base, size);
ram_alloc()->add_range(base, size);
@@ -538,10 +546,11 @@ Platform::Platform() :
(mem_d->addr >= mem_desc->addr + mem_desc->size))
continue;
- PERR("region overlap [0x%8llx+0x%8llx] (%d) with "
- "[0x%8llx+0x%8llx] (%d)",
- mem_desc->addr, mem_desc->size, mem_desc->type,
- mem_d->addr, mem_d->size, mem_d->type);
+ error("region overlap ",
+ Hex_range(mem_desc->addr, mem_desc->size), " "
+ "(", (int)mem_desc->type, ") with ",
+ Hex_range(mem_d->addr, mem_d->size), " "
+ "(", (int)mem_d->type, ")");
nova_die();
}
}
@@ -579,18 +588,14 @@ Platform::Platform() :
addr_t core_local_addr = _map_pages(rom_mem_start >> get_page_size_log2(),
pages_mapped);
if (!core_local_addr) {
- PERR("could not map multi boot module");
+ error("could not map multi boot module");
nova_die();
}
/* adjust core_local_addr of module if it was not page aligned */
core_local_addr += mem_desc->addr - rom_mem_start;
- if (verbose_boot_info)
- printf("map multi-boot module: physical 0x%8lx+0x%8llx"
- " - ", (addr_t)mem_desc->addr, mem_desc->size);
-
- char * name;
+ char *name = nullptr;
if (aux_in_rom_area) {
aux = core_local_addr + (mem_desc->aux - mem_desc->addr);
aux_len = strlen(reinterpret_cast(aux)) + 1;
@@ -629,7 +634,7 @@ Platform::Platform() :
prev_cmd_line_page = curr_cmd_line_page;
if (!mapped_cmd_line) {
- PERR("could not map command line");
+ error("could not map command line");
nova_die();
}
}
@@ -646,7 +651,11 @@ Platform::Platform() :
memset(reinterpret_cast(zero_out), 0, round_page(zero_out) -
zero_out);
- printf("%s\n", name);
+ if (verbose_boot_info)
+ log("map multi-boot module: physical ",
+ Hex((addr_t)mem_desc->addr, Hex::PREFIX, Hex::PAD), "+",
+ Hex((size_t)mem_desc->size, Hex::PREFIX, Hex::PAD), " - ",
+ Cstring(name));
/* revoke mapping of rom module - not needed */
unmap_local(__main_thread_utcb, trunc_page(core_local_addr),
@@ -686,9 +695,9 @@ Platform::Platform() :
_gsi_base_sel = (hip->mem_desc_offset - hip->cpu_desc_offset) / hip->cpu_desc_size;
if (verbose_boot_info) {
- printf(":virt_alloc: "); (*_core_mem_alloc.virt_alloc())()->dump_addr_tree();
- printf(":phys_alloc: "); (*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
- printf(":io_mem_alloc: "); _io_mem_alloc()->dump_addr_tree();
+ log(":virt_alloc: "); (*_core_mem_alloc.virt_alloc())()->dump_addr_tree();
+ log(":phys_alloc: "); (*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
+ log(":io_mem_alloc: "); _io_mem_alloc()->dump_addr_tree();
}
/* add capability selector ranges to map */
@@ -706,13 +715,6 @@ Platform::Platform() :
cap_map()->insert(range);
-/*
- if (verbose_boot_info)
- printf("add cap range [0x%8lx:0x%8lx) - physical 0x%8lx -> 0x%8lx\n",
- range->base(),
- range->base() + range->elements(), phys_addr, core_local_addr);
-*/
-
index = range->base() + range->elements();
}
diff --git a/repos/base-nova/src/core/platform_pd.cc b/repos/base-nova/src/core/platform_pd.cc
index 6b7fe4ad4..5f6e960fa 100644
--- a/repos/base-nova/src/core/platform_pd.cc
+++ b/repos/base-nova/src/core/platform_pd.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* core includes */
@@ -35,7 +35,7 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
void Platform_pd::unbind_thread(Platform_thread *thread)
{
- PDBG("not implemented");
+ warning(__func__, "not implemented");
}
diff --git a/repos/base-nova/src/core/platform_thread.cc b/repos/base-nova/src/core/platform_thread.cc
index 0981d5f93..5dc342b4a 100644
--- a/repos/base-nova/src/core/platform_thread.cc
+++ b/repos/base-nova/src/core/platform_thread.cc
@@ -14,7 +14,7 @@
*/
/* Genode includes */
-#include
+#include
/* core includes */
#include
@@ -39,7 +39,7 @@ using namespace Genode;
void Platform_thread::affinity(Affinity::Location location)
{
- PERR("dynamic affinity change not supported on NOVA");
+ error("dynamic affinity change not supported on NOVA");
}
@@ -51,20 +51,20 @@ int Platform_thread::start(void *ip, void *sp)
using namespace Nova;
if (!_pager) {
- PERR("pager undefined");
+ error("pager undefined");
return -1;
}
if (!_pd || (main_thread() && !vcpu() &&
_pd->parent_pt_sel() == Native_thread::INVALID_INDEX)) {
- PERR("protection domain undefined");
+ error("protection domain undefined");
return -2;
}
addr_t const pt_oom = _pager->get_oom_portal();
if (!pt_oom || map_local((Utcb *)Thread::myself()->utcb(),
Obj_crd(pt_oom, 0), Obj_crd(_sel_pt_oom(), 0))) {
- PERR("setup of out-of-memory notification portal - failed");
+ error("setup of out-of-memory notification portal - failed");
return -8;
}
@@ -73,7 +73,7 @@ int Platform_thread::start(void *ip, void *sp)
addr_t const utcb = vcpu() ? 0 : round_page(initial_sp);
if (_sel_exc_base == Native_thread::INVALID_INDEX) {
- PERR("exception base not specified");
+ error("exception base not specified");
return -3;
}
@@ -85,7 +85,7 @@ int Platform_thread::start(void *ip, void *sp)
utcb, initial_sp, _sel_exc_base, !worker());
if (res == Nova::NOVA_PD_OOM && Nova::NOVA_OK != _pager->handle_oom()) {
_pager->assign_pd(Native_thread::INVALID_INDEX);
- PERR("creation of new thread failed %u", res);
+ error("creation of new thread failed ", res);
return -4;
}
} while (res != Nova::NOVA_OK);
@@ -103,7 +103,7 @@ int Platform_thread::start(void *ip, void *sp)
}
if (_sel_exc_base != Native_thread::INVALID_INDEX) {
- PERR("thread already started");
+ error("thread already started");
return -5;
}
@@ -139,7 +139,7 @@ int Platform_thread::start(void *ip, void *sp)
uint8_t res = create_pd(pd_sel, pd_core_sel, initial_pts,
KEEP_FREE_PAGES_NOT_AVAILABLE_FOR_UPGRADE, UPPER_LIMIT_PAGES);
if (res != NOVA_OK) {
- PERR("create_pd returned %d", res);
+ error("create_pd returned ", res);
goto cleanup_pd;
}
@@ -148,7 +148,7 @@ int Platform_thread::start(void *ip, void *sp)
res = create_ec(_sel_ec(), pd_sel, _location.xpos(), pd_utcb, 0, 0,
THREAD_GLOBAL);
if (res != NOVA_OK) {
- PERR("create_ec returned %d", res);
+ error("create_ec returned ", res);
goto cleanup_pd;
}
@@ -179,7 +179,7 @@ int Platform_thread::start(void *ip, void *sp)
_pager->initial_esp(0);
_pager->assign_pd(Native_thread::INVALID_INDEX);
- PERR("create_sc returned %d", res);
+ error("create_sc returned ", res);
goto cleanup_ec;
}
@@ -214,8 +214,7 @@ void Platform_thread::resume()
uint8_t res;
do {
if (!_pd) {
- PERR("protection domain undefined %s - resuming thread failed",
- __PRETTY_FUNCTION__);
+ error("protection domain undefined - resuming thread failed");
return;
}
res = create_sc(_sel_sc(), _pd->pd_sel(), _sel_ec(),
@@ -305,7 +304,7 @@ const char * Platform_thread::pd_name() const {
Weak_ptr Platform_thread::address_space()
{
if (!_pd) {
- PERR("protection domain undefined %s", __PRETTY_FUNCTION__);
+ error(__PRETTY_FUNCTION__, ": protection domain undefined");
return Weak_ptr();
}
return _pd->Address_space::weak_ptr();
@@ -325,7 +324,7 @@ unsigned long long Platform_thread::execution_time() const
uint8_t res = Nova::sc_ctrl(_sel_sc(), time);
if (res != Nova::NOVA_OK)
- PDBG("sc_ctrl failed res=%x", res);
+ warning("sc_ctrl failed res=", res);
return time;
}
@@ -341,12 +340,12 @@ Platform_thread::Platform_thread(size_t, const char *name, unsigned prio,
_name(name)
{
if (_priority == 0) {
- PWRN("priority of thread '%s' below minimum - boost to 1", _name.string());
+ warning("priority of thread '", _name, "' below minimum - boost to 1");
_priority = 1;
}
if (_priority > Nova::Qpd::DEFAULT_PRIORITY) {
- PWRN("priority of thread '%s' above maximum - limit to %u",
- _name.string(), Nova::Qpd::DEFAULT_PRIORITY);
+ warning("priority of thread '", _name, "' above maximum - limit to ",
+ (unsigned)Nova::Qpd::DEFAULT_PRIORITY);
_priority = Nova::Qpd::DEFAULT_PRIORITY;
}
}
diff --git a/repos/base-nova/src/core/ram_session_support.cc b/repos/base-nova/src/core/ram_session_support.cc
index b77d0ebf2..ef3b921a1 100644
--- a/repos/base-nova/src/core/ram_session_support.cc
+++ b/repos/base-nova/src/core/ram_session_support.cc
@@ -12,7 +12,6 @@
*/
/* Genode includes */
-#include
#include
/* core includes */
diff --git a/repos/base-nova/src/core/rpc_cap_factory.cc b/repos/base-nova/src/core/rpc_cap_factory.cc
index bd6cb4eee..015491c75 100644
--- a/repos/base-nova/src/core/rpc_cap_factory.cc
+++ b/repos/base-nova/src/core/rpc_cap_factory.cc
@@ -43,8 +43,12 @@ Native_capability Rpc_cap_factory::alloc(Native_capability ep, addr_t entry, add
if (res == NOVA_OK)
return Capability_space::import(pt_sel);
- PERR("cap_session - cap=%lx:%lx addr=%lx mtd=%lx xpt=%lx res=%u",
- ec_sel, ep.local_name(), entry, mtd, pt_sel, res);
+ error("cap alloc - "
+ "cap=", Hex(ec_sel), ":", Hex(ep.local_name()), " "
+ "entry=", Hex(entry), " "
+ "mtd=", Hex(mtd), " "
+ "xpt=", Hex(pt_sel), " "
+ "res=", res);
_list.remove(pt_cap);
destroy(&_slab, pt_cap);
@@ -72,7 +76,7 @@ void Rpc_cap_factory::free(Native_capability cap)
return;
}
}
- PDBG("invalid cap object");
+ warning("attempt to free invalid cap object");
}
diff --git a/repos/base-nova/src/core/thread_start.cc b/repos/base-nova/src/core/thread_start.cc
index 53bfd1b3c..3583b579e 100644
--- a/repos/base-nova/src/core/thread_start.cc
+++ b/repos/base-nova/src/core/thread_start.cc
@@ -15,7 +15,7 @@
/* Genode includes */
#include
-#include
+#include
/* base-internal includes */
#include
@@ -61,7 +61,7 @@ void Thread::_init_platform_thread(size_t, Type type)
addr_t rs_sel =native_thread().exc_pt_sel + SM_SEL_EC;
uint8_t res = create_sm(rs_sel, pd_sel, 0);
if (res != NOVA_OK) {
- PERR("create_sm returned %u", res);
+ error("create_sm returned ", res);
throw Cpu_session::Thread_creation_failed();
}
}
@@ -105,7 +105,7 @@ void Thread::start()
uint8_t res = create_ec(native_thread().ec_sel, pd_sel, location.xpos(),
utcb, sp, native_thread().exc_pt_sel, LOCAL_THREAD);
if (res != NOVA_OK) {
- PERR("create_ec returned %d cpu=%u", res, location.xpos());
+ error("create_ec returned ", res, " cpu=", location.xpos());
throw Cpu_session::Thread_creation_failed();
}
@@ -116,7 +116,7 @@ void Thread::start()
if (map_local(reinterpret_cast(Thread::myself()->utcb()),
Obj_crd(PT_SEL_PAGE_FAULT, 0),
Obj_crd(native_thread().exc_pt_sel + PT_SEL_PAGE_FAULT, 0))) {
- PERR("could not create page fault portal");
+ error("could not create page fault portal");
throw Cpu_session::Thread_creation_failed();
}
}
diff --git a/repos/base-nova/src/include/base/internal/ipc.h b/repos/base-nova/src/include/base/internal/ipc.h
index d152f49d2..c399686f5 100644
--- a/repos/base-nova/src/include/base/internal/ipc.h
+++ b/repos/base-nova/src/include/base/internal/ipc.h
@@ -48,8 +48,9 @@ static inline Nova::mword_t copy_utcb_to_msgbuf(Nova::Utcb &utcb,
size_t num_data_words = num_msg_words - 1;
if (num_data_words*sizeof(mword_t) > rcv_msg.capacity()) {
- PERR("receive message buffer too small msg size=%zx, buf size=%zd",
- num_data_words*sizeof(mword_t), rcv_msg.capacity());
+ error("receive message buffer too small msg "
+ "size=", num_data_words*sizeof(mword_t), " "
+ "buf size=", rcv_msg.capacity());
num_data_words = rcv_msg.capacity()/sizeof(mword_t);
}
@@ -91,7 +92,7 @@ static inline bool copy_msgbuf_to_utcb(Nova::Utcb &utcb,
enum { NUM_MSG_REGS = 256 };
if (num_msg_words > NUM_MSG_REGS) {
- PERR("Message does not fit into UTCB message registers\n");
+ error("message does not fit into UTCB message registers");
num_msg_words = NUM_MSG_REGS;
}
diff --git a/repos/base-nova/src/include/signal_source/client.h b/repos/base-nova/src/include/signal_source/client.h
index 2a2662a6b..b1ddb028e 100644
--- a/repos/base-nova/src/include/signal_source/client.h
+++ b/repos/base-nova/src/include/signal_source/client.h
@@ -90,7 +90,7 @@ namespace Genode {
/* block on semaphore until signal context was submitted */
if (uint8_t res = si_ctrl(_sem.local_name(), SEMAPHORE_DOWN,
imprint, count))
- PWRN("signal reception failed - error %u", res);
+ warning("signal reception failed - error ", res);
} while (imprint == 0);
diff --git a/repos/base-nova/src/lib/base/cap_map.cc b/repos/base-nova/src/lib/base/cap_map.cc
index b46a7da87..ff94fe20e 100644
--- a/repos/base-nova/src/lib/base/cap_map.cc
+++ b/repos/base-nova/src/lib/base/cap_map.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
/* NOVA includes */
#include
@@ -55,8 +55,7 @@ void Cap_range::inc(unsigned id)
}
if (failure)
- PERR("cap reference counting error - reference overflow of cap=%lx",
- _base + id);
+ error("cap reference counting error - reference overflow of cap=", _base + id);
}
@@ -82,8 +81,9 @@ void Cap_range::dec(unsigned const id_start, bool revoke, unsigned num_log_2)
}
if (failure)
- PERR("cap reference counting error - one counter of cap range %lx+%x "
- "has been already zero", _base + id_start, 1 << num_log_2);
+ error("cap reference counting error - one counter of cap ",
+ "range ", _base + id_start, "+", 1 << num_log_2, " "
+ "has been already zero");
}
diff --git a/repos/base-nova/src/lib/base/capability.cc b/repos/base-nova/src/lib/base/capability.cc
index ca776beb9..1abac4d61 100644
--- a/repos/base-nova/src/lib/base/capability.cc
+++ b/repos/base-nova/src/lib/base/capability.cc
@@ -11,8 +11,6 @@
* under the terms of the GNU General Public License version 2.
*/
-#include
-
/* base-internal includes */
#include
diff --git a/repos/base-nova/src/lib/base/ipc.cc b/repos/base-nova/src/lib/base/ipc.cc
index fa4894ca7..fc1a6efe4 100644
--- a/repos/base-nova/src/lib/base/ipc.cc
+++ b/repos/base-nova/src/lib/base/ipc.cc
@@ -14,7 +14,7 @@
/* Genode includes */
#include
#include
-#include
+#include
/* base-internal includes */
#include
@@ -51,7 +51,7 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
/* the protocol value is unused as the badge is delivered by the kernel */
if (!copy_msgbuf_to_utcb(utcb, snd_msg, 0)) {
- PERR("could not setup IPC");
+ error("could not setup IPC");
throw Ipc_error();
}
diff --git a/repos/base-nova/src/lib/base/rpc_entrypoint.cc b/repos/base-nova/src/lib/base/rpc_entrypoint.cc
index 72e1a105e..4b2664d17 100644
--- a/repos/base-nova/src/lib/base/rpc_entrypoint.cc
+++ b/repos/base-nova/src/lib/base/rpc_entrypoint.cc
@@ -14,7 +14,6 @@
*/
/* Genode includes */
-#include
#include
#include
@@ -94,8 +93,7 @@ void Rpc_entrypoint::_dissolve(Rpc_object_base *obj)
utcb->msg[0] = 0xdead;
utcb->set_msg_word(1);
if (uint8_t res = call(_cap.local_name()))
- PERR("%8p - could not clean up entry point of thread 0x%p - res %u",
- utcb, this->utcb(), res);
+ error(utcb, " - could not clean up entry point of thread ", this->utcb(), " - res ", res);
}
@@ -140,7 +138,7 @@ void Rpc_entrypoint::_activation_entry()
/* in case of a portal cleanup call we are done here - just reply */
if (ep._cap.local_name() == (long)id_pt) {
if (!rcv_window.prepare_rcv_window(utcb))
- PWRN("out of capability selectors for handling server requests");
+ warning("out of capability selectors for handling server requests");
ep._rcv_buf.reset();
reply(utcb, exc, ep._snd_buf);
@@ -153,8 +151,7 @@ void Rpc_entrypoint::_activation_entry()
/* atomically lookup and lock referenced object */
auto lambda = [&] (Rpc_object_base *obj) {
if (!obj) {
- PERR("could not look up server object, return from call id_pt=%lx",
- id_pt);
+ error("could not look up server object, return from call id_pt=", id_pt);
return;
}
@@ -166,7 +163,7 @@ void Rpc_entrypoint::_activation_entry()
ep.apply(id_pt, lambda);
if (!rcv_window.prepare_rcv_window(*(Nova::Utcb *)ep.utcb()))
- PWRN("out of capability selectors for handling server requests");
+ warning("out of capability selectors for handling server requests");
ep._rcv_buf.reset();
reply(utcb, exc, ep._snd_buf);
@@ -238,7 +235,7 @@ Rpc_entrypoint::~Rpc_entrypoint()
typedef Object_pool Pool;
Pool::remove_all([&] (Rpc_object_base *obj) {
- PWRN("Object pool not empty in %s", __func__);
+ warning("object pool not empty in ", __func__);
_dissolve(obj);
});
diff --git a/repos/base-nova/src/lib/base/signal_submit.cc b/repos/base-nova/src/lib/base/signal_submit.cc
index 3c2df933d..a8ab5287f 100644
--- a/repos/base-nova/src/lib/base/signal_submit.cc
+++ b/repos/base-nova/src/lib/base/signal_submit.cc
@@ -14,6 +14,7 @@
/* Genode includes */
#include
+#include
#include
/* NOVA includes */
@@ -40,8 +41,7 @@ void Signal_transmitter::submit(unsigned cnt)
if (res == NOVA_OK)
return;
- PDBG("submitting signal failed - error %u - context=0x%lx", res,
- _context.local_name());
+ warning("submitting signal failed - error ", res, " - context=", _context);
_context = Signal_context_capability();
}
diff --git a/repos/base-nova/src/lib/base/thread_start.cc b/repos/base-nova/src/lib/base/thread_start.cc
index cee4bec8a..d1a948ec8 100644
--- a/repos/base-nova/src/lib/base/thread_start.cc
+++ b/repos/base-nova/src/lib/base/thread_start.cc
@@ -15,7 +15,7 @@
/* Genode includes */
#include
-#include
+#include
#include
#include
#include
@@ -47,8 +47,8 @@ void Thread::_thread_start()
Thread::myself()->entry();
} catch (...) {
try {
- PERR("Thread '%s' died because of an uncaught exception",
- Thread::myself()->name().string());
+ error("Thread '", Thread::myself()->name(), "' "
+ "died because of an uncaught exception");
} catch (...) {
/* die in a noisy way */
nova_die();
diff --git a/repos/base-nova/src/test/platform/ipc.cc b/repos/base-nova/src/test/platform/ipc.cc
index eb4967c6a..a1288280f 100644
--- a/repos/base-nova/src/test/platform/ipc.cc
+++ b/repos/base-nova/src/test/platform/ipc.cc
@@ -16,7 +16,6 @@
/* Genode includes */
#include
-#include
/* test specific includes */
#include "server.h"
diff --git a/repos/base-nova/src/test/platform/main.cc b/repos/base-nova/src/test/platform/main.cc
index c6d6d2e41..854481ddf 100644
--- a/repos/base-nova/src/test/platform/main.cc
+++ b/repos/base-nova/src/test/platform/main.cc
@@ -13,7 +13,7 @@
*/
#include
-#include
+#include
#include
#include
@@ -53,7 +53,7 @@ void test_translate()
local_name == (addr_t)Native_thread::INVALID_INDEX)
{
failed ++;
- PERR("%s: ipc call failed %lx", __func__, rpc);
+ error(__func__, ": ipc call failed ", Hex(rpc));
ep.dissolve(&component);
return;
}
@@ -66,21 +66,21 @@ void test_translate()
local_name == (addr_t)Native_thread::INVALID_INDEX)
{
failed ++;
- PERR("%s: ipc call failed %lx", __func__, rpc);
+ error(__func__, ": ipc call failed ", Hex(rpc));
ep.dissolve(&component);
return;
}
Genode::Native_capability copy2 = Capability_space::import(local_name);
- PINF("delegation session_cap->copy1->copy2 0x%lx->0x%lx->0x%lx",
- session_cap.local_name(), copy1.local_name(), copy2.local_name());
+ log("delegation session_cap->copy1->copy2 ",
+ session_cap, "->", copy1, "->", copy2);
/* sanity checks translate which must work */
Genode::Native_capability got_cap = client.cap_cap(copy2.local_name());
if (got_cap.local_name() != copy1.local_name()) {
failed ++;
- PERR("%u:%s translate failed", __LINE__, __func__);
+ error(__LINE__, ":", __func__, " translate failed");
ep.dissolve(&component);
return;
}
@@ -88,7 +88,7 @@ void test_translate()
got_cap = client.cap_cap(copy1.local_name());
if (got_cap.local_name() != session_cap.local_name()) {
failed ++;
- PERR("%u:%s translate failed", __LINE__, __func__);
+ error(__LINE__, ":", __func__, " translate failed");
ep.dissolve(&component);
return;
}
@@ -96,7 +96,7 @@ void test_translate()
got_cap = client.cap_cap(session_cap.local_name());
if (got_cap.local_name() != session_cap.local_name()) {
failed ++;
- PERR("%u:%s translate failed", __LINE__, __func__);
+ error(__LINE__, ":", __func__, " translate failed");
ep.dissolve(&component);
return;
}
@@ -114,7 +114,7 @@ void test_translate()
Genode::uint8_t res = Nova::lookup(crd_ses);
if (res != Nova::NOVA_OK || !crd_ses.is_null()) {
failed ++;
- PERR("%u - lookup call failed err=%x", __LINE__, res);
+ error(__LINE__, " - lookup call failed err=", Hex(res));
ep.dissolve(&component);
return;
}
@@ -123,7 +123,7 @@ void test_translate()
got_cap = client.cap_cap(copy2.local_name());
if (got_cap.local_name() != session_cap.local_name()) {
failed ++;
- PERR("%u:%s translate failed", __LINE__, __func__);
+ error(__LINE__, ":", __func__, " translate failed");
ep.dissolve(&component);
return;
}
@@ -148,7 +148,7 @@ void test_revoke()
local_name == (addr_t)Native_thread::INVALID_INDEX)
{
failed ++;
- PERR("test_revoke ipc call failed %lx", rpc);
+ error("test_revoke ipc call failed ", Hex(rpc));
ep.dissolve(&component);
return;
}
@@ -161,7 +161,7 @@ void test_revoke()
local_name == (addr_t)Native_thread::INVALID_INDEX)
{
failed ++;
- PERR("test_revoke ipc call failed %lx", rpc);
+ error("test_revoke ipc call failed ", Hex(rpc));
ep.dissolve(&component);
return;
}
@@ -171,7 +171,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 ||
crd_dst.order() != 0) {
failed ++;
- PERR("%u - lookup call failed %x", __LINE__, res);
+ error(__LINE__, " - lookup call failed ", Hex(res));
ep.dissolve(&component);
return;
}
@@ -181,7 +181,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_ses.base() != (addr_t)copy_session_cap.local_name()
|| crd_ses.type() != 3 || crd_ses.order() != 0) {
failed ++;
- PERR("%u - lookup call failed err=%x is_null=%u", __LINE__, res, crd_ses.is_null());
+ error(__LINE__, " - lookup call failed err=", Hex(res), " is_null=", crd_ses.is_null());
ep.dissolve(&component);
return;
}
@@ -190,7 +190,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 ||
crd_dst.order() != 0) {
failed ++;
- PERR("%u - lookup call failed err=%x is_null=%u", __LINE__, res, crd_dst.is_null());
+ error(__LINE__, " - lookup call failed err=", Hex(res), " is_null=", crd_dst.is_null());
ep.dissolve(&component);
return;
}
@@ -203,7 +203,7 @@ void test_revoke()
res = Nova::lookup(crd_ses);
if (res != Nova::NOVA_OK || !crd_ses.is_null()) {
failed ++;
- PERR("%u - lookup call failed err=%x", __LINE__, res);
+ error(__LINE__, " - lookup call failed err=", Hex(res));
ep.dissolve(&component);
return;
}
@@ -212,7 +212,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 ||
crd_dst.order() != 0) {
failed ++;
- PERR("%u - lookup call failed err=%x is_null=%u", __LINE__, res, crd_dst.is_null());
+ error(__LINE__, " - lookup call failed err=", Hex(res), " is_null=", crd_dst.is_null());
ep.dissolve(&component);
return;
}
@@ -231,7 +231,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_ses.base() != (addr_t)copy_session_cap.local_name() ||
crd_ses.type() != 3 || crd_ses.order() != 0) {
failed ++;
- PERR("%u - lookup call failed err=%x is_null=%u", __LINE__, res, crd_ses.is_null());
+ error(__LINE__, " - lookup call failed err=", Hex(res), " is_null=", crd_ses.is_null());
ep.dissolve(&component);
return;
}
@@ -244,7 +244,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 ||
crd_dst.order() != 0) {
failed ++;
- PERR("%u - lookup call failed err=%x is_null=%u", __LINE__, res, crd_dst.is_null());
+ error(__LINE__, " - lookup call failed err=", Hex(res), " is_null=", crd_dst.is_null());
ep.dissolve(&component);
return;
}
@@ -257,7 +257,7 @@ void test_revoke()
res = Nova::lookup(crd_dst);
if (res != Nova::NOVA_OK || !crd_dst.is_null()) {
failed ++;
- PERR("%u - lookup call failed err=%x is_null=%u", __LINE__, res, crd_dst.is_null());
+ error(__LINE__, " - lookup call failed err=", Hex(res), " is_null=", crd_dst.is_null());
return;
}
}
@@ -346,9 +346,9 @@ void test_pat()
if (check_pat && diff_run * 100 / hip->tsc_freq) {
failed ++;
- PERR("map=%llx remap=%llx --> diff=%llx freq_tsc=%u %llu us",
- map_run, remap_run, diff_run, hip->tsc_freq,
- diff_run * 1000 / hip->tsc_freq);
+ error("map=", Hex(map_run), " remap=", Hex(remap_run), " --> "
+ "diff=", Hex(diff_run), " freq_tsc=", hip->tsc_freq, " ",
+ diff_run * 1000 / hip->tsc_freq, " us");
}
Nova::revoke(Nova::Mem_crd(remap_addr >> PAGE_4K, DS_ORDER, all));
@@ -376,7 +376,7 @@ void test_server_oom()
Genode::Native_capability got_cap = client.void_cap();
if (!got_cap.valid()) {
- PERR("%u cap id %lx invalid", i, got_cap.local_name());
+ error(i, " cap id ", Hex(got_cap.local_name()), " invalid");
failed ++;
break;
}
@@ -386,7 +386,7 @@ void test_server_oom()
idx.inc();
if (i % 5000 == 4999)
- PINF("received %u. cap", i);
+ log("received ", i, ". cap");
}
/* XXX this code does does no longer work since the removal of 'solely_map' */
@@ -399,13 +399,13 @@ void test_server_oom()
send_cap.solely_map();
if (!client.cap_void(send_cap)) {
- PERR("sending %4u. cap failed", i);
+ error("sending ", i, ". cap failed");
failed ++;
break;
}
if (i % 5000 == 4999)
- PINF("sent %u. cap", i);
+ log("sent ", i, ". cap");
}
#endif
@@ -423,7 +423,7 @@ class Greedy : public Thread_deprecated<4096> {
void entry()
{
- PINF("starting");
+ log("starting");
enum { SUB_RM_SIZE = 2UL * 1024 * 1024 * 1024 };
@@ -436,8 +436,8 @@ class Greedy : public Thread_deprecated<4096> {
addr_t const page_fault_portal = native_thread().exc_pt_sel + 14;
- PERR("cause mappings in range [0x%lx, 0x%lx) %p", mem,
- mem + SUB_RM_SIZE - 1, &mem);
+ log("cause mappings in range ",
+ Hex_range(mem, SUB_RM_SIZE), " ", &mem);
for (addr_t map_to = mem; map_to < mem + SUB_RM_SIZE; map_to += 4096) {
@@ -450,7 +450,7 @@ class Greedy : public Thread_deprecated<4096> {
/* trigger faked page fault */
Genode::uint8_t res = Nova::call(page_fault_portal);
if (res != Nova::NOVA_OK) {
- PINF("call result=%u", res);
+ log("call result=", res);
failed++;
return;
}
@@ -460,13 +460,13 @@ class Greedy : public Thread_deprecated<4096> {
/* print status information in interval of 32M */
if (!(map_to & (32UL * 1024 * 1024 - 1))) {
- printf("0x%lx\n", map_to);
+ log(Hex(map_to));
/* trigger some work to see quota in kernel decreasing */
// Nova::Rights rwx(true, true, true);
// Nova::revoke(Nova::Mem_crd((map_to - 32 * 1024 * 1024) >> 12, 12, rwx));
}
}
- printf("still alive - done\n");
+ log("still alive - done");
}
};
@@ -483,16 +483,16 @@ void check(uint8_t res, const char *format, ...)
va_end(list);
if (res == Nova::NOVA_OK) {
- PERR("res=%u %s - TEST FAILED", res, buf);
+ error("res=", res, " ", Cstring(buf), " - TEST FAILED");
failed++;
}
else
- printf("res=%u %s\n", res, buf);
+ log("res=", res, " ", Cstring(buf));
}
int main(int argc, char **argv)
{
- printf("testing base-nova platform\n");
+ log("testing base-nova platform");
try {
Genode::config()->xml_node().attribute("check_pat").value(&check_pat);
@@ -564,7 +564,7 @@ int main(int argc, char **argv)
core_pagefault_oom.join();
if (!failed)
- printf("Test finished\n");
+ log("Test finished");
return -failed;
}
diff --git a/repos/base-okl4/src/core/core_region_map.cc b/repos/base-okl4/src/core/core_region_map.cc
index b36591044..c07fdec8d 100644
--- a/repos/base-okl4/src/core/core_region_map.cc
+++ b/repos/base-okl4/src/core/core_region_map.cc
@@ -37,20 +37,20 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
& get_page_mask();
if (use_local_addr) {
- PERR("Parameter 'use_local_addr' not supported within core");
+ error("parameter 'use_local_addr' not supported within core");
return nullptr;
}
if (offset) {
- PERR("Parameter 'offset' not supported within core");
+ error("parameter 'offset' not supported within core");
return nullptr;
}
/* allocate range in core's virtual address space */
void *virt_addr;
if (!platform()->region_alloc()->alloc(page_rounded_size, &virt_addr)) {
- PERR("Could not allocate virtual address range in core of size %zd\n",
- page_rounded_size);
+ error("could not allocate virtual address range in core of size ",
+ page_rounded_size);
return nullptr;
}
diff --git a/repos/base-okl4/src/core/include/map_local.h b/repos/base-okl4/src/core/include/map_local.h
index 495e416db..3cc4cea83 100644
--- a/repos/base-okl4/src/core/include/map_local.h
+++ b/repos/base-okl4/src/core/include/map_local.h
@@ -15,7 +15,7 @@
#define _CORE__INCLUDE__MAP_LOCAL_H_
/* Genode includes */
-#include
+#include
/* core includes */
#include
@@ -36,8 +36,8 @@ namespace Genode {
L4_FpageAddRightsTo(&fpage, L4_FullyAccessible);
int ret = L4_UnmapFpage(L4_rootspace, fpage);
if (ret != 1)
- PERR("could not unmap page at %p from core (Error Code %ld)",
- (void *)base, L4_ErrorCode());
+ error("could not unmap page at ", Hex(base), " from core, "
+ "error=", L4_ErrorCode());
}
/**
@@ -61,7 +61,7 @@ namespace Genode {
fpage.X.rwx = 7;
if (L4_MapFpage(L4_rootspace, fpage, phys_desc) != 1) {
- PERR("Core-local memory mapping failed, Error Code=%d\n", (int)L4_ErrorCode());
+ error("core-local memory mapping failed, error=", L4_ErrorCode());
return false;
}
offset += get_page_size();
diff --git a/repos/base-okl4/src/core/include/util.h b/repos/base-okl4/src/core/include/util.h
index 7fec16926..be6c30d9b 100644
--- a/repos/base-okl4/src/core/include/util.h
+++ b/repos/base-okl4/src/core/include/util.h
@@ -17,7 +17,7 @@
/* Genode includes */
#include
#include
-#include
+#include
#include
/* base-internal includes */
@@ -50,7 +50,7 @@ namespace Genode {
inline void panic(const char *s)
{
using namespace Okl4;
- PDBG("Panic: %s", s);
+ error("Panic: ", s);
ENTER_KDB("> panic <");
}
@@ -58,7 +58,7 @@ namespace Genode {
{
using namespace Okl4;
if (!val) {
- PERR("Assertion failed: %s", s);
+ error("assertion failed: ", s);
ENTER_KDB("Assertion failed");
}
}
@@ -117,10 +117,9 @@ namespace Genode {
Region_map::State::Fault_type pf_type,
unsigned long faulter_badge)
{
- printf("%s (%s pf_addr=%p pf_ip=%p from %02lx)\n", msg,
- pf_type == Region_map::State::WRITE_FAULT ? "WRITE" : "READ",
- (void *)pf_addr, (void *)pf_ip,
- faulter_badge);
+ log(pf_type == Region_map::State::WRITE_FAULT ? "WRITE" : "READ", " (",
+ msg, " pf_addr=", Hex(pf_addr), " pf_ip=", Hex(pf_ip), " "
+ "from ", Hex(faulter_badge), ")");
}
inline addr_t map_src_addr(addr_t core_local, addr_t phys) { return phys; }
diff --git a/repos/base-okl4/src/core/irq_session_component.cc b/repos/base-okl4/src/core/irq_session_component.cc
index 67299c4df..3c166d6d5 100644
--- a/repos/base-okl4/src/core/irq_session_component.cc
+++ b/repos/base-okl4/src/core/irq_session_component.cc
@@ -13,7 +13,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* core includes */
@@ -55,8 +55,8 @@ bool Irq_object::_associate()
L4_LoadMR(0, _irq);
int ret = L4_AllowInterruptControl(L4_rootspace);
if (ret != 1) {
- PERR("L4_AllowInterruptControl returned %d, error code=%ld\n",
- ret, L4_ErrorCode());
+ error("L4_AllowInterruptControl returned ", ret, ", error=",
+ L4_ErrorCode());
return false;
}
@@ -67,8 +67,8 @@ bool Irq_object::_associate()
L4_LoadMR(0, _irq);
ret = L4_RegisterInterrupt(thread_get_my_global_id(), IRQ_NOTIFY_BIT, 0, 0);
if (ret != 1) {
- PERR("L4_RegisterInterrupt returned %d, error code=%ld\n",
- ret, L4_ErrorCode());
+ error("L4_RegisterInterrupt returned ", ret, ", error=",
+ L4_ErrorCode());
return false;
}
@@ -98,7 +98,7 @@ void Irq_object::start()
void Irq_object::entry()
{
if (!_associate())
- PERR("Could not associate with IRQ 0x%x", _irq);
+ error("could not associate with IRQ ", Hex(_irq));
/* thread is up and ready */
_sync_bootup.unlock();
@@ -148,7 +148,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
throw Root::Unavailable();
if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).error()) {
- PERR("Unavailable IRQ 0x%x requested", _irq_number);
+ error("unavailable IRQ ", Hex(_irq_number), " requested");
throw Root::Unavailable();
}
@@ -158,7 +158,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
Irq_session_component::~Irq_session_component()
{
- PDBG("Not yet implemented!");
+ warning(__func__, " not yet implemented!");
}
diff --git a/repos/base-okl4/src/core/pager.cc b/repos/base-okl4/src/core/pager.cc
index defdfef66..f96319ee2 100644
--- a/repos/base-okl4/src/core/pager.cc
+++ b/repos/base-okl4/src/core/pager.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
/* core includes */
#include
@@ -44,11 +44,11 @@ using namespace Okl4;
static inline void print_page_fault(L4_Word_t type, L4_Word_t addr, L4_Word_t ip,
unsigned long badge)
{
- printf("page (%s%s%s) fault at fault_addr=%lx, fault_ip=%lx, from=%lx\n",
- type & L4_Readable ? "r" : "-",
- type & L4_Writable ? "w" : "-",
- type & L4_eXecutable ? "x" : "-",
- addr, ip, badge);
+ log("page (",
+ type & L4_Readable ? "r" : "-",
+ type & L4_Writable ? "w" : "-",
+ type & L4_eXecutable ? "x" : "-",
+ ") fault at fault_addr=, ", Hex(addr), ", ip=", Hex(ip), ", from=", badge);
}
@@ -106,9 +106,9 @@ void Ipc_pager::wait_for_fault()
L4_StoreMR(1, &_fault_ip);
if (verbose_exception)
- PERR("Exception (label 0x%x) occured in space %d at IP 0x%p",
- (int)L4_Label(_faulter_tag), (int)L4_SenderSpace().raw,
- (void *)_fault_ip);
+ error("exception (label ", Hex(L4_Label(_faulter_tag)), ") occured, "
+ "space=", Hex(L4_SenderSpace().raw), ", "
+ "ip=", Hex(_fault_ip));
}
/* page fault */
@@ -133,8 +133,7 @@ void Ipc_pager::reply_and_wait_for_fault()
_reply_mapping.phys_desc());
if (ret != 1)
- PERR("L4_MapFpage returned %d, error_code=%d",
- ret, (int)L4_ErrorCode());
+ error("L4_MapFpage returned ", ret, ", error=", L4_ErrorCode());
/* reply to page-fault message to resume the faulting thread */
acknowledge_wakeup();
diff --git a/repos/base-okl4/src/core/platform.cc b/repos/base-okl4/src/core/platform.cc
index b4137f7e0..92c823ecf 100644
--- a/repos/base-okl4/src/core/platform.cc
+++ b/repos/base-okl4/src/core/platform.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
#include
#include
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
/* core includes */
#include
@@ -38,8 +39,6 @@ namespace Okl4 {
using namespace Genode;
-static const bool verbose_boot_info = false;
-
enum { MAX_BOOT_MODULES = 64 };
enum { MAX_BOOT_MODULE_NAME_LEN = 32 };
static struct
@@ -75,10 +74,6 @@ int Platform::bi_init_mem(Okl4::uintptr_t virt_base, Okl4::uintptr_t virt_end,
Okl4::uintptr_t phys_base, Okl4::uintptr_t phys_end,
const Okl4::bi_user_data_t *data)
{
- if (verbose_boot_info)
- printf("init_mem: virt=[%08lx,%08lx), phys=[%08lx,%08lx)\n",
- virt_base, virt_end, phys_base, phys_end);
-
Platform *p = (Platform *)data->user_data;
p->_core_mem_alloc.phys_alloc()->add_range(phys_base, phys_end - phys_base + 1);
p->_core_mem_alloc.virt_alloc()->add_range(virt_base, virt_end - virt_base + 1);
@@ -89,10 +84,6 @@ int Platform::bi_init_mem(Okl4::uintptr_t virt_base, Okl4::uintptr_t virt_end,
int Platform::bi_add_virt_mem(Okl4::bi_name_t pool, Okl4::uintptr_t base,
Okl4::uintptr_t end, const Okl4::bi_user_data_t *data)
{
- if (verbose_boot_info)
- printf("add_virt_mem: pool=%d region=[0x%08lx,0x%08lx], %ld pages\n",
- pool, base, end, (end - base + 1)/4096);
-
/* prevent first page from being added to core memory */
if (base < get_page_size() || end < get_page_size())
return 0;
@@ -106,10 +97,6 @@ int Platform::bi_add_virt_mem(Okl4::bi_name_t pool, Okl4::uintptr_t base,
int Platform::bi_add_phys_mem(Okl4::bi_name_t pool, Okl4::uintptr_t base,
Okl4::uintptr_t end, const Okl4::bi_user_data_t *data)
{
- if (verbose_boot_info)
- printf("add_phys_mem: pool=%d region=[0x%08lx,0x%08lx], %ld pages\n",
- pool, base, end, (end - base + 1)/4096);
-
if (pool == 2) {
Platform *p = (Platform *)data->user_data;
p->_core_mem_alloc.phys_alloc()->add_range(base, end - base + 1);
@@ -122,10 +109,6 @@ int Platform::bi_export_object(Okl4::bi_name_t pd, Okl4::bi_name_t obj,
Okl4::bi_export_type_t export_type, char *key,
Okl4::size_t key_len, const Okl4::bi_user_data_t * data)
{
- if (verbose_boot_info)
- printf("export_object: pd=%d obj=%d type=%d key=\"%s\"\n",
- pd, obj, export_type, key);
-
/*
* We walk the boot info only once and collect all memory section
* objects. Each time we detect a memory section outside of roottask
@@ -139,7 +122,7 @@ int Platform::bi_export_object(Okl4::bi_name_t pd, Okl4::bi_name_t obj,
return 0;
if (num_boot_module_objects >= MAX_BOOT_MODULES) {
- PERR("Maximum number of boot modules exceeded");
+ error("maximum number of boot modules exceeded");
return -1;
}
@@ -168,10 +151,6 @@ Okl4::bi_name_t Platform::bi_new_ms(Okl4::bi_name_t owner,
Okl4::bi_name_t physpool, Okl4::bi_name_t virtpool,
Okl4::bi_name_t zone, const Okl4::bi_user_data_t *data)
{
- if (verbose_boot_info)
- printf("new_ms: owner=%d region=[%lx,%lx), flags=%lx, attr=%lx, physpool=%d, virtpool=%d, zone=%d\n",
- owner, base, base + size - 1, flags, attr, physpool, virtpool, zone);
-
/* reset module index (see comment in 'bi_export_object') */
if (owner == 0) num_boot_module_memsects = 0;
@@ -179,7 +158,7 @@ Okl4::bi_name_t Platform::bi_new_ms(Okl4::bi_name_t owner,
if (virtpool != 3) return 0;
if (num_boot_module_memsects >= MAX_BOOT_MODULES) {
- PERR("Maximum number of boot modules exceeded");
+ error("maximum number of boot modules exceeded");
return -1;
}
@@ -237,8 +216,6 @@ Platform::Platform() :
* the location of the boot modules.
*/
- printf("parsing boot info at 0x%p...\n", (void *)boot_info_addr);
-
/*
* Initialize callback function for parsing the boot-info
*
@@ -281,19 +258,14 @@ Platform::Platform() :
_vm_start = 0x1000;
_vm_size = 0xb0000000 - 0x1000;
- /*
- * When dumping 'ram_alloc', there are several small blocks in addition
- * to the available free memory visible. These small blocks are used to
- * hold the meta data for the ROM modules as initialized by '_setup_rom'.
- */
- if (verbose_boot_info) {
- printf(":phys_alloc: "); (*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
- printf(":virt_alloc: "); (*_core_mem_alloc.virt_alloc())()->dump_addr_tree();
- printf(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
- printf(":io_port: "); _io_port_alloc()->dump_addr_tree();
- printf(":irq: "); _irq_alloc()->dump_addr_tree();
- printf(":rom_fs: "); _rom_fs.print_fs();
- }
+ init_log();
+
+ log(":phys_alloc: "); (*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
+ log(":virt_alloc: "); (*_core_mem_alloc.virt_alloc())()->dump_addr_tree();
+ log(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
+ log(":io_port: "); _io_port_alloc()->dump_addr_tree();
+ log(":irq: "); _irq_alloc()->dump_addr_tree();
+ log(":rom_fs: "); _rom_fs.print_fs();
/* setup task object for core task */
_core_pd = new(core_mem_alloc()) Platform_pd(true);
diff --git a/repos/base-okl4/src/core/platform_pd.cc b/repos/base-okl4/src/core/platform_pd.cc
index 94831ceaf..113a741dd 100644
--- a/repos/base-okl4/src/core/platform_pd.cc
+++ b/repos/base-okl4/src/core/platform_pd.cc
@@ -29,9 +29,6 @@ namespace Okl4 { extern "C" {
using namespace Genode;
-static const bool verbose = false;
-
-
/****************************
** Private object members **
****************************/
@@ -61,8 +58,7 @@ void Platform_pd::_create_pd(bool syscall)
resources, &old_resources);
if (ret != 1)
- PERR("L4_SpaceControl(new) returned %d, error code=%d",
- ret, (int)L4_ErrorCode());
+ error("L4_SpaceControl(new) returned ", ret, ", error=", L4_ErrorCode());
}
@@ -87,8 +83,7 @@ void Platform_pd::_destroy_pd()
resources, &old_resources);
if (ret != 1)
- PERR("L4_SpaceControl(delete) returned %d, error code=%d",
- ret, (int)L4_ErrorCode());
+ error("L4_SpaceControl(delete) returned ", ret, ", error=", L4_ErrorCode());
}
@@ -166,7 +161,8 @@ int Platform_pd::_alloc_thread(int thread_id, Platform_thread *thread)
void Platform_pd::_free_thread(int thread_id)
{
if (!_threads[thread_id])
- PWRN("double-free of thread %x.%x detected", _pd_id, thread_id);
+ warning("double-free of thread ",
+ Hex(_pd_id), ".", Hex(thread_id), " detected");
_threads[thread_id] = 0;
}
@@ -186,7 +182,7 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
int t = _alloc_thread(thread_id, thread);
if (t < 0) {
- PERR("thread alloc failed");
+ error("thread alloc failed");
return false;
}
thread_id = t;
@@ -206,8 +202,6 @@ void Platform_pd::unbind_thread(Platform_thread *thread)
thread->unbind();
_free_thread(thread_id);
-
- if (verbose) _debug_log_threads();
}
@@ -232,23 +226,17 @@ void Platform_pd::space_pager(Platform_thread *thread)
resources, &old_resources);
if (ret != 1)
- PERR("L4_SpaceControl(new space_pager...) returned %d, error code=%d",
- ret, (int)L4_ErrorCode());
+ error("L4_SpaceControl(new space_pager...) returned ", ret, ", error=",
+ L4_ErrorCode());
/* grant the pager mapping rights regarding this space */
if(!L4_AllowUserMapping(pager_space, 0x0, 0xff000000))
- PERR("Failed to delegate pt access to %lx, error %lx",
- pager_space.raw, L4_ErrorCode());
+ error("failed to delegate pt access to ", Hex(pager_space.raw), ", "
+ "error=", L4_ErrorCode());
}
-void Platform_pd::_setup_address_space()
-{
- PERR("not yet implemented");
-}
-
-
-static const bool verbose_unmap = false;
+void Platform_pd::_setup_address_space() { }
static void unmap_log2_range(unsigned pd_id, addr_t base, size_t size_log2)
@@ -259,8 +247,8 @@ static void unmap_log2_range(unsigned pd_id, addr_t base, size_t size_log2)
L4_FpageAddRightsTo(&fpage, L4_FullyAccessible);
int ret = L4_UnmapFpage(L4_SpaceId(pd_id), fpage);
if (ret != 1)
- PERR("could not unmap page at %p from space %x (Error Code %ld)",
- (void *)base, pd_id, L4_ErrorCode());
+ error("could not unmap page at ", Hex(base), " from space ", Hex(pd_id), ", "
+ "error=", L4_ErrorCode());
}
@@ -271,9 +259,6 @@ void Platform_pd::flush(addr_t addr, size_t size)
L4_Word_t remaining_size = size;
L4_Word_t size_log2 = get_page_size_log2();
- if (verbose_unmap)
- printf("PD %d: unmap [%lx,%lx)\n", _pd_id, addr, addr + size);
-
/*
* Let unmap granularity ('size_log2') grow
*/
@@ -334,7 +319,7 @@ Platform_pd::Platform_pd(Allocator *, char const *label)
_pd_id = _alloc_pd();
if (_pd_id > PD_MAX)
- PERR("pd alloc failed");
+ error("pd alloc failed");
_create_pd(true);
}
@@ -352,18 +337,3 @@ Platform_pd::~Platform_pd()
_free_pd();
}
-
-/***********************
- ** Debugging support **
- ***********************/
-
-void Platform_pd::_debug_log_threads()
-{
- PWRN("_debug_log_threads disabled.");
-}
-
-
-void Platform_pd::_debug_log_pds()
-{
- PWRN("_debug_log_pds disabled.");
-}
diff --git a/repos/base-okl4/src/core/platform_thread.cc b/repos/base-okl4/src/core/platform_thread.cc
index a3168e01a..0802d5591 100644
--- a/repos/base-okl4/src/core/platform_thread.cc
+++ b/repos/base-okl4/src/core/platform_thread.cc
@@ -1,4 +1,3 @@
-
/*
* \brief OKL4 thread facility
* \author Julian Stecklina
@@ -15,7 +14,7 @@
*/
/* Genode includes */
-#include
+#include
#include
#include
@@ -43,7 +42,7 @@ using namespace Okl4;
int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
{
if (!_platform_pd) {
- PWRN("thread %d is not bound to a PD", _thread_id);
+ warning("thread ", _thread_id, " is not bound to a PD");
return -1;
}
@@ -89,8 +88,7 @@ int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
scheduler, pager, exception_handler,
resources, (void *)utcb_location);
if (ret != 1) {
- PERR("L4_ThreadControl returned %d, error code=%d",
- ret, (int)L4_ErrorCode());
+ error("L4_ThreadControl returned ", ret, ", error=", ret, L4_ErrorCode());
return -1;
}
@@ -111,7 +109,7 @@ int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
/* assign priority */
if (!L4_Set_Priority(new_thread_id,
Cpu_session::scale_priority(DEFAULT_PRIORITY, _priority)))
- PWRN("Could not set thread prioritry to default");
+ warning("could not set thread prioritry to default");
set_l4_thread_id(new_thread_id);
return 0;
@@ -145,7 +143,7 @@ void Platform_thread::unbind()
L4_nilthread, L4_nilthread, L4_nilthread, ~0, 0);
if (res != 1)
- PERR("Deleting thread 0x%08lx failed. Continuing...", _l4_thread_id.raw);
+ error("deleting thread ", Hex(_l4_thread_id.raw), " failed");
_thread_id = THREAD_INVALID;
_l4_thread_id = L4_nilthread;
diff --git a/repos/base-okl4/src/core/ram_session_support.cc b/repos/base-okl4/src/core/ram_session_support.cc
index 96270e3c1..9f8a084d6 100644
--- a/repos/base-okl4/src/core/ram_session_support.cc
+++ b/repos/base-okl4/src/core/ram_session_support.cc
@@ -39,15 +39,15 @@ void Ram_session_component::_clear_ds (Dataspace_component *ds)
/* allocate range in core's virtual address space */
void *virt_addr;
if (!platform()->region_alloc()->alloc(page_rounded_size, &virt_addr)) {
- PERR("could not allocate virtual address range in core of size %zd\n",
- page_rounded_size);
+ error("could not allocate virtual address range in core of size ",
+ page_rounded_size);
return;
}
/* map the dataspace's physical pages to corresponding virtual addresses */
size_t num_pages = page_rounded_size >> get_page_size_log2();
if (!map_local(ds->phys_addr(), (addr_t)virt_addr, num_pages)) {
- PERR("core-local memory mapping failed, Error Code=%d\n", (int)Okl4::L4_ErrorCode());
+ error("core-local memory mapping failed, error=", Okl4::L4_ErrorCode());
return;
}
@@ -58,8 +58,8 @@ void Ram_session_component::_clear_ds (Dataspace_component *ds)
/* unmap dataspace from core */
if (!unmap_local((addr_t)virt_addr, num_pages))
- PERR("could not unmap core-local address range at %p (Error Code %ld)",
- virt_addr, Okl4::L4_ErrorCode());
+ error("could not unmap core-local address range at ", virt_addr, ", "
+ "error=", Okl4::L4_ErrorCode());
/* free core's virtual address space */
platform()->region_alloc()->free(virt_addr, page_rounded_size);
diff --git a/repos/base-okl4/src/core/spec/x86/platform_thread_x86.cc b/repos/base-okl4/src/core/spec/x86/platform_thread_x86.cc
index fdcd6728b..0672ad100 100644
--- a/repos/base-okl4/src/core/spec/x86/platform_thread_x86.cc
+++ b/repos/base-okl4/src/core/spec/x86/platform_thread_x86.cc
@@ -58,7 +58,7 @@ Thread_state Platform_thread::state()
void Platform_thread::state(Thread_state)
{
- PDBG("Not implemented");
+ warning("Platform_thread::state not implemented");
throw Cpu_thread::State_access_failed();
}
diff --git a/repos/base-okl4/src/lib/base/ipc.cc b/repos/base-okl4/src/lib/base/ipc.cc
index ba192dd78..f91519e5e 100644
--- a/repos/base-okl4/src/lib/base/ipc.cc
+++ b/repos/base-okl4/src/lib/base/ipc.cc
@@ -12,7 +12,6 @@
*/
/* Genode includes */
-#include
#include
#include
#include
@@ -93,8 +92,9 @@ static L4_Word_t extract_msg_from_utcb(L4_MsgTag_t rcv_tag, Msgbuf_base &rcv_msg
unsigned const num_data_words = num_msg_words - data_start_idx;
if (num_data_words*sizeof(L4_Word_t) > rcv_msg.capacity()) {
- PERR("receive message buffer too small msg size=%zd, buf size=%zd",
- num_data_words*sizeof(L4_Word_t), rcv_msg.capacity());
+ error("receive message buffer too small,"
+ "msg size=", num_data_words*sizeof(L4_Word_t), ", "
+ "buf size=", rcv_msg.capacity());
return Rpc_exception_code::INVALID_OBJECT;
}
@@ -197,7 +197,7 @@ void Genode::ipc_reply(Native_capability caller, Rpc_exception_code exc,
L4_MsgTag_t rcv_tag = L4_Reply(Capability_space::ipc_cap_data(caller).dst);
if (L4_IpcFailed(rcv_tag))
- PERR("ipc error in _reply - gets ignored");
+ error("ipc error in ipc_reply - gets ignored");
}
diff --git a/repos/base-pistachio/src/core/cpu_session_platform.cc b/repos/base-pistachio/src/core/cpu_session_platform.cc
index d7e9b8d82..3c17975bb 100644
--- a/repos/base-pistachio/src/core/cpu_session_platform.cc
+++ b/repos/base-pistachio/src/core/cpu_session_platform.cc
@@ -15,12 +15,10 @@
#include
using namespace Genode;
-using namespace Pistachio;
Dataspace_capability Cpu_thread_component::utcb()
{
- PERR("%s: Not implemented", __PRETTY_FUNCTION__);
return Dataspace_capability();
}
diff --git a/repos/base-pistachio/src/core/include/platform_pd.h b/repos/base-pistachio/src/core/include/platform_pd.h
index 0a8e5a58f..1c13ff769 100644
--- a/repos/base-pistachio/src/core/include/platform_pd.h
+++ b/repos/base-pistachio/src/core/include/platform_pd.h
@@ -232,7 +232,7 @@ namespace Genode {
* On Pistachio, we don't use directed unmap but rely on the
* in-kernel mapping database. See 'region_map_support.cc'.
*/
- void flush(addr_t, size_t) { PDBG("not implemented"); }
+ void flush(addr_t, size_t) { warning(__func__, "not implemented"); }
};
}
diff --git a/repos/base-pistachio/src/core/include/print_l4_thread_id.h b/repos/base-pistachio/src/core/include/print_l4_thread_id.h
index 67595acb0..64dd84620 100644
--- a/repos/base-pistachio/src/core/include/print_l4_thread_id.h
+++ b/repos/base-pistachio/src/core/include/print_l4_thread_id.h
@@ -1,7 +1,7 @@
/*
- * \brief Pistachio-specific thread helper
- * \author Julian Stecklina
- * \date 2008-02-20
+ * \brief Pistachio-specific helper for printing thread IDs
+ * \author Norman Feske
+ * \date 2016-08-15
*/
/*
@@ -14,31 +14,50 @@
#ifndef _CORE__INCLUDE__PRINT_L4_THREAD_ID_H_
#define _CORE__INCLUDE__PRINT_L4_THREAD_ID_H_
-#include
+#include
namespace Pistachio {
#include
+}
- inline void print_l4_thread_id(L4_ThreadId_t t)
+namespace Genode { struct Formatted_tid; }
+
+
+struct Genode::Formatted_tid
+{
+ Pistachio::L4_ThreadId_t tid;
+
+ explicit Formatted_tid(Pistachio::L4_ThreadId_t tid) : tid(tid) { }
+
+ void print(Output &out) const
{
- if (L4_IsLocalId(t)) {
- Genode::printf("THREAD (local) %02lx (raw %08lx)\n",
- t.local.X.local_id, t.raw);
+ using namespace Pistachio;
+ using Genode::print;
- } else if (L4_IsGlobalId(t)) {
- Genode::printf("THREAD (global) %02lx (version %lx) (raw %08lx)\n",
- t.global.X.thread_no, t.global.X.version, t.raw);
+ if (L4_IsLocalId(tid)) {
+
+ unsigned char const local_id = tid.local.X.local_id;
+ print(out, "THREAD (local) ",
+ Hex(local_id, Hex::OMIT_PREFIX, Hex::PAD), " "
+ "(raw ", Hex(tid.raw, Hex::OMIT_PREFIX, Hex::PAD), ")");
+
+ } else if (L4_IsGlobalId(tid)) {
+ unsigned char const global_id = tid.global.X.thread_no;
+ print(out, "THREAD (global) ",
+ Hex(global_id, Hex::OMIT_PREFIX, Hex::PAD), " "
+ "(version ", Hex(tid.global.X.version, Hex::OMIT_PREFIX), ") ",
+ "(raw ", Hex(tid.raw, Hex::OMIT_PREFIX, Hex::PAD), ")");
} else {
const char *name;
- if (t == L4_nilthread) name = "nilthread";
- else if (t == L4_anythread) name = "anythread";
- else name = "???";
+ if (tid == L4_nilthread) name = "nilthread";
+ else if (tid == L4_anythread) name = "anythread";
+ else name = "???";
- Genode::printf("THREAD (%s)\n", name);
+ print(out, "THREAD (", name, ")");
}
}
-}
+};
#endif /* _CORE__INCLUDE__PRINT_L4_THREAD_ID_H_ */
diff --git a/repos/base-pistachio/src/core/include/util.h b/repos/base-pistachio/src/core/include/util.h
index e65c46adc..f8588d24f 100644
--- a/repos/base-pistachio/src/core/include/util.h
+++ b/repos/base-pistachio/src/core/include/util.h
@@ -16,7 +16,7 @@
/* Genode includes */
#include
-#include
+#include
#include
#include
@@ -25,6 +25,7 @@
/* core-local includes */
#include
+#include
/* Pistachio includes */
namespace Pistachio {
@@ -41,7 +42,7 @@ namespace Genode {
inline void panic(const char *s)
{
using namespace Pistachio;
- PDBG("Panic: %s", s);
+ raw("Panic: ", s);
L4_KDB_Enter("> panic <");
}
@@ -49,7 +50,7 @@ namespace Genode {
{
using namespace Pistachio;
if (!val) {
- PERR("Assertion failed: %s", s);
+ error("Assertion failed: ", s);
L4_KDB_Enter("Assertion failed.");
}
}
@@ -112,10 +113,10 @@ namespace Genode {
{
Pistachio::L4_ThreadId_t tid;
tid.raw = badge;
- printf("%s (%s pf_addr=%p pf_ip=%p from %02lx (raw %08lx))\n", msg,
- pf_type == Region_map::State::WRITE_FAULT ? "WRITE" : "READ",
- (void *)pf_addr, (void *)pf_ip,
- Pistachio::L4_GlobalId(tid).global.X.thread_no, tid.raw);
+ log(msg, " (",
+ pf_type == Region_map::State::WRITE_FAULT ? "WRITE" : "READ", " "
+ "pf_addr=", Hex(pf_addr), " pf_ip=", Hex(pf_ip), " "
+ "from ", Formatted_tid(tid), ")");
}
inline addr_t map_src_addr(addr_t core_local_addr, addr_t phys_addr) {
diff --git a/repos/base-pistachio/src/core/io_mem_session_support.cc b/repos/base-pistachio/src/core/io_mem_session_support.cc
index 3361cbd6d..f79f0259e 100644
--- a/repos/base-pistachio/src/core/io_mem_session_support.cc
+++ b/repos/base-pistachio/src/core/io_mem_session_support.cc
@@ -27,8 +27,6 @@ namespace Pistachio {
using namespace Genode;
-static const bool verbose = false;
-
/*
* TODO This should take a size parameter and check if the whole
@@ -52,12 +50,7 @@ bool is_conventional_memory(addr_t base)
}
-void Io_mem_session_component::_unmap_local(addr_t base, size_t size)
-{
- /* TODO .... */
- if (verbose)
- PDBG("not yet implemented!");
-}
+void Io_mem_session_component::_unmap_local(addr_t base, size_t size) { }
static inline bool can_use_super_page(addr_t base, size_t size) {
@@ -84,14 +77,11 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
/* find appropriate region for mapping */
void *result = 0;
if (platform()->region_alloc()->alloc_aligned(size, &result, alignment).error())
- PERR("alloc_aligned failed!");
+ error(__func__, ": alloc_aligned failed!");
local_base = (addr_t)result;
}
- if (verbose)
- PDBG("base = 0x%08lx, size = 0x%08zx -> local = 0x%lx", base, size, local_base);
-
unsigned offset = 0;
while (size) {
@@ -99,21 +89,17 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
if (can_use_super_page(base + offset, size))
page_size = get_super_page_size();
- L4_Fpage_t ret =
- L4_Sigma0_GetPage_RcvWindow(get_sigma0(),
- L4_Fpage(base + offset, page_size),
- L4_Fpage(local_base + offset, page_size));
+ L4_Sigma0_GetPage_RcvWindow(get_sigma0(),
+ L4_Fpage(base + offset, page_size),
+ L4_Fpage(local_base + offset, page_size));
if (_cacheable == WRITE_COMBINED) {
int res = L4_Set_PageAttribute(L4_Fpage(local_base + offset, page_size),
L4_WriteCombiningMemory);
if (res != 1)
- PERR("L4_Set_PageAttributes virt returned %d", res);
+ error(__func__, ": L4_Set_PageAttributes virt returned ", res);
}
- if (L4_IsNilFpage(ret) && verbose)
- PDBG("Got nil fpage for 0x%08lx from sigma0 (ignoring)", base + offset);
-
offset += page_size;
size -= page_size;
}
diff --git a/repos/base-pistachio/src/core/irq_session_component.cc b/repos/base-pistachio/src/core/irq_session_component.cc
index 7ff23c4ef..1b5767e29 100644
--- a/repos/base-pistachio/src/core/irq_session_component.cc
+++ b/repos/base-pistachio/src/core/irq_session_component.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* core includes */
@@ -54,7 +54,7 @@ void Irq_object::_wait_for_irq()
L4_MsgTag_t res = L4_Call(irq_thread);
if (L4_IpcFailed(res))
- PERR("ipc error while waiting for interrupt.");
+ error("ipc error while waiting for interrupt");
}
@@ -68,7 +68,7 @@ void Irq_object::start()
void Irq_object::entry()
{
if (!_associate()) {
- PERR("Could not associate with IRQ 0x%x", _irq);
+ error("could not associate with IRQ ", Hex(_irq));
return;
}
@@ -88,7 +88,7 @@ void Irq_object::entry()
L4_MsgTag_t res = L4_Receive(irq_thread);
if (L4_IpcFailed(res))
- PERR("ipc error while attaching to interrupt.");
+ error("ipc error while attaching to interrupt");
/*
* Now, the IRQ is masked. To receive the next IRQ we have to send
@@ -138,7 +138,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
throw Root::Unavailable();
if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).error()) {
- PERR("Unavailable IRQ 0x%x requested", _irq_number);
+ error("unavailable IRQ ", Hex(_irq_number), " requested");
throw Root::Unavailable();
}
@@ -151,7 +151,7 @@ Irq_session_component::~Irq_session_component()
L4_Word_t res = L4_DeassociateInterrupt(irqno_to_threadid(_irq_number));
if (res != 1)
- PERR("L4_DeassociateInterrupt failed");
+ error("L4_DeassociateInterrupt failed");
}
diff --git a/repos/base-pistachio/src/core/pager.cc b/repos/base-pistachio/src/core/pager.cc
index ec0a810cb..ecda0e99c 100644
--- a/repos/base-pistachio/src/core/pager.cc
+++ b/repos/base-pistachio/src/core/pager.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* base-internal includes */
@@ -72,11 +72,10 @@ void Ipc_pager::wait_for_fault()
result = L4_Wait(&sender);
failed = L4_IpcFailed(result);
if (failed)
- PERR("Page fault IPC error. (continuable)");
+ error("page fault IPC error (continuable)");
if (L4_UntypedWords(result) != 2) {
- PERR("Malformed page-fault ipc. (sender = 0x%08lx)",
- sender.raw);
+ error("malformed page-fault ipc (sender=", sender, ")");
failed = true;
}
@@ -110,13 +109,13 @@ void Ipc_pager::reply_and_wait_for_fault()
L4_MsgTag_t result = L4_ReplyWait(_last, &_last);
if (L4_IpcFailed(result)) {
- PERR("Page fault IPC error. (continuable)");
+ error("page fault IPC error (continuable)");
wait_for_fault();
return;
}
if (L4_UntypedWords(result) != 2) {
- PERR("Malformed page-fault ipc. (sender = 0x%08lx)", _last.raw);
+ error("malformed page-fault ipc. (sender=", _last, ")");
wait_for_fault();
return;
}
diff --git a/repos/base-pistachio/src/core/platform.cc b/repos/base-pistachio/src/core/platform.cc
index 23cab3cfb..9e4b258c4 100644
--- a/repos/base-pistachio/src/core/platform.cc
+++ b/repos/base-pistachio/src/core/platform.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
#include
#include
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
/* core includes */
#include
@@ -81,7 +82,8 @@ static bool wait_for_page_fault(Pistachio::L4_ThreadId_t &from,
enum { EXPECT = 2 };
if (L4_IpcFailed(res) || (L4_UntypedWords(res)) != EXPECT) {
- PERR("got %ld words, expected %d", L4_UntypedWords(res), EXPECT);
+ error(__func__, ": got ", L4_UntypedWords(res), " words, "
+ "expected ", (int)EXPECT);
return false;
}
L4_Store(res, &msg);
@@ -112,7 +114,8 @@ static bool reply_and_wait_for_page_fault(Pistachio::L4_ThreadId_t to,
enum { EXPECT = 2 };
if (L4_IpcFailed(res) || (L4_UntypedWords(res)) != EXPECT) {
- PERR("got %ld words, expected %d", L4_UntypedWords(res), EXPECT);
+ error(__func__, ": got ", L4_UntypedWords(res), " words, "
+ "expected ", (int)EXPECT);
return wait_for_page_fault(from, pf_addr, pf_ip, flags);
}
L4_Store(res, &msg);
@@ -130,8 +133,6 @@ static bool reply_and_wait_for_page_fault(Pistachio::L4_ThreadId_t to,
static void _core_pager_loop()
{
- if (verbose) PDBG("Core pager running.");
-
using namespace Pistachio;
L4_ThreadId_t t;
@@ -163,28 +164,26 @@ static void _core_pager_loop()
continue;
}
- PDBG("Got page fault (pf_addr = %08lx, pf_ip = %08lx, flags = %08lx).",
- pf_addr, pf_ip, flags);
- print_l4_thread_id(L4_GlobalId(t));
+ log(L4_GlobalId(t));
/* check for NULL pointer */
if (pf_addr < page_size) {
- PERR("possible null pointer %s at address %lx at EIP %lx in",
- write_fault(flags) ? "WRITE" : "READ/EXEC", pf_addr, pf_ip);
- print_l4_thread_id(t);
+ error("possible null pointer ",
+ write_fault(flags) ? "WRITE" : "READ/EXEC", " at "
+ "address ", Hex(pf_addr), " at EIP ", Hex(pf_ip), " in ", t);
+
/* do not unblock faulter */
break;
} else if (!_core_address_ranges().valid_addr(pf_addr)) {
/* page-fault address is not in RAM */
- PERR("%s access outside of RAM at %lx IP %lx",
- write_fault(flags) ? "WRITE" : "READ", pf_addr, pf_ip);
- print_l4_thread_id(t);
+ error(write_fault(flags) ? "WRITE" : "READ", " access outside of RAM "
+ "at ", Hex(pf_addr), " IP ", Hex(pf_ip), " by ", t);
+
/* do not unblock faulter */
break;
} else if (verbose_core_pf) {
- PDBG("pfa=%lx ip=%lx in", pf_addr, pf_ip);
- print_l4_thread_id(t);
+ log(__func__, ": pfa=", Hex(pf_addr), " ip=", Hex(pf_ip), " by ", t);
}
/* my pf handler is sigma0 - just touch the appropriate page */
@@ -263,31 +262,28 @@ struct Region
{
return (((base + size) > start) && (base < end));
}
+
+ void print(Genode::Output &out) const
+ {
+ size_t const size = end - start;
+ Genode::print(out, Hex_range(start, size), " ",
+ "size: ", Hex(size, Hex::PREFIX, Hex::PAD));
+ }
};
-/**
- * Log region
- */
-static inline void print_region(Region r)
-{
- printf("[%08lx,%08lx) %08lx", r.start, r.end, r.end - r.start);
-}
-
-
/**
* Add region to allocator
*/
static inline void add_region(Region r, Range_allocator &alloc)
{
if (r.start >= r.end) {
- PERR("(start = 0x%08lx, end = 0x%08lx)\n", r.start, r.end);
+ error(__func__, ": bad range ", r);
panic("add_region called with bogus parameters.");
}
- if (verbose_region_alloc) {
- printf("%p add: ", &alloc); print_region(r); printf("\n");
- }
+ if (verbose_region_alloc)
+ log(&alloc, " add: ", r);
/* adjust region */
addr_t start = trunc_page(r.start);
@@ -305,9 +301,8 @@ static inline void remove_region(Region r, Range_allocator &alloc)
if (r.start >= r.end)
panic("remove_region called with bogus parameters.");
- if (verbose_region_alloc) {
- printf("%p remove: ", &alloc); print_region(r); printf("\n");
- }
+ if (verbose_region_alloc)
+ log(&alloc, " remove: ", r);
/* adjust region */
addr_t start = trunc_page(r.start);
@@ -358,12 +353,10 @@ static void dump_kip_memdesc(Pistachio::L4_KernelInterfacePage_t *kip)
for (L4_Word_t i = 0; i < num_desc; i++) {
L4_MemoryDesc_t *d = L4_MemoryDesc(kip, i);
- printf("mem %ld: [0x%08lx, 0x%08lx) type=0x%lx (%s) %s\n",
- i,
- L4_Low(d),
- L4_High(d)+1,
- L4_Type(d), types[L4_Type(d) & 0xF],
- L4_IsVirtual(d) ? "Virtual" : "Non-Virtual");
+ log("mem ", i, ": ",
+ Hex_range(L4_Low(d), L4_High(d) - L4_Low(d) + 1), " "
+ "type=", Hex(L4_Type(d)), " (", types[L4_Type(d) & 0xf], ") ",
+ L4_IsVirtual(d) ? "Virtual" : "Non-Virtual");
}
}
@@ -417,7 +410,7 @@ void Platform::_setup_mem_alloc()
/* mask out that size bit */
page_size_mask &= ~size;
- printf("Trying to allocate %uK pages from sigma0.\n", size >> 10);
+ log("Trying to allocate ", size >> 10, "K pages from sigma0.");
/*
* Suck out sigma0. The spec says that we get only "conventional
@@ -455,7 +448,7 @@ void Platform::_setup_mem_alloc()
}
} while (succ);
- printf("Got %uK in %uK pieces.\n", bytes_got >> 10, size >> 10);
+ log("Got ", bytes_got >> 10, "K in ", size >> 10, "K pieces.");
}
}
@@ -498,11 +491,11 @@ void Platform::_setup_basics()
panic("we got something but not the KIP");
if (verbose) {
- printf("\n");
- printf("KIP @ %p\n", kip);
- printf(" magic: %08lx\n", kip->magic);
- printf(" version: %08lx\n", kip->ApiVersion.raw);
- printf(" BootInfo: %08lx\n", kip->BootInfo);
+ log("");
+ log("KIP @ ", kip);
+ log(" magic: ", Hex(kip->magic, Hex::PREFIX, Hex::PAD));
+ log(" version: ", Hex(kip->ApiVersion.raw, Hex::PREFIX, Hex::PAD));
+ log(" BootInfo: ", Hex(kip->BootInfo, Hex::PREFIX, Hex::PAD));
}
dump_kip_memdesc(kip);
@@ -530,7 +523,7 @@ void Platform::_setup_basics()
/* done magic */
- if (verbose) printf("MBI @ %p\n", mb_info_ptr);
+ if (verbose) log("MBI @ ", mb_info_ptr);
/* get UTCB memory */
Platform_pd::touch_utcb_space();
@@ -553,7 +546,7 @@ void Platform::_setup_basics()
if (!L4_IsVirtual(md)) continue;
if (_vm_start != 0x0 || _vm_size != 0x0) {
- PWRN("KIP has multiple virtual-memory descriptors. Taking only the first.");
+ warning("KIP has multiple virtual-memory descriptors. Taking only the first.");
break;
}
@@ -564,8 +557,9 @@ void Platform::_setup_basics()
_vm_start = max((L4_Word_t)0x1000, L4_MemoryDescLow(md));
_vm_size = L4_MemoryDescHigh(md) - _vm_start + 1;
- printf("KIP reports virtual memory region at [%lx,%lx)\n",
- L4_MemoryDescLow(md), L4_MemoryDescHigh(md));
+ log("KIP reports virtual memory region at ",
+ Hex_range(L4_MemoryDescLow(md),
+ L4_MemoryDescHigh(md) - L4_MemoryDescLow(md)));
}
/* configure core's virtual memory, exclude KIP, stack area */
@@ -611,9 +605,7 @@ void Platform::_setup_rom()
_rom_fs.insert(new_rom);
if (verbose)
- printf(" mod[%d] [%p,%p) %s\n", i,
- (void *)new_rom->addr(), ((char *)new_rom->addr()) + new_rom->size(),
- new_rom->name());
+ log(" mod[", i, "] ", *new_rom);
/* zero remainder of last ROM page */
size_t count = page_size - rom.size() % page_size;
@@ -651,6 +643,8 @@ Platform::Platform() :
if (initialized) panic("Platform constructed twice!");
initialized = true;
+ init_log();
+
_setup_basics();
_setup_preemption();
_setup_mem_alloc();
@@ -664,13 +658,13 @@ Platform::Platform() :
* hold the meta data for the ROM modules as initialized by '_setup_rom'.
*/
if (verbose) {
- printf(":ram_alloc: "); _ram_alloc()->dump_addr_tree();
- printf(":region_alloc: "); _region_alloc()->dump_addr_tree();
- printf(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
- printf(":io_port: "); _io_port_alloc()->dump_addr_tree();
- printf(":irq: "); _irq_alloc()->dump_addr_tree();
- printf(":rom_fs: "); _rom_fs.print_fs();
- printf(":core ranges: "); _core_address_ranges()()->dump_addr_tree();
+ log(":ram_alloc: "); _ram_alloc()->dump_addr_tree();
+ log(":region_alloc: "); _region_alloc()->dump_addr_tree();
+ log(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
+ log(":io_port: "); _io_port_alloc()->dump_addr_tree();
+ log(":irq: "); _irq_alloc()->dump_addr_tree();
+ log(":rom_fs: "); _rom_fs.print_fs();
+ log(":core ranges: "); _core_address_ranges()()->dump_addr_tree();
}
/*
diff --git a/repos/base-pistachio/src/core/platform_pd.cc b/repos/base-pistachio/src/core/platform_pd.cc
index 29541ce5c..f8901e19d 100644
--- a/repos/base-pistachio/src/core/platform_pd.cc
+++ b/repos/base-pistachio/src/core/platform_pd.cc
@@ -28,11 +28,6 @@ using namespace Pistachio;
using namespace Genode;
-static const bool verbose = false;
-
-#define PT_DBG(args...) if (verbose) { PDBG(args); } else { }
-
-
/**************************
** Static class members **
**************************/
@@ -47,8 +42,6 @@ L4_Word_t Platform_pd::_core_utcb_ptr = 0;
void Platform_pd::_create_pd(bool syscall)
{
if (syscall) {
- PT_DBG("_create_pd (_l4_task_id = 0x%08lx)",
- _l4_task_id.raw);
/* create place-holder thread representing the PD */
L4_ThreadId_t l4t = make_l4_id(_pd_id, 0, _version);
@@ -75,17 +68,13 @@ void Platform_pd::_destroy_pd()
{
using namespace Pistachio;
- PT_DBG("_destroy_pd (_l4_task_id = 0x%08lx)",
- _l4_task_id.raw);
-
- // Space Specifier == nilthread -> destroy
+ /* Space Specifier == nilthread -> destroy */
L4_Word_t res = L4_ThreadControl(_l4_task_id, L4_nilthread,
L4_nilthread, L4_nilthread,
(void *)-1);
- if (res != 1) {
- panic("Destroying protection domain failed.");
- }
+ if (res != 1)
+ panic("destroying protection domain failed");
_l4_task_id = L4_nilthread;
}
@@ -182,7 +171,7 @@ int Platform_pd::_alloc_thread(int thread_id, Platform_thread *thread)
void Platform_pd::_free_thread(int thread_id)
{
if (!_threads[thread_id])
- PWRN("double-free of thread %x.%x detected", _pd_id, thread_id);
+ warning("double-free of thread ", Hex(_pd_id), ".", Hex(thread_id), " detected");
_threads[thread_id] = 0;
}
@@ -202,7 +191,7 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
int t = _alloc_thread(thread_id, thread);
if (t < 0) {
- PERR("thread alloc failed");
+ error("thread alloc failed");
return false;
}
thread_id = t;
@@ -211,7 +200,6 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
/* finally inform thread about binding */
thread->bind(thread_id, l4_thread_id, this);
- if (verbose) _debug_log_threads();
return true;
}
@@ -225,27 +213,19 @@ void Platform_pd::unbind_thread(Platform_thread *thread)
_free_thread(thread_id);
- if (verbose) _debug_log_threads();
}
void Platform_pd::touch_utcb_space()
{
- L4_Word_t utcb_ptr;
-
L4_KernelInterfacePage_t *kip = get_kip();
L4_ThreadId_t mylocalid = L4_MyLocalId();
- utcb_ptr = *(L4_Word_t *) &mylocalid;
+ L4_Word_t utcb_ptr = *(L4_Word_t *) &mylocalid;
utcb_ptr &= ~(L4_UtcbAreaSize (kip) - 1);
/* store a pointer to core's utcb area */
_core_utcb_ptr = utcb_ptr;
- PT_DBG("Core's UTCB area is at 0x%08lx (0x%08lx)",
- utcb_ptr, L4_UtcbAreaSize(kip));
- PWRN("Core can have %lu threads.",
- L4_UtcbAreaSize(kip) / L4_UtcbSize(kip));
-
/*
* We used to touch the UTCB space here, but that was probably not
* neccessary.
@@ -275,36 +255,20 @@ void Platform_pd::_setup_address_space()
L4_KernelInterfacePage_t *kip = (L4_KernelInterfacePage_t *)get_kip();
L4_Fpage_t kip_space = L4_FpageLog2((L4_Word_t)kip, L4_KipAreaSizeLog2(kip));
- PT_DBG("kip_start = %08lx", L4_Address(kip_space));
-
- /* utcb space follows the kip, but must be aligned */
- L4_Word_t kip_end = L4_Address(kip_space) + L4_KipAreaSize(kip);
- PT_DBG("kip_end = %08lx", kip_end);
L4_Word_t utcb_start = _core_utcb_ptr;
-// L4_Word_t utcb_start = (L4_Word_t)(&_kip_utcb_area);
- PT_DBG("utcb_start = %08lx", utcb_start);
L4_Word_t utcb_size = L4_UtcbSize(kip) * THREAD_MAX;
- PT_DBG("utcb_size = %08lx", utcb_size);
- L4_Fpage_t utcb_space = L4_Fpage(utcb_start,
- // L4_Fpage truncates this.
- utcb_size + get_page_size() - 1 );
-
- PT_DBG("Creating address space for %08lx.", ss.raw);
+ L4_Fpage_t utcb_space = L4_Fpage(utcb_start, utcb_size + get_page_size() - 1);
L4_Word_t old_control;
- int res;
-
- res = L4_SpaceControl(ss, 0, kip_space, utcb_space, L4_anythread, &old_control);
+ int res = L4_SpaceControl(ss, 0, kip_space, utcb_space, L4_anythread, &old_control);
if (res != 1 ) {
- PERR("Error while setting up address space: %lu", L4_ErrorCode());
+ error("setting up address space failed, error ", L4_ErrorCode());
panic("L4_SpaceControl");
}
- PT_DBG("Address space for %08lx created!", ss.raw);
-
_kip_ptr = L4_Address(kip_space);
_utcb_ptr = L4_Address(utcb_space);
}
@@ -351,7 +315,8 @@ Platform_pd::Platform_pd(Allocator * md_alloc, char const *,
_pd_id = _alloc_pd(pd_id);
if (_pd_id < 0) {
- PERR("pd alloc failed");
+ error("pd alloc failed");
+ return;
}
_create_pd(create);
@@ -363,29 +328,9 @@ Platform_pd::~Platform_pd()
/* invalidate weak pointers to this object */
Address_space::lock_for_destruction();
- PT_DBG("Destroying all threads of pd %p", this);
-
/* unbind all threads */
while (Platform_thread *t = _next_thread()) unbind_thread(t);
- PT_DBG("Destroying pd %p", this);
-
_destroy_pd();
_free_pd();
}
-
-
-/***********************
- ** Debugging support **
- ***********************/
-
-void Platform_pd::_debug_log_threads()
-{
- PWRN("_debug_log_threads disabled.");
-}
-
-
-void Platform_pd::_debug_log_pds()
-{
- PWRN("_debug_log_pds disabled.");
-}
diff --git a/repos/base-pistachio/src/core/platform_thread.cc b/repos/base-pistachio/src/core/platform_thread.cc
index 084c4d462..105ae0ecf 100644
--- a/repos/base-pistachio/src/core/platform_thread.cc
+++ b/repos/base-pistachio/src/core/platform_thread.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* base-internal includes */
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
/* Pistachio includes */
namespace Pistachio
@@ -38,8 +39,6 @@ using namespace Pistachio;
static const bool verbose = false;
static const bool verbose2 = true;
-#define PT_DBG(args...) if (verbose) { PDBG(args); } else { }
-
void Platform_thread::affinity(Affinity::Location location)
{
@@ -48,13 +47,13 @@ void Platform_thread::affinity(Affinity::Location location)
unsigned const cpu_no = location.xpos();
if (cpu_no >= L4_NumProcessors(get_kip())) {
- PERR("Invalid processor number.");
+ error("invalid processor number");
return;
}
if (_l4_thread_id != L4_nilthread)
if (L4_Set_ProcessorNo(_l4_thread_id, cpu_no) == 0)
- PERR("Error setting processor number.");
+ error("could not set processor number");
}
@@ -74,31 +73,18 @@ int Platform_thread::start(void *ip, void *sp)
/* XXX should always be the root task */
L4_ThreadId_t preempter = L4_Myself();
- PT_DBG("Trying to Platform_thread::start the thread '%s'.", _name);
-
- if (verbose2)
- printf("thread '%s' has id 0x%08lx (task = 0x%x, thread = 0x%x)\n",
- _name, thread.raw, _platform_pd->pd_id(), _thread_id);
-
if (_thread_id == THREAD_INVALID) {
- PERR("Trying to start a thread with invalid ID.");
+ error("attempt to start a thread with invalid ID");
return -1;
}
L4_Word_t utcb_location = _platform_pd->_utcb_location(_thread_id);
- PT_DBG("New thread's utcb at %08lx.", utcb_location);
- PT_DBG("Attaching thread to address space 0x%08lx.",
- _platform_pd->_l4_task_id.raw);
-
- PT_DBG("sp = %p, ip = %p", sp, ip);
int ret = L4_ThreadControl(thread, _platform_pd->_l4_task_id,
preempter, L4_Myself(), (void *)utcb_location);
- PT_DBG("L4_ThreadControl() = %d", ret);
if (ret != 1) {
- PERR("Error code = 0x%08lx", L4_ErrorCode());
- PERR("L4_ThreadControl failed.");
+ error(__func__, ": L4_ThreadControl returned ", Hex(L4_ErrorCode()));
return -2;
}
@@ -107,8 +93,8 @@ int Platform_thread::start(void *ip, void *sp)
L4_nilthread, pager, (void *)-1);
if (ret != 1) {
- PERR("Error code = 0x%08lx", L4_ErrorCode());
- PERR("Setting pager failed.");
+ error(__func__, ": L4_ThreadControl returned ", Hex(L4_ErrorCode()));
+ error("setting pager failed");
return -3;
}
@@ -118,7 +104,7 @@ int Platform_thread::start(void *ip, void *sp)
/* assign priority */
if (!L4_Set_Priority(thread,
Cpu_session::scale_priority(DEFAULT_PRIORITY, _priority)))
- PWRN("Could not set thread prioritry to default");
+ warning("could not set thread prioritry to default");
/* send start message */
L4_Msg_t msg;
@@ -130,25 +116,23 @@ int Platform_thread::start(void *ip, void *sp)
L4_MsgTag_t tag = L4_Send(thread);
if (L4_IpcFailed(tag)) {
- PERR("Starting thread failed. (IPC error)");
+ error("starting thread failed. (IPC error)");
return -4;
}
- PT_DBG("Done starting thread.");
-
return 0;
}
void Platform_thread::pause()
{
- PDBG("not implemented");
+ warning(__func__, " not implemented");
}
void Platform_thread::resume()
{
- PDBG("not implemented");
+ warning(__func__, " not implemented");
}
@@ -163,13 +147,11 @@ void Platform_thread::bind(int thread_id, L4_ThreadId_t l4_thread_id,
void Platform_thread::unbind()
{
- PT_DBG("Killing thread 0x%08lx.", _l4_thread_id.raw);
-
L4_Word_t res = L4_ThreadControl(_l4_thread_id, L4_nilthread,
L4_nilthread, L4_nilthread, (void *)-1);
if (res != 1)
- PERR("Deleting thread 0x%08lx failed. Continuing...", _l4_thread_id.raw);
+ error("deleting thread ", Formatted_tid(_l4_thread_id), " failed");
_thread_id = THREAD_INVALID;
_l4_thread_id = L4_nilthread;
@@ -179,7 +161,7 @@ void Platform_thread::unbind()
void Platform_thread::state(Thread_state)
{
- PDBG("Not implemented");
+ warning(__func__, " not implemented");
throw Cpu_thread::State_access_failed();
}
diff --git a/repos/base-sel4/include/sel4/assert.h b/repos/base-sel4/include/sel4/assert.h
index 696bb19bb..d44546d7a 100644
--- a/repos/base-sel4/include/sel4/assert.h
+++ b/repos/base-sel4/include/sel4/assert.h
@@ -15,11 +15,11 @@
#define _INCLUDE__SEL4__ASSERT_H_
/* Genode includes */
-#include
+#include
#define seL4_Assert(v) do { \
if (!(v)) { \
- PDBG("assertion failed: %s", #v); \
+ Genode::error("assertion failed: ", #v); \
for (;;); \
} } while (0);
diff --git a/repos/base-sel4/src/core/core_region_map.cc b/repos/base-sel4/src/core/core_region_map.cc
index 6401add1c..5e3797612 100644
--- a/repos/base-sel4/src/core/core_region_map.cc
+++ b/repos/base-sel4/src/core/core_region_map.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
/* core includes */
#include
@@ -38,20 +38,20 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
size_t page_rounded_size = (size + get_page_size() - 1) & get_page_mask();
if (use_local_addr) {
- PERR("Parameter 'use_local_addr' not supported within core");
+ error(__func__, ": 'use_local_addr' not supported within core");
return nullptr;
}
if (offset) {
- PERR("Parameter 'offset' not supported within core");
+ error(__func__, ": 'offset' not supported within core");
return nullptr;
}
/* allocate range in core's virtual address space */
void *virt_addr;
if (!platform()->region_alloc()->alloc(page_rounded_size, &virt_addr)) {
- PERR("Could not allocate virtual address range in core of size %zd\n",
- page_rounded_size);
+ error("could not allocate virtual address range in core of size ",
+ page_rounded_size);
return nullptr;
}
diff --git a/repos/base-sel4/src/core/include/initial_untyped_pool.h b/repos/base-sel4/src/core/include/initial_untyped_pool.h
index 229a623de..51779d9cb 100644
--- a/repos/base-sel4/src/core/include/initial_untyped_pool.h
+++ b/repos/base-sel4/src/core/include/initial_untyped_pool.h
@@ -16,7 +16,7 @@
/* Genode includes */
#include
-#include
+#include
/* core-local includes */
#include
@@ -219,8 +219,8 @@ class Genode::Initial_untyped_pool
num_objects);
if (ret != 0) {
- PERR("%s: seL4_Untyped_Retype (untyped) returned %d",
- __FUNCTION__, ret);
+ error(__func__, ": seL4_Untyped_Retype (untyped) "
+ "returned ", ret);
return;
}
}
diff --git a/repos/base-sel4/src/core/include/kernel_object.h b/repos/base-sel4/src/core/include/kernel_object.h
index b69daa755..54c96b97b 100644
--- a/repos/base-sel4/src/core/include/kernel_object.h
+++ b/repos/base-sel4/src/core/include/kernel_object.h
@@ -129,8 +129,8 @@ namespace Genode {
num_objects);
if (ret != 0) {
- PERR("seL4_Untyped_RetypeAtOffset (%s) returned %d",
- KOBJ::name(), ret);
+ error("seL4_Untyped_RetypeAtOffset (", KOBJ::name(), ") "
+ "returned ", ret);
throw Retype_untyped_failed();
}
@@ -183,8 +183,7 @@ namespace Genode {
num_objects);
if (ret != 0) {
- PERR("seL4_Untyped_Retype (%s) returned %d",
- KOBJ::name(), ret);
+ error("seL4_Untyped_Retype (", KOBJ::name(), ") returned ", ret);
throw Retype_untyped_failed();
}
}
diff --git a/repos/base-sel4/src/core/include/page_table_registry.h b/repos/base-sel4/src/core/include/page_table_registry.h
index 828ae252a..b6e51feaf 100644
--- a/repos/base-sel4/src/core/include/page_table_registry.h
+++ b/repos/base-sel4/src/core/include/page_table_registry.h
@@ -53,8 +53,6 @@ class Genode::Page_table_registry
addr_t const addr;
- static constexpr bool verbose = false;
-
private:
List _entries;
@@ -93,7 +91,7 @@ class Genode::Page_table_registry
void insert_entry(Allocator &entry_alloc, addr_t addr, unsigned sel)
{
if (_entry_exists(addr)) {
- PWRN("trying to insert page frame for 0x%lx twice", addr);
+ warning("trying to insert page frame for ", Hex(addr), " twice");
return;
}
@@ -110,10 +108,7 @@ class Genode::Page_table_registry
Entry &entry = lookup(addr);
_entries.remove(&entry);
destroy(entry_alloc, &entry);
- } catch (Lookup_failed) {
- if (verbose)
- PWRN("trying to remove non-existing page frame for 0x%lx", addr);
- }
+ } catch (Lookup_failed) { }
}
void flush_all(Allocator &entry_alloc)
@@ -156,7 +151,7 @@ class Genode::Page_table_registry
*out_addr = nullptr;
if (size > sizeof(Elem_space)) {
- PERR("unexpected allocation size of %zd", size);
+ error("unexpected allocation size of ", size);
return false;
}
@@ -205,12 +200,10 @@ class Genode::Page_table_registry
if (_page_table_base(pt->addr) == _page_table_base(addr))
return *pt;
}
- PDBG("page-table lookup failed");
+ warning(__func__, ": page-table lookup failed");
throw Lookup_failed();
}
- static constexpr bool verbose = false;
-
public:
/**
@@ -240,7 +233,7 @@ class Genode::Page_table_registry
/* XXX sel is unused */
if (_page_table_exists(addr)) {
- PWRN("trying to insert page table for 0x%lx twice", addr);
+ warning("attempt to insert page table for ", Hex(addr), " twice");
return;
}
@@ -273,10 +266,7 @@ class Genode::Page_table_registry
try {
Page_table &page_table = _lookup(addr);
page_table.remove_entry(_page_table_entry_alloc, addr);
- } catch (...) {
- if (verbose)
- PDBG("no PT entry found for virtual address 0x%lx", addr);
- }
+ } catch (...) { }
}
@@ -302,10 +292,7 @@ class Genode::Page_table_registry
Page_table::Entry &entry = page_table.lookup(addr);
fn(entry.sel);
- } catch (...) {
- if (verbose)
- PDBG("no PT entry found for virtual address 0x%lx", addr);
- }
+ } catch (...) { }
}
template
diff --git a/repos/base-sel4/src/core/pager.cc b/repos/base-sel4/src/core/pager.cc
index 67f87d43c..d9aea8e90 100644
--- a/repos/base-sel4/src/core/pager.cc
+++ b/repos/base-sel4/src/core/pager.cc
@@ -26,8 +26,6 @@
using namespace Genode;
-static bool const verbose = false;
-
struct Fault_info
{
@@ -40,10 +38,7 @@ struct Fault_info
ip(seL4_GetMR(0)),
pf(seL4_GetMR(1)),
write(seL4_Fault_isWriteFault(seL4_GetMR(3)))
- {
- if (verbose)
- PINF("PF: ip=0x%lx, pf=0x%lx, write=%d", ip, pf, write);
- }
+ { }
};
diff --git a/repos/base-sel4/src/core/platform.cc b/repos/base-sel4/src/core/platform.cc
index c61d4d085..a38ebf160 100644
--- a/repos/base-sel4/src/core/platform.cc
+++ b/repos/base-sel4/src/core/platform.cc
@@ -184,10 +184,9 @@ void Platform::_init_allocators()
if (verbose_boot_info) {
log("core image:");
- log(" virtual address range [",
- Hex(core_virt_beg, Hex::OMIT_PREFIX, Hex::PAD), ",",
- Hex(core_virt_end, Hex::OMIT_PREFIX, Hex::PAD), ") size=",
- Hex(core_size));
+ log(" virtual address range ",
+ Hex_range(core_virt_beg, core_virt_end - core_virt_beg), " "
+ "size=", Hex(core_size));
}
/* preserve sel4 boot info page in core's virtual address space */
@@ -391,7 +390,7 @@ void Platform::_init_rom_modules()
_phys_cnode.copy(initial_cspace, Cnode_index(module_frame_sel + i),
Cnode_index(dst_frame + i));
- PLOG("boot module '%s' (%zd bytes)", header->name, header->size);
+ log("boot module '", header->name, "' (", header->size, " bytes)");
/*
* Register ROM module, the base address refers to location of the
@@ -452,8 +451,7 @@ Platform::Platform()
/*
* Log statistics about allocator initialization
*/
- log("VM area at [", Hex(_vm_base, Hex::OMIT_PREFIX, Hex::PAD), ",",
- Hex(_vm_base + _vm_size, Hex::OMIT_PREFIX, Hex::PAD), ")");
+ log("VM area at ", Hex_range(_vm_base, _vm_size));
if (verbose_boot_info) {
log(":phys_alloc: "); (*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
diff --git a/repos/base-sel4/src/core/platform_thread.cc b/repos/base-sel4/src/core/platform_thread.cc
index 7b1f8aecf..b05ab7997 100644
--- a/repos/base-sel4/src/core/platform_thread.cc
+++ b/repos/base-sel4/src/core/platform_thread.cc
@@ -89,8 +89,8 @@ static void prepopulate_ipc_buffer(addr_t ipc_buffer_phys, Cap_sel ep_sel,
/* allocate range in core's virtual address space */
void *virt_addr;
if (!platform()->region_alloc()->alloc(page_rounded_size, &virt_addr)) {
- PERR("could not allocate virtual address range in core of size %zd\n",
- page_rounded_size);
+ error("could not allocate virtual address range in core of size ",
+ page_rounded_size);
return;
}
diff --git a/repos/base-sel4/src/core/stack_area.cc b/repos/base-sel4/src/core/stack_area.cc
index bd4c45a85..b1598b00b 100644
--- a/repos/base-sel4/src/core/stack_area.cc
+++ b/repos/base-sel4/src/core/stack_area.cc
@@ -15,7 +15,7 @@
/* Genode includes */
#include
#include
-#include
+#include
#include
#include
@@ -52,8 +52,6 @@ class Stack_area_region_map : public Region_map
Ds_slab _ds_slab { platform()->core_mem_alloc() };
- enum { verbose = false };
-
public:
/**
@@ -75,21 +73,17 @@ class Stack_area_region_map : public Region_map
Dataspace_component *ds = new (&_ds_slab)
Dataspace_component(size, 0, phys, CACHED, true, 0);
if (!ds) {
- PERR("dataspace for core stack does not exist");
+ error(__func__, ": dataspace for core stack does not exist");
return (addr_t)0;
}
addr_t const core_local_addr =
stack_area_virtual_base() + (addr_t)local_addr;
- if (verbose)
- PDBG("core_local_addr = %lx, phys_addr = %lx, size = 0x%zx",
- core_local_addr, ds->phys_addr(), ds->size());
-
if (!map_local(ds->phys_addr(), core_local_addr,
ds->size() >> get_page_size_log2())) {
- PERR("could not map phys %lx at local %lx",
- ds->phys_addr(), core_local_addr);
+ error(__func__, ": could not map phys ", Hex(ds->phys_addr()), " "
+ "at local ", Hex(core_local_addr));
return (addr_t)0;
}
@@ -134,7 +128,7 @@ class Stack_area_ram_session : public Ram_session
return reinterpret_cap_cast(Native_capability()); }
void free(Ram_dataspace_capability ds) {
- PWRN("Not implemented!"); }
+ warning(__func__, " not implemented"); }
int ref_account(Ram_session_capability ram_session) { return 0; }
diff --git a/repos/base-sel4/src/core/thread_start.cc b/repos/base-sel4/src/core/thread_start.cc
index ef2e50562..1c5de2a8d 100644
--- a/repos/base-sel4/src/core/thread_start.cc
+++ b/repos/base-sel4/src/core/thread_start.cc
@@ -13,7 +13,7 @@
/* Genode includes */
#include
-#include
+#include
#include
/* base-internal includes */
@@ -41,8 +41,9 @@ void Thread::_init_platform_thread(size_t, Type type)
thread_info.init(utcb_virt_addr);
if (!map_local(thread_info.ipc_buffer_phys, utcb_virt_addr, 1)) {
- PERR("could not map IPC buffer phys %lx at local %lx",
- thread_info.ipc_buffer_phys, utcb_virt_addr);
+ error(__func__, ": could not map IPC buffer "
+ "phys=", Hex(thread_info.ipc_buffer_phys), " "
+ "local=%", Hex(utcb_virt_addr));
}
native_thread().tcb_sel = thread_info.tcb_sel.value();
@@ -103,6 +104,6 @@ void Thread::start()
void Thread::cancel_blocking()
{
- PWRN("not implemented");
+ warning(__func__, " not implemented");
}
diff --git a/repos/base-sel4/src/include/base/internal/assert.h b/repos/base-sel4/src/include/base/internal/assert.h
index fe0700f17..674b03d49 100644
--- a/repos/base-sel4/src/include/base/internal/assert.h
+++ b/repos/base-sel4/src/include/base/internal/assert.h
@@ -27,7 +27,7 @@
do { if (!(e)) { \
char line_buf[32]; \
Genode::snprintf(line_buf, sizeof(line_buf), "%d", __LINE__); \
- kernel_debugger_outstring(ESC_ERR "Assertion failed: " #e ESC_END "\n"); \
+ kernel_debugger_outstring("Assertion failed: " #e "\n"); \
kernel_debugger_outstring(__FILE__ ":"); \
kernel_debugger_outstring(line_buf); \
kernel_debugger_panic("\n"); \
diff --git a/repos/base/include/base/allocator_avl.h b/repos/base/include/base/allocator_avl.h
index c31644ac3..3ce5c9dad 100644
--- a/repos/base/include/base/allocator_avl.h
+++ b/repos/base/include/base/allocator_avl.h
@@ -16,7 +16,6 @@
#include
#include
-#include
#include
#include
diff --git a/repos/base/include/base/allocator_guard.h b/repos/base/include/base/allocator_guard.h
index b236b889f..5bf524e64 100644
--- a/repos/base/include/base/allocator_guard.h
+++ b/repos/base/include/base/allocator_guard.h
@@ -15,7 +15,7 @@
#define _INCLUDE__BASE__ALLOCATOR_GUARD_H_
#include
-#include
+#include
#include
namespace Genode { class Allocator_guard; }
@@ -71,11 +71,12 @@ class Genode::Allocator_guard : public Allocator
bool alloc(size_t size, void **out_addr) override
{
if ((_amount - _consumed) < (size + _allocator->overhead(size))) {
- PWRN("Quota exceeded! amount=%zu, size=%zu, consumed=%zu",
- _amount, (size + _allocator->overhead(size)), _consumed);
+ warning("Quota exceeded! amount=", _amount,
+ ", size=", (size + _allocator->overhead(size)),
+ ", consumed=", _consumed);
return false;
}
- bool b = _allocator->alloc(size, out_addr);
+ bool const b = _allocator->alloc(size, out_addr);
if (b)
_consumed += size + _allocator->overhead(size);
return b;
diff --git a/repos/base/include/base/child.h b/repos/base/include/base/child.h
index c4c69dbc5..ba1399a05 100644
--- a/repos/base/include/base/child.h
+++ b/repos/base/include/base/child.h
@@ -101,7 +101,7 @@ struct Genode::Child_policy
*/
virtual void exit(int exit_value)
{
- PDBG("child \"%s\" exited with exit value %d", name(), exit_value);
+ log("child \"", name(), "\" exited with exit value ", exit_value);
}
/**
diff --git a/repos/base/include/base/ipc.h b/repos/base/include/base/ipc.h
index 0757b48c7..798933fb6 100644
--- a/repos/base/include/base/ipc.h
+++ b/repos/base/include/base/ipc.h
@@ -16,7 +16,7 @@
#include
#include
-#include
+#include
namespace Genode {
@@ -97,7 +97,7 @@ class Genode::Ipc_unmarshaller : Noncopyable
* condition triggers.
*/
if (_read_offset + size > _rcv_buf_size) {
- PERR("message buffer overrun");
+ error("message buffer overrun");
return;
}
diff --git a/repos/base/include/base/output.h b/repos/base/include/base/output.h
index 1a8469fb0..9214321c0 100644
--- a/repos/base/include/base/output.h
+++ b/repos/base/include/base/output.h
@@ -61,6 +61,15 @@ namespace Genode {
*/
void print(Output &output, char const *);
+ /**
+ * Disallow printing non-const character buffers
+ *
+ * For 'char *' types, it is unclear whether the argument should be printed
+ * as a pointer or a string. The call must resolve this ambiguity by either
+ * casting the argument to 'void *' or wrapping it in a 'Cstring' object.
+ */
+ void print(Output &, char *) = delete;
+
/**
* Print pointer value
*/
@@ -137,36 +146,39 @@ namespace Genode {
* wrapped into an 'Hex' object, thereby selecting the corresponding
* overloaded 'print' function below.
*/
- struct Hex
+ class Hex
{
- enum Prefix { PREFIX, OMIT_PREFIX };
- enum Pad { PAD, NO_PAD };
+ public:
- unsigned long const value;
- size_t const digits;
- Prefix const prefix;
- Pad const pad;
+ enum Prefix { PREFIX, OMIT_PREFIX };
+ enum Pad { PAD, NO_PAD };
- /**
- * Constructor
- *
- * \param prefix by default, the value is prepended with the prefix
- * '0x'. The prefix can be suppressed by specifying
- * 'OMIT_PREFIX' as argument.
- * \param pad by default, leading zeros are stripped from the
- * output. If set to 'PAD', the leading zeros will be
- * printed.
- */
- template
- explicit Hex(T value, Prefix prefix = PREFIX, Pad pad = NO_PAD)
- : value(value), digits(2*sizeof(T)), prefix(prefix), pad(pad) { }
+ private:
+
+ unsigned long long const _value;
+ size_t const _digits;
+ Prefix const _prefix;
+ Pad const _pad;
+
+ public:
+
+ /**
+ * Constructor
+ *
+ * \param prefix by default, the value is prepended with the prefix
+ * '0x'. The prefix can be suppressed by specifying
+ * 'OMIT_PREFIX' as argument.
+ * \param pad by default, leading zeros are stripped from the
+ * output. If set to 'PAD', the leading zeros will be
+ * printed.
+ */
+ template
+ explicit Hex(T value, Prefix prefix = PREFIX, Pad pad = NO_PAD)
+ : _value(value), _digits(2*sizeof(T)), _prefix(prefix), _pad(pad) { }
+
+ void print(Output &output) const;
};
- /**
- * Print hexadecimal number
- */
- void print(Output &output, Hex const &);
-
/**
* Print range as hexadecimal format
*
diff --git a/repos/base/include/base/rpc_server.h b/repos/base/include/base/rpc_server.h
index e827e58e1..1a29d94f4 100644
--- a/repos/base/include/base/rpc_server.h
+++ b/repos/base/include/base/rpc_server.h
@@ -19,7 +19,7 @@
#include
#include
#include
-#include
+#include
#include
#include
@@ -161,7 +161,7 @@ class Genode::Rpc_dispatcher : public RPC_INTERFACE
Ipc_unmarshaller &, Msgbuf_base &,
Meta::Overload_selector)
{
- PERR("invalid opcode %ld\n", opcode.value);
+ error("invalid opcode ", opcode.value);
return Rpc_exception_code(Rpc_exception_code::INVALID_OPCODE);
}
diff --git a/repos/base/include/base/service.h b/repos/base/include/base/service.h
index 91001eff5..0bc4ec2fc 100644
--- a/repos/base/include/base/service.h
+++ b/repos/base/include/base/service.h
@@ -15,7 +15,7 @@
#define _INCLUDE__BASE__SERVICE_H_
#include
-#include
+#include
#include
#include
#include
@@ -223,7 +223,7 @@ class Genode::Parent_service : public Service
{
try { return env()->parent()->session(name(), args, affinity); }
catch (Parent::Unavailable) {
- PWRN("parent has no service \"%s\"", name());
+ warning("parent has no service \"", name(), "\"");
throw Unavailable();
}
catch (Parent::Quota_exceeded) { throw Quota_exceeded(); }
@@ -395,14 +395,13 @@ class Genode::Service_registry
* Lets sleep a night over it.
*/
if (!service) {
- printf("%s: service %s not yet available - sleeping\n",
- client_name, name);
+ log(client_name, ": service ", name, " not yet available - sleeping");
try {
client->sleep();
- printf("%s: service %s got available\n", client_name, name);
+ log(client_name, ": service ", name, " got available");
} catch (Blocking_canceled) {
- printf("%s: cancel waiting for service\n", client_name);
+ log(client_name, ": cancel waiting for service");
break;
}
}
diff --git a/repos/base/include/base/session_label.h b/repos/base/include/base/session_label.h
index 9256da78e..3972091f7 100644
--- a/repos/base/include/base/session_label.h
+++ b/repos/base/include/base/session_label.h
@@ -46,7 +46,7 @@ struct Genode::Session_label : String<160>
if (!strcmp(_separator(), full + i, _separator_len()))
return full + i + _separator_len();
- return Session_label(full);
+ return Session_label(Cstring(full));
}
/**
@@ -66,7 +66,7 @@ struct Genode::Session_label : String<160>
break;
/* construct new label with only the prefix part */
- return Session_label(full, prefix_len);
+ return Session_label(Cstring(full, prefix_len));
}
};
@@ -81,7 +81,7 @@ namespace Genode {
char buf[Session_label::capacity()];
Arg_string::find_arg(args, "label").string(buf, sizeof(buf), "");
- return Session_label(buf);
+ return Session_label(Cstring(buf));
}
/**
@@ -100,7 +100,7 @@ namespace Genode {
char buf[Session_label::capacity()];
snprintf(buf, sizeof(buf), "%s -> %s", prefix.string(), label.string());
- return Session_label(buf);
+ return Session_label(Cstring(buf));
}
}
diff --git a/repos/base/include/base/weak_ptr.h b/repos/base/include/base/weak_ptr.h
index fd09df361..30b6c3bd7 100644
--- a/repos/base/include/base/weak_ptr.h
+++ b/repos/base/include/base/weak_ptr.h
@@ -15,7 +15,7 @@
#define _INCLUDE__BASE__WEAK_PTR_H_
#include
-#include
+#include
#include
namespace Genode {
@@ -140,8 +140,8 @@ class Genode::Weak_object_base
~Weak_object_base()
{
if (_list.first())
- PERR("Weak object %p not destructed properly "
- "there are still dangling pointers to it", this);
+ error("Weak object ", this, " not destructed properly "
+ "there are still dangling pointers to it");
}
void disassociate(Weak_ptr_base *ptr)
diff --git a/repos/base/include/irq_session/irq_session.h b/repos/base/include/irq_session/irq_session.h
index 21c2cd113..37d84183e 100644
--- a/repos/base/include/irq_session/irq_session.h
+++ b/repos/base/include/irq_session/irq_session.h
@@ -86,4 +86,26 @@ struct Genode::Irq_session : Session
GENODE_RPC_INTERFACE(Rpc_ack_irq, Rpc_sigh, Rpc_info);
};
+
+namespace Genode {
+
+ static inline void print(Output &out, Irq_session::Trigger value)
+ {
+ switch (value) {
+ case Irq_session::TRIGGER_UNCHANGED: print(out, "UNCHANGED"); break;
+ case Irq_session::TRIGGER_LEVEL: print(out, "LEVEL"); break;
+ case Irq_session::TRIGGER_EDGE: print(out, "EDGE"); break;
+ }
+ }
+
+ static inline void print(Output &out, Irq_session::Polarity value)
+ {
+ switch (value) {
+ case Irq_session::POLARITY_UNCHANGED: print(out, "UNCHANGED"); break;
+ case Irq_session::POLARITY_HIGH: print(out, "HIGH"); break;
+ case Irq_session::POLARITY_LOW: print(out, "LOW"); break;
+ }
+ }
+}
+
#endif /* _INCLUDE__IRQ_SESSION__IRQ_SESSION_H_ */
diff --git a/repos/base/include/root/component.h b/repos/base/include/root/component.h
index 810344486..39c89cfd4 100644
--- a/repos/base/include/root/component.h
+++ b/repos/base/include/root/component.h
@@ -18,12 +18,11 @@
#define _INCLUDE__ROOT__COMPONENT_H_
#include
+#include
#include
-#include
#include
-#include
#include
-#include
+#include
namespace Genode {
@@ -228,8 +227,8 @@ class Genode::Root_component : public Rpc_object >,
size_t needed = sizeof(SESSION_TYPE) + md_alloc()->overhead(sizeof(SESSION_TYPE));
if (needed > ram_quota) {
- PERR("Insufficient ram quota, provided=%zu, required=%zu",
- ram_quota, needed);
+ error("Insufficient ram quota, provided=", ram_quota,
+ ", required=", needed);
throw Root::Quota_exceeded();
}
diff --git a/repos/base/include/util/construct_at.h b/repos/base/include/util/construct_at.h
index b0fb48f73..1cf5b0d47 100644
--- a/repos/base/include/util/construct_at.h
+++ b/repos/base/include/util/construct_at.h
@@ -15,7 +15,7 @@
#define _INCLUDE__UTIL__CONSTRUCT_AT_H_
#include
-#include
+#include
namespace Genode {
@@ -68,7 +68,7 @@ static inline T * Genode::construct_at(void *at, ARGS &&... args)
*/
void operator delete (void *)
{
- PERR("cxx: Placeable::operator delete (void *) not supported.");
+ error("cxx: Placeable::operator delete (void *) not supported.");
}
};
diff --git a/repos/base/include/util/fifo.h b/repos/base/include/util/fifo.h
index 7cd227a61..cb60176fd 100644
--- a/repos/base/include/util/fifo.h
+++ b/repos/base/include/util/fifo.h
@@ -14,8 +14,6 @@
#ifndef _INCLUDE__UTIL__FIFO_H_
#define _INCLUDE__UTIL__FIFO_H_
-#include
-
namespace Genode {
template class Fifo;
diff --git a/repos/base/include/util/string.h b/repos/base/include/util/string.h
index f8aa266ad..9d84c3b7a 100644
--- a/repos/base/include/util/string.h
+++ b/repos/base/include/util/string.h
@@ -23,6 +23,7 @@
namespace Genode {
class Number_of_bytes;
+ class Cstring;
template class String;
}
@@ -499,41 +500,150 @@ namespace Genode {
}
+/**
+ * Helper for the formatted output of a length-constrained character buffer
+ */
+class Genode::Cstring
+{
+ private:
+
+ char const * const _str;
+ size_t const _len;
+
+ static size_t _init_len(char const *str, size_t max_len)
+ {
+ /*
+ * In contrast to 'strlen' we stop searching for a terminating
+ * null once we reach 'max_len'.
+ */
+ size_t res = 0;
+ for (; str && *str && res < max_len; str++, res++);
+ return res;
+ }
+
+ public:
+
+ /**
+ * Constructor
+ *
+ * \param str null-terminated character buffer
+ */
+ Cstring(char const *str) : _str(str), _len(strlen(str)) { }
+
+ /**
+ * Constructor
+ *
+ * \param str character buffer, not neccessarily null-terminated
+ * \param max_len maximum number of characters to consume
+ *
+ * The 'Cstring' contains all characters up to a terminating null in
+ * the 'str' buffer but not more that 'max_len' characters.
+ */
+ Cstring(char const *str, size_t max_len)
+ :
+ _str(str), _len(_init_len(str, max_len))
+ { }
+
+ void print(Output &out) const { out.out_string(_str, _len); }
+};
+
+
/**
* Buffer that contains a null-terminated string
*
- * \param CAPACITY buffer size including the terminating zero
+ * \param CAPACITY buffer size including the terminating zero,
+ * must be higher than zero
*/
template
class Genode::String
{
private:
- char _buf[CAPACITY];
- size_t _length;
+ char _buf[CAPACITY];
+
+ /**
+ * Number of chars contained in '_buf' including the terminating null
+ */
+ size_t _len;
+
+ /**
+ * Output facility that targets a character buffer
+ */
+ struct Local_output : Output
+ {
+ char * const _buf;
+
+ size_t _num_chars = 0;
+
+ /**
+ * Return true if '_buf' can fit at least one additional 'char'.
+ */
+ bool _capacity_left() const { return CAPACITY - _num_chars - 1; }
+
+ void _append(char c) { _buf[_num_chars++] = c; }
+
+ Local_output(char *buf) : _buf(buf) { }
+
+ size_t num_chars() const { return _num_chars; }
+
+ void out_char(char c) override { if (_capacity_left()) _append(c); }
+
+ void out_string(char const *str, size_t n) override
+ {
+ while (n-- > 0 && _capacity_left())
+ _append(*str++);
+ }
+ };
+
+ template
+ void _init(T &&... args)
+ {
+ /* initialize string content */
+ Local_output output(_buf);
+ Genode::print(output, args...);
+
+ /* add terminating null */
+ _buf[output.num_chars()] = 0;
+ _len = output.num_chars() + 1;
+ }
public:
constexpr static size_t size() { return CAPACITY; }
- String() : _length(0) { }
+ String() : _len(0) { }
- String(char const *str, size_t len = ~0UL - 1)
- :
- _length(min(len + 1, min(strlen(str) + 1, CAPACITY)))
+ /**
+ * Constructor
+ *
+ * If the textual representation of the supplied arguments exceeds
+ * 'CAPACITY', the resulting string gets truncated. The caller may
+ * check for this condition by evaluating the 'length' of the
+ * constructed 'String'. If 'length' equals 'CAPACITY', the string
+ * may fit perfectly into the buffer or may have been truncated.
+ * In general, it would be safe to assume the latter.
+ */
+ template
+ String(T const &arg) { _init(arg); }
+
+ /**
+ * Copy constructor
+ */
+ template
+ String(String const &other) : _len(min(other._len, CAPACITY))
{
- strncpy(_buf, str, _length);
+ Genode::strncpy(_buf, other._buf, _len);
}
/**
* Return length of string, including the terminating null character
*/
- size_t length() const { return _length; }
+ size_t length() const { return _len; }
static constexpr size_t capacity() { return CAPACITY; }
bool valid() const {
- return (_length <= CAPACITY) && (_length != 0) && (_buf[_length - 1] == '\0'); }
+ return (_len <= CAPACITY) && (_len != 0) && (_buf[_len - 1] == '\0'); }
char const *string() const { return valid() ? _buf : ""; }
diff --git a/repos/base/include/util/touch.h b/repos/base/include/util/touch.h
index fdc5a45bb..831bc7a43 100644
--- a/repos/base/include/util/touch.h
+++ b/repos/base/include/util/touch.h
@@ -14,8 +14,6 @@
#ifndef _INCLUDE__UTIL__TOUCH_H_
#define _INCLUDE__UTIL__TOUCH_H_
-#include
-
namespace Genode {
/** Touch one byte at address read only */
diff --git a/repos/base/include/util/volatile_object.h b/repos/base/include/util/volatile_object.h
index e0018fd8f..16f2142a3 100644
--- a/repos/base/include/util/volatile_object.h
+++ b/repos/base/include/util/volatile_object.h
@@ -15,7 +15,6 @@
#define _INCLUDE__UTIL__VOLATILE_OBJECT_H_
#include
-#include
#include
namespace Genode {
@@ -61,11 +60,8 @@ class Genode::Volatile_object
void _check_constructed() const
{
- if (!_constructed) {
- PDBG("Deref_unconstructed_object");
- PDBG("bt: %p", __builtin_return_address(0));
+ if (!_constructed)
throw Deref_unconstructed_object();
- }
}
protected:
diff --git a/repos/base/include/util/xml_node.h b/repos/base/include/util/xml_node.h
index 2c39496ba..c8b619345 100644
--- a/repos/base/include/util/xml_node.h
+++ b/repos/base/include/util/xml_node.h
@@ -105,7 +105,7 @@ class Genode::Xml_attribute
typedef String<64> Name;
Name name() const {
- return Name(_name.start(), _name.len()); }
+ return Name(Cstring(_name.start(), _name.len())); }
/**
* Return true if attribute has specified type
@@ -171,7 +171,7 @@ class Genode::Xml_attribute
{
char buf[N];
value(buf, sizeof(buf));
- *out = String(buf);
+ *out = String(Cstring(buf));
}
/**
@@ -599,7 +599,7 @@ class Genode::Xml_node
Type type() const
{
Token name = _start_tag.name();
- return Type(name.start(), name.len());
+ return Type(Cstring(name.start(), name.len()));
}
/**
@@ -705,7 +705,7 @@ class Genode::Xml_node
char buf[STRING::capacity() + 1];
size_t const len = decoded_content(buf, sizeof(buf));
buf[min(len, STRING::capacity())] = 0;
- return STRING(buf);
+ return STRING(Cstring(buf));
}
/**
diff --git a/repos/base/src/core/core_mem_alloc.cc b/repos/base/src/core/core_mem_alloc.cc
index 1fbc5a15b..570f2352b 100644
--- a/repos/base/src/core/core_mem_alloc.cc
+++ b/repos/base/src/core/core_mem_alloc.cc
@@ -13,7 +13,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* local includes */
@@ -21,8 +21,6 @@
using namespace Genode;
-static const bool verbose_core_mem_alloc = false;
-
void * Mapped_avl_allocator::map_addr(void * addr)
{
@@ -46,8 +44,8 @@ Mapped_mem_allocator::alloc_aligned(size_t size, void **out_addr, int align, add
Alloc_return ret1 = _phys_alloc->alloc_aligned(page_rounded_size,
&phys_addr, align, from, to);
if (!ret1.ok()) {
- PERR("Could not allocate physical memory region of size %zu\n",
- page_rounded_size);
+ error("Could not allocate physical memory region of size ",
+ page_rounded_size);
return ret1;
}
@@ -55,7 +53,7 @@ Mapped_mem_allocator::alloc_aligned(size_t size, void **out_addr, int align, add
Alloc_return ret2 = _virt_alloc->alloc_aligned(page_rounded_size,
out_addr, align);
if (!ret2.ok()) {
- PERR("Could not allocate virtual address range in core of size %zu\n",
+ error("Could not allocate virtual address range in core of size ",
page_rounded_size);
/* revert physical allocation */
@@ -63,10 +61,6 @@ Mapped_mem_allocator::alloc_aligned(size_t size, void **out_addr, int align, add
return ret2;
}
- if (verbose_core_mem_alloc)
- printf("added core memory block of %zu bytes at virt=%p phys=%p\n",
- page_rounded_size, *out_addr, phys_addr);
-
_phys_alloc->metadata(phys_addr, { *out_addr });
_virt_alloc->metadata(*out_addr, { phys_addr });
@@ -91,5 +85,5 @@ void Mapped_mem_allocator::free(void *addr, size_t size)
void Mapped_mem_allocator::free(void *addr)
{
- PWRN("Not implemented!");
+ warning(__func__, "not implemented!");
}
diff --git a/repos/base/src/core/cpu_session_component.cc b/repos/base/src/core/cpu_session_component.cc
index 5b2fa29ae..823d3159d 100644
--- a/repos/base/src/core/cpu_session_component.cc
+++ b/repos/base/src/core/cpu_session_component.cc
@@ -14,7 +14,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* core includes */
@@ -25,8 +25,6 @@
using namespace Genode;
-static constexpr bool verbose = false;
-
Thread_capability Cpu_session_component::create_thread(Capability pd_cap,
Name const &name,
@@ -39,13 +37,11 @@ Thread_capability Cpu_session_component::create_thread(Capability pd
Cpu_thread_component *thread = 0;
if (weight.value == 0) {
- PWRN("Thread %s: Bad weight 0, using %i instead.",
- name.string(), Weight::DEFAULT_WEIGHT);
+ warning("Thread ", name, ": Bad weight 0, using default weight instead.");
weight = Weight();
}
if (weight.value > QUOTA_LIMIT) {
- PWRN("Thread %s: Oversized weight %zu, using %i instead.",
- name.string(), weight.value, QUOTA_LIMIT);
+ warning("Thread ", name, ": Oversized weight ", weight.value, ", using limit instead.");
weight = Weight(QUOTA_LIMIT);
}
@@ -57,7 +53,7 @@ Thread_capability Cpu_session_component::create_thread(Capability pd
*/
auto create_thread_lambda = [&] (Pd_session_component *pd) {
if (!pd) {
- PERR("create_thread: invalid PD argument");
+ error("create_thread: invalid PD argument");
throw Thread_creation_failed();
}
Lock::Guard slab_lock_guard(_thread_alloc_lock);
@@ -179,21 +175,20 @@ int Cpu_session_component::transfer_quota(Cpu_session_capability dst_cap,
/* lookup targeted CPU session */
auto lambda = [&] (Cpu_session_component *dst) {
if (!dst) {
- PWRN("Transfer CPU quota, %s, targeted session not found",
- _label.string());
+ warning("Transfer CPU quota, ", _label, ", targeted session not found");
return -1;
}
/* check reference relationship */
if (dst->_ref != this && dst != _ref) {
- PWRN("Transfer CPU quota, %s -> %s, no reference relation",
- _label.string(), dst->_label.string());
+ warning("Transfer CPU quota, ", _label, " -> ", dst->_label, ", "
+ "no reference relation");
return -2;
}
/* check quota availability */
size_t const quota = quota_lim_downscale(_quota, amount);
if (quota > _quota) {
- PWRN("Transfer CPU quota, %s -> %s, insufficient quota %zu, need %zu",
- _label.string(), dst->_label.string(), _quota, quota);
+ warning("Transfer CPU quota, ", _label, " -> ", dst->_label, ", "
+ "insufficient quota ", _quota, ", need ", quota);
return -3;
}
/* transfer quota */
@@ -212,20 +207,17 @@ int Cpu_session_component::ref_account(Cpu_session_capability ref_cap)
* FIXME Add check for cycles along the tree of reference accounts
*/
if (_ref) {
- PWRN("Set ref account, %s, set already",
- _label.string());
+ warning("set ref account, ", _label, ", set already");
return -2; }
/* lookup and check targeted CPU-session */
auto lambda = [&] (Cpu_session_component *ref) {
if (!ref) {
- PWRN("Set ref account, %s, targeted session not found",
- _label.string());
+ warning("set ref account, ", _label, ", targeted session not found");
return -1;
}
if (ref == this) {
- PWRN("Set ref account, %s, self reference not allowed",
- _label.string());
+ warning("set ref account, ", _label, ", self reference not allowed");
return -3;
}
/* establish ref-account relation from targeted CPU-session to us */
diff --git a/repos/base/src/core/cpu_session_support.cc b/repos/base/src/core/cpu_session_support.cc
index 41debdeb6..be7585e9b 100644
--- a/repos/base/src/core/cpu_session_support.cc
+++ b/repos/base/src/core/cpu_session_support.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
/* core includes */
#include
@@ -22,7 +22,7 @@ using namespace Genode;
Dataspace_capability Cpu_thread_component::utcb()
{
- PERR("%s: Not implemented", __PRETTY_FUNCTION__);
+ error(__PRETTY_FUNCTION__, ": not implemented");
return Dataspace_capability();
}
diff --git a/repos/base/src/core/include/assertion.h b/repos/base/src/core/include/assertion.h
index 159a454a7..291b90fae 100644
--- a/repos/base/src/core/include/assertion.h
+++ b/repos/base/src/core/include/assertion.h
@@ -15,10 +15,11 @@
#define _CORE__INCLUDE__ASSERTION_H_
/* Genode includes */
-#include
+#include
#define ASSERT_NEVER_CALLED \
- PERR("Unexpected call of '%s' (%s:%u)", __FUNCTION__, __FILE__, __LINE__); \
+ Genode::error("Unexpected call of '", __FUNCTION__, "' " \
+ "(", __FILE__, ":", __LINE__, ")"); \
for (;;); throw 0UL;
#endif /* _CORE__INCLUDE__ASSERTION_H_ */
diff --git a/repos/base/src/core/include/core_env.h b/repos/base/src/core/include/core_env.h
index 286278711..6fc7075ec 100644
--- a/repos/base/src/core/include/core_env.h
+++ b/repos/base/src/core/include/core_env.h
@@ -183,19 +183,19 @@ namespace Genode {
Cpu_session *cpu_session() override
{
- PWRN("%s:%u not implemented", __FILE__, __LINE__);
+ warning(__func__, " not implemented");
return 0;
}
Cpu_session_capability cpu_session_cap() override
{
- PWRN("%s:%u not implemented", __FILE__, __LINE__);
+ warning(__func__, " not implemented");
return Cpu_session_capability();
}
Pd_session_capability pd_session_cap() override
{
- PWRN("%s:%u not implemented", __FILE__, __LINE__);
+ warning(__func__, " not implemented");
return Pd_session_capability();
}
diff --git a/repos/base/src/core/include/core_parent.h b/repos/base/src/core/include/core_parent.h
index 33dfd9ec1..c0239a846 100644
--- a/repos/base/src/core/include/core_parent.h
+++ b/repos/base/src/core/include/core_parent.h
@@ -15,7 +15,6 @@
#ifndef _CORE__INCLUDE__CORE_PARENT_H_
#define _CORE__INCLUDE__CORE_PARENT_H_
-#include
#include
namespace Genode { struct Core_parent; }
diff --git a/repos/base/src/core/include/core_pd_session.h b/repos/base/src/core/include/core_pd_session.h
index a70719993..5044c0e95 100644
--- a/repos/base/src/core/include/core_pd_session.h
+++ b/repos/base/src/core/include/core_pd_session.h
@@ -85,7 +85,7 @@ class Genode::Core_pd_session_component : public Rpc_object
{
_signal_source_ep.apply(cap, [&] (Signal_context_component *context) {
if (!context) {
- PDBG("invalid signal-context capability");
+ warning("invalid signal-context capability");
return;
}
diff --git a/repos/base/src/core/include/dataspace_component.h b/repos/base/src/core/include/dataspace_component.h
index 1027a7ec1..c66d7673d 100644
--- a/repos/base/src/core/include/dataspace_component.h
+++ b/repos/base/src/core/include/dataspace_component.h
@@ -16,7 +16,6 @@
#define _CORE__INCLUDE__DATASPACE_COMPONENT_H_
/* Genode includes */
-#include
#include
#include
#include
diff --git a/repos/base/src/core/include/log_session_component.h b/repos/base/src/core/include/log_session_component.h
index 3f6d0d64a..20eac1c9b 100644
--- a/repos/base/src/core/include/log_session_component.h
+++ b/repos/base/src/core/include/log_session_component.h
@@ -16,6 +16,7 @@
#include
#include
+#include
#include
#include
@@ -47,7 +48,7 @@ namespace Genode {
size_t write(String const &string_buf)
{
if (!(string_buf.valid_string())) {
- PERR("corrupted string");
+ error("corrupted string");
return 0;
}
@@ -77,14 +78,14 @@ namespace Genode {
if (string[i] == '\n') {
memcpy(buf, string + from_i, i - from_i);
buf[i - from_i] = 0;
- printf("[%s] %s\n", _label, buf);
+ log("[", Cstring(_label), "] ", Cstring(buf));
from_i = i + 1;
}
}
/* if last character of string was not a line break, add one */
if (from_i < len)
- printf("[%s] %s\n", _label, string + from_i);
+ log("[", Cstring(_label), "] ", Cstring(string + from_i));
return len;
}
diff --git a/repos/base/src/core/include/rm_session_component.h b/repos/base/src/core/include/rm_session_component.h
index df16fe97a..b78a67221 100644
--- a/repos/base/src/core/include/rm_session_component.h
+++ b/repos/base/src/core/include/rm_session_component.h
@@ -92,7 +92,7 @@ class Genode::Rm_session_component : public Rpc_object
_ep.apply(rm, [&] (Region_map_component *rmc) {
if (!rmc) {
- PWRN("could not look up region map to destruct");
+ warning("could not look up region map to destruct");
return;
}
diff --git a/repos/base/src/core/include/rom_fs.h b/repos/base/src/core/include/rom_fs.h
index dadba7222..8fca9890c 100644
--- a/repos/base/src/core/include/rom_fs.h
+++ b/repos/base/src/core/include/rom_fs.h
@@ -15,7 +15,7 @@
#define _CORE__INCLUDE__ROM_FS_H_
#include
-#include
+#include
#include
#include
@@ -62,6 +62,11 @@ namespace Genode {
/** Accessor functions */
addr_t addr() const { return _addr; }
size_t size() const { return _size; }
+
+ void print(Output &out) const
+ {
+ Genode::print(out, Hex_range(_addr, _size), " ", name());
+ }
};
class Rom_fs : public Avl_tree
@@ -79,17 +84,17 @@ namespace Genode {
if (!r) {
Rom_module *first_module = (Rom_module *)first();
if (first_module) {
- printf("Rom_fs %p dump:\n", this);
+ log("ROM modules:");
print_fs(first_module);
} else {
- printf("No modules in Rom_fs %p\n", this);
+ log("No modules in Rom_fs ", this);
}
} else {
+
+ log(" ROM: ", Hex_range(r->addr(), r->size()), " ",
+ r->name());
+
Rom_module *child;
-
- printf(" Rom: [%08lx,%08lx) %s\n",
- r->addr(), r->addr() + r->size(), r->name());
-
if ((child = (Rom_module *)r->child(Rom_module::LEFT))) print_fs(child);
if ((child = (Rom_module *)r->child(Rom_module::RIGHT))) print_fs(child);
}
diff --git a/repos/base/src/core/include/signal_broker.h b/repos/base/src/core/include/signal_broker.h
index d401bd830..cb0548f11 100644
--- a/repos/base/src/core/include/signal_broker.h
+++ b/repos/base/src/core/include/signal_broker.h
@@ -80,7 +80,7 @@ class Genode::Signal_broker
_context_ep.apply(context_cap, [&] (Signal_context_component *c) {
context = c;
if (!context) {
- PWRN("specified signal-context capability has wrong type");
+ warning("specified signal-context capability has wrong type");
return;
}
@@ -98,7 +98,7 @@ class Genode::Signal_broker
* suppress this warning in release mode (SPECS +=
* release).
*/
- PDBG("invalid signal-context capability");
+ warning("invalid signal-context capability");
return;
}
diff --git a/repos/base/src/core/include/trace/control_area.h b/repos/base/src/core/include/trace/control_area.h
index 4d6b048e4..2a19f24fa 100644
--- a/repos/base/src/core/include/trace/control_area.h
+++ b/repos/base/src/core/include/trace/control_area.h
@@ -79,7 +79,7 @@ class Genode::Trace::Control_area
return true;
}
- PERR("trace-control allocaton failed");
+ error("trace-control allocaton failed");
return false;
}
diff --git a/repos/base/src/core/io_mem_session_component.cc b/repos/base/src/core/io_mem_session_component.cc
index 4a76776df..27b74dae1 100644
--- a/repos/base/src/core/io_mem_session_component.cc
+++ b/repos/base/src/core/io_mem_session_component.cc
@@ -22,9 +22,6 @@
using namespace Genode;
-static const bool verbose = false;
-
-
Io_mem_session_component::Dataspace_attr
Io_mem_session_component::_prepare_io_mem(const char *args,
Range_allocator *ram_alloc)
@@ -46,18 +43,19 @@ Io_mem_session_component::_prepare_io_mem(const char *args,
/* check for RAM collision */
int ret;
if ((ret = ram_alloc->remove_range(base, size))) {
- PERR("I/O memory [%lx,%lx) used by RAM allocator (%d)", base, base + size, ret);
+ error("I/O memory ", Hex_range(base, size), " "
+ "used by RAM allocator (", ret, ")");
return Dataspace_attr();
}
/* allocate region */
switch (_io_mem_alloc->alloc_addr(req_size, req_base).value) {
case Range_allocator::Alloc_return::RANGE_CONFLICT:
- PERR("I/O memory [%lx,%lx) not available", req_base, req_base + req_size);
+ error("I/O memory ", Hex_range(req_base, req_size), " not available");
return Dataspace_attr();
case Range_allocator::Alloc_return::OUT_OF_METADATA:
- PERR("I/O memory allocator ran out of meta data");
+ error("I/O memory allocator ran out of meta data");
return Dataspace_attr();
case Range_allocator::Alloc_return::OK: break;
@@ -66,11 +64,6 @@ Io_mem_session_component::_prepare_io_mem(const char *args,
/* request local mapping */
addr_t local_addr = _map_local(base, size);
- if (verbose)
- PDBG("I/O mem [%lx,%lx) => [%lx,%lx)%s",
- base, base + size, local_addr, local_addr + size,
- (_cacheable == WRITE_COMBINED) ? " (write-combined)" : "");
-
return Dataspace_attr(size, local_addr, base, _cacheable, req_base);
}
@@ -85,7 +78,7 @@ Io_mem_session_component::Io_mem_session_component(Range_allocator *io_mem_alloc
_ds_ep(ds_ep)
{
if (!_ds.valid()) {
- PERR("Local MMIO mapping failed!");
+ error("Local MMIO mapping failed!");
_ds_cap = Io_mem_dataspace_capability();
throw Root::Invalid_args();
@@ -97,9 +90,6 @@ Io_mem_session_component::Io_mem_session_component(Range_allocator *io_mem_alloc
Io_mem_session_component::~Io_mem_session_component()
{
- if (verbose)
- PDBG("I/O mem free [%lx,%lx)", _ds.phys_addr(), _ds.phys_addr() + _ds.size());
-
/* dissolve IO_MEM dataspace from service entry point */
_ds_ep->dissolve(&_ds);
diff --git a/repos/base/src/core/main.cc b/repos/base/src/core/main.cc
index 835358aa5..840ece989 100644
--- a/repos/base/src/core/main.cc
+++ b/repos/base/src/core/main.cc
@@ -94,7 +94,7 @@ Session_capability Core_parent::session(Parent::Service_name const &name,
if (service)
return service->session(args.string(), affinity);
- PWRN("service_name=\"%s\" arg=\"%s\" not handled", name.string(), args.string());
+ warning("service_name=\"", name.string(), "\" args=\"", args.string(), "\" not handled");
return Session_capability();
}
@@ -233,8 +233,6 @@ int main()
log("Genode ", Genode::version_string);
- PDBG("--- create local services ---");
-
static Trace::Policy_registry trace_policies;
/*
@@ -291,15 +289,13 @@ int main()
/* make platform-specific services known to service pool */
platform_add_local_services(e, &sliced_heap, &local_services);
- PDBG("--- start init ---");
-
/* obtain ROM session with init binary */
Rom_session_capability init_rom_session_cap;
try {
static Rom_connection rom("init");
init_rom_session_cap = rom.cap(); }
catch (...) {
- PERR("ROM module \"init\" not present"); }
+ error("ROM module \"init\" not present"); }
/* create ram session for init and transfer some of our own quota */
Ram_session_capability init_ram_session_cap
@@ -320,7 +316,7 @@ int main()
core's heap and not accounted by the component's meta data allocator */
Genode::size_t init_quota = platform()->ram_alloc()->avail() - 224*1024;
env()->ram_session()->transfer_quota(init_ram_session_cap, init_quota);
- PDBG("transferred %zu MB to init", init_quota / (1024*1024));
+ log("", init_quota / (1024*1024), " MiB RAM assigned to init");
Pd_connection init_pd("init");
Core_child *init = new (env()->heap())
@@ -328,16 +324,12 @@ int main()
init_pd, init_ram_session_cap, init_cpu.cap(),
local_services);
- PDBG("--- init created, waiting for exit condition ---");
platform()->wait_for_exit();
- PDBG("--- destroying init ---");
destroy(env()->heap(), init);
rom_root.close(init_rom_session_cap);
ram_root.close(init_ram_session_cap);
- PDBG("--- core main says good bye ---");
-
return 0;
}
diff --git a/repos/base/src/core/pager_object.cc b/repos/base/src/core/pager_object.cc
index ce8678f87..6e082c181 100644
--- a/repos/base/src/core/pager_object.cc
+++ b/repos/base/src/core/pager_object.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
/* core includes */
#include
@@ -22,7 +22,7 @@ using namespace Genode;
void Pager_object::wake_up()
{
- PWRN("user-level page fault handling is not supported on this platform");
+ warning("user-level page fault handling is not supported on this platform");
}
diff --git a/repos/base/src/core/pd_session_component.cc b/repos/base/src/core/pd_session_component.cc
index f982027a8..217262926 100644
--- a/repos/base/src/core/pd_session_component.cc
+++ b/repos/base/src/core/pd_session_component.cc
@@ -12,9 +12,6 @@
* under the terms of the GNU General Public License version 2.
*/
-/* Genode includes */
-#include
-
/* core-local includes */
#include
#include
diff --git a/repos/base/src/core/ram_session_component.cc b/repos/base/src/core/ram_session_component.cc
index 884c5bbff..70a5e27c7 100644
--- a/repos/base/src/core/ram_session_component.cc
+++ b/repos/base/src/core/ram_session_component.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* core includes */
@@ -21,9 +21,6 @@
using namespace Genode;
-static const bool verbose = false;
-
-
addr_t Ram_session_component::phys_addr(Ram_dataspace_capability ds)
{
auto lambda = [] (Dataspace_component *dsc) {
@@ -80,8 +77,8 @@ int Ram_session_component::_transfer_quota(Ram_session_component *dst, size_t am
/* decrease quota limit of this session - check against used quota */
if (_quota_limit < amount + _payload) {
- PWRN("Insufficient quota for transfer: %s", _label);
- PWRN(" have %zu, need %zu", _quota_limit - _payload, amount);
+ warning("Insufficient quota for transfer: ", Cstring(_label));
+ warning(" have ", _quota_limit - _payload, ", need ", amount);
return -3;
}
@@ -131,19 +128,8 @@ Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, Cache_attr
* meta data of the dataspace to be created - therefore, we add
* the slab block size here.
*/
- if (used_quota() + SBS + ds_size > _quota_limit) {
-
- if (verbose) {
- PWRN("Quota exceeded: %s", _label);
- PWRN(" memory for slab: %zu", _ds_slab.consumed());
- PWRN(" used quota: %zu", used_quota());
- PWRN(" ds_size: %zu", ds_size);
- PWRN(" sizeof(Ram_session_component): %zu", sizeof(Ram_session_component));
- PWRN(" quota_limit: %zu", _quota_limit);
- }
-
+ if (used_quota() + SBS + ds_size > _quota_limit)
throw Quota_exceeded();
- }
/*
* Allocate physical backing store
@@ -170,7 +156,7 @@ Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, Cache_attr
* fragmentation could cause a failing allocation.
*/
if (!alloc_succeeded) {
- PERR("We ran out of physical memory while allocating %zu bytes", ds_size);
+ error("out of physical memory while allocating ", ds_size, " bytes");
throw Quota_exceeded();
}
@@ -184,7 +170,7 @@ Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, Cache_attr
ds = new (&_ds_slab)
Dataspace_component(ds_size, (addr_t)ds_addr, cached, true, this);
} catch (Allocator::Out_of_memory) {
- PWRN("Could not allocate metadata");
+ warning("Could not allocate metadata");
/* cleanup unneeded resources */
_ram_alloc->free(ds_addr);
@@ -195,7 +181,7 @@ Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, Cache_attr
try {
_export_ram_ds(ds);
} catch (Out_of_metadata) {
- PWRN("could not export RAM dataspace of size 0x%zx", ds->size());
+ warning("could not export RAM dataspace of size ", ds->size());
/* cleanup unneeded resources */
destroy(&_ds_slab, ds);
_ram_alloc->free(ds_addr);
@@ -210,10 +196,6 @@ Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, Cache_attr
*/
_clear_ds(ds);
- if (verbose)
- PDBG("ds_size=%zu, used_quota=%zu quota_limit=%zu",
- ds_size, used_quota(), _quota_limit);
-
Dataspace_capability result = _ds_ep->manage(ds);
Lock::Guard lock_guard(_ref_members_lock);
@@ -254,9 +236,6 @@ int Ram_session_component::ref_account(Ram_session_capability ram_session_cap)
int Ram_session_component::transfer_quota(Ram_session_capability ram_session_cap,
size_t amount)
{
- if (verbose)
- PDBG("amount=%zu", amount);
-
auto lambda = [&] (Ram_session_component *dst) {
return _transfer_quota(dst, amount); };
return _ram_session_ep->apply(ram_session_cap, lambda);
@@ -294,7 +273,7 @@ Ram_session_component::~Ram_session_component()
_free_ds(ds->cap()));
if (_payload != 0)
- PWRN("Remaining payload of %zu in ram session to destroy", _payload);
+ warning("Remaining payload of ", _payload, " in ram session to destroy");
if (!_ref_account) return;
diff --git a/repos/base/src/core/region_map_component.cc b/repos/base/src/core/region_map_component.cc
index 593320f14..fecf1e33c 100644
--- a/repos/base/src/core/region_map_component.cc
+++ b/repos/base/src/core/region_map_component.cc
@@ -7,14 +7,14 @@
*/
/*
- * Copyright (C) 2006-2013 Genode Labs GmbH
+ * Copyright (C) 2006-2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* Genode includes */
-#include
+#include
#include
#include
#include
@@ -214,7 +214,7 @@ int Rm_client::pager(Ipc_pager &pager)
src_fault_area.constrain(map_size_log2);
dst_fault_area.constrain(map_size_log2);
if (!src_fault_area.valid() || !dst_fault_area.valid())
- PERR("Invalid mapping");
+ error("invalid mapping");
/*
* Check if dataspace is compatible with page-fault type
@@ -390,11 +390,6 @@ Region_map_component::attach(Dataspace_capability ds_cap, size_t size,
/* inform dataspace about attachment */
dsc->attached_to(region);
- if (verbose)
- PDBG("attach ds %p (a=%lx,s=%zx,o=%lx) @ [%lx,%lx)",
- (Dataspace_component *)dsc, dsc->phys_addr(), dsc->size(),
- offset, (addr_t)r, (addr_t)r + size);
-
/* check if attach operation resolves any faulting region-manager clients */
for (Rm_faulter *faulter = _faulters.head(); faulter; ) {
@@ -422,11 +417,6 @@ static void unmap_managed(Region_map_component *rm, Rm_region *region, int level
managed;
managed = managed->List::Element::next()) {
- if (verbose)
- PDBG("(%d: %p) a=%lx,s=%lx,off=%lx ra=%lx,s=%lx,off=%lx sub-session %p",
- level, rm, managed->base(), (long)managed->size(), managed->offset(),
- region->base(), (long)region->size(), region->offset(), managed->rm());
-
if (managed->base() - managed->offset() >= region->base() - region->offset()
&& managed->base() - managed->offset() + managed->size()
<= region->base() - region->offset() + region->size())
@@ -451,18 +441,13 @@ void Region_map_component::detach(Local_addr local_addr)
Rm_region *region_ptr = _map.metadata(local_addr);
if (!region_ptr) {
- PWRN("detach: no attachment at %p", (void *)local_addr);
+ warning("detach: no attachment at ", (void *)local_addr);
return;
}
Dataspace_component *dsc = region_ptr->dataspace();
if (!dsc)
- PWRN("Rm_region of %p may be inconsistent!", this);
-
- if (verbose)
- PDBG("detach ds %p (a=%lx,s=%zx,o=%lx) at [%lx,%lx)",
- dsc, dsc->phys_addr(), dsc->size(), region_ptr->offset(),
- region_ptr->base(), region_ptr->base() + region_ptr->size());
+ warning("detach: region of ", this, " may be inconsistent!");
/* inform dataspace about detachment */
dsc->detached_from(region_ptr);
@@ -522,7 +507,7 @@ void Region_map_component::detach(Local_addr local_addr)
*/
if (!platform()->supports_direct_unmap()
&& dsc->managed() && dsc->core_local_addr() == 0) {
- PWRN("unmapping of managed dataspaces not yet supported");
+ warning("unmapping of managed dataspaces not yet supported");
break;
}
@@ -628,8 +613,9 @@ Region_map::State Region_map_component::state()
return faulter->fault_state();
}
-static Dataspace_capability _type_deduction_helper(Dataspace_capability cap) {
- return cap; }
+
+static Dataspace_capability
+_type_deduction_helper(Dataspace_capability cap) { return cap; }
Region_map_component::Region_map_component(Rpc_entrypoint &ep,
diff --git a/repos/base/src/core/rom_session_component.cc b/repos/base/src/core/rom_session_component.cc
index 37d1c40da..dd792e7cb 100644
--- a/repos/base/src/core/rom_session_component.cc
+++ b/repos/base/src/core/rom_session_component.cc
@@ -11,7 +11,6 @@
* under the terms of the GNU General Public License version 2.
*/
-#include
#include
#include
#include
diff --git a/repos/base/src/core/rpc_cap_factory_l4.cc b/repos/base/src/core/rpc_cap_factory_l4.cc
index b040c8e16..9c6921904 100644
--- a/repos/base/src/core/rpc_cap_factory_l4.cc
+++ b/repos/base/src/core/rpc_cap_factory_l4.cc
@@ -29,7 +29,7 @@ Native_capability Rpc_cap_factory::_alloc(Rpc_cap_factory *owner,
Native_capability ep)
{
if (!ep.valid()) {
- PWRN("Invalid entrypoint capability");
+ warning("Invalid entrypoint capability");
return Native_capability();
}
diff --git a/repos/base/src/core/signal_source_component.cc b/repos/base/src/core/signal_source_component.cc
index fe7530ec8..c445e4fc3 100644
--- a/repos/base/src/core/signal_source_component.cc
+++ b/repos/base/src/core/signal_source_component.cc
@@ -13,7 +13,6 @@
/* Genode includes */
#include
-#include
/* core includes */
#include
diff --git a/repos/base/src/core/spec/x86/io_port_session_component.cc b/repos/base/src/core/spec/x86/io_port_session_component.cc
index 3bf8d9ed4..d5d2bcb08 100644
--- a/repos/base/src/core/spec/x86/io_port_session_component.cc
+++ b/repos/base/src/core/spec/x86/io_port_session_component.cc
@@ -22,9 +22,6 @@
using namespace Genode;
-static const bool verbose = false;
-
-
/******************************
** Constructor / destructor **
******************************/
@@ -41,11 +38,11 @@ Io_port_session_component::Io_port_session_component(Range_allocator *io_port_al
switch (io_port_alloc->alloc_addr(size, base).value) {
case Range_allocator::Alloc_return::RANGE_CONFLICT:
- PERR("I/O port [%x,%x) not available", base, base + size);
+ error("I/O port ", Hex_range(base, size), " not available");
throw Root::Invalid_args();
case Range_allocator::Alloc_return::OUT_OF_METADATA:
- PERR("I/O port allocator ran out of meta data");
+ error("I/O port allocator ran out of meta data");
/*
* Do not throw 'Quota_exceeded' because the client cannot do
@@ -56,9 +53,6 @@ Io_port_session_component::Io_port_session_component(Range_allocator *io_port_al
case Range_allocator::Alloc_return::OK: break;
}
- if (verbose)
- PDBG("I/O port: [%04x,%04x)", base, base + size);
-
/* store information */
_base = base;
_size = size;
@@ -67,8 +61,5 @@ Io_port_session_component::Io_port_session_component(Range_allocator *io_port_al
Io_port_session_component::~Io_port_session_component()
{
- if (verbose)
- PDBG("I/O port: [%04x,%04x)", _base, _base + _size);
-
_io_port_alloc->free(reinterpret_cast(_base));
}
diff --git a/repos/base/src/core/stack_area.cc b/repos/base/src/core/stack_area.cc
index fac1c840c..ef5b14e04 100644
--- a/repos/base/src/core/stack_area.cc
+++ b/repos/base/src/core/stack_area.cc
@@ -15,7 +15,7 @@
/* Genode includes */
#include
#include
-#include
+#include
#include
#include
@@ -61,8 +61,6 @@ class Stack_area_region_map : public Region_map
Ds_slab _ds_slab { platform()->core_mem_alloc() };
- enum { verbose = false };
-
public:
/**
@@ -79,30 +77,23 @@ class Stack_area_region_map : public Region_map
Range_allocator *ra = platform_specific()->ram_alloc();
if (ra->alloc_aligned(size, &phys_base,
get_page_size_log2()).error()) {
- PERR("could not allocate backing store for new stack");
+ error("could not allocate backing store for new stack");
return (addr_t)0;
}
- if (verbose)
- PDBG("phys_base = %p, size = 0x%zx", phys_base, size);
-
Dataspace_component *ds = new (&_ds_slab)
Dataspace_component(size, 0, (addr_t)phys_base, CACHED, true, 0);
if (!ds) {
- PERR("dataspace for core stack does not exist");
+ error("dataspace for core stack does not exist");
return (addr_t)0;
}
addr_t core_local_addr = stack_area_virtual_base() + (addr_t)local_addr;
- if (verbose)
- PDBG("core_local_addr = %lx, phys_addr = %lx, size = 0x%zx",
- core_local_addr, ds->phys_addr(), ds->size());
-
if (!map_local(ds->phys_addr(), core_local_addr,
ds->size() >> get_page_size_log2())) {
- PERR("could not map phys %lx at local %lx",
- ds->phys_addr(), core_local_addr);
+ error("could not map phys ", Hex(ds->phys_addr()),
+ " at local ", Hex(core_local_addr));
return (addr_t)0;
}
diff --git a/repos/base/src/core/trace_session_component.cc b/repos/base/src/core/trace_session_component.cc
index e0e25b7fb..a8ddd6028 100644
--- a/repos/base/src/core/trace_session_component.cc
+++ b/repos/base/src/core/trace_session_component.cc
@@ -34,7 +34,7 @@ size_t Session_component::subjects()
} catch (Allocator::Out_of_memory) {
- PWRN("TRACE session ran out of memory");
+ warning("TRACE session ran out of memory");
throw Out_of_metadata();
}
diff --git a/repos/base/src/include/base/internal/capability_space_tpl.h b/repos/base/src/include/base/internal/capability_space_tpl.h
index 60087c770..0a50e49bf 100644
--- a/repos/base/src/include/base/internal/capability_space_tpl.h
+++ b/repos/base/src/include/base/internal/capability_space_tpl.h
@@ -176,7 +176,7 @@ class Genode::Capability_space_tpl
Lock::Guard guard(_lock);
if (data.inc_ref() == 255)
- PERR("cap ref count overflow");
+ error("cap ref count overflow");
}
Rpc_obj_key rpc_obj_key(Data const &data) const
diff --git a/repos/base/src/include/base/internal/expanding_cpu_session_client.h b/repos/base/src/include/base/internal/expanding_cpu_session_client.h
index 57fb107cb..140c44e9a 100644
--- a/repos/base/src/include/base/internal/expanding_cpu_session_client.h
+++ b/repos/base/src/include/base/internal/expanding_cpu_session_client.h
@@ -16,7 +16,6 @@
/* Genode includes */
#include
-#include
#include
/* base-internal includes */
diff --git a/repos/base/src/include/base/internal/expanding_parent_client.h b/repos/base/src/include/base/internal/expanding_parent_client.h
index e3624dcdd..a2e7279fb 100644
--- a/repos/base/src/include/base/internal/expanding_parent_client.h
+++ b/repos/base/src/include/base/internal/expanding_parent_client.h
@@ -162,7 +162,7 @@ class Genode::Expanding_parent_client : public Parent_client
{
Lock::Guard guard(_lock);
- PLOG("resource_request: %s", args.string());
+ log("resource_request: ", args.string());
/*
* Issue request but don't block if a custom signal handler is
diff --git a/repos/base/src/include/base/internal/platform_env.h b/repos/base/src/include/base/internal/platform_env.h
index d256f39b6..32173dcaf 100644
--- a/repos/base/src/include/base/internal/platform_env.h
+++ b/repos/base/src/include/base/internal/platform_env.h
@@ -21,7 +21,7 @@
#define _INCLUDE__BASE__INTERNAL__PLATFORM_ENV_H_
/* Genode includes */
-#include
+#include
#include
#include
@@ -118,9 +118,9 @@ class Genode::Platform_env : public Env_deprecated,
void release() {
- PDBG("used before freeing emergency=%zu", _resources.ram.used());
+ log("used before freeing emergency=", _resources.ram.used());
_resources.ram.free(_emergency_ram_ds);
- PDBG("used after freeing emergency=%zu", _resources.ram.used());
+ log("used after freeing emergency=", _resources.ram.used());
}
diff --git a/repos/base/src/include/base/internal/upgradeable_client.h b/repos/base/src/include/base/internal/upgradeable_client.h
index 0f153b976..bc230e415 100644
--- a/repos/base/src/include/base/internal/upgradeable_client.h
+++ b/repos/base/src/include/base/internal/upgradeable_client.h
@@ -15,6 +15,7 @@
#define _INCLUDE__BASE__INTERNAL__UPGRADEABLE_CLIENT_H_
#include
+#include
namespace Genode { template struct Upgradeable_client; }
@@ -33,8 +34,8 @@ struct Genode::Upgradeable_client : CLIENT
void upgrade_ram(size_t quota)
{
- PINF("upgrading quota donation for Env::%s (%zu bytes)",
- CLIENT::Rpc_interface::service_name(), quota);
+ log("upgrading quota donation for Env::", CLIENT::Rpc_interface::service_name(),
+ " (", quota, " bytes)");
char buf[128];
snprintf(buf, sizeof(buf), "ram_quota=%zu", quota);
diff --git a/repos/base/src/lib/base/allocator_avl.cc b/repos/base/src/lib/base/allocator_avl.cc
index b98d14eaa..57cbea76d 100644
--- a/repos/base/src/lib/base/allocator_avl.cc
+++ b/repos/base/src/lib/base/allocator_avl.cc
@@ -12,7 +12,7 @@
*/
#include
-#include
+#include
using namespace Genode;
@@ -186,8 +186,9 @@ void Allocator_avl_base::_revert_allocations_and_ranges()
}
if (dangling_allocations)
- PWRN("%zd dangling allocation%s at allocator destruction time",
- dangling_allocations, (dangling_allocations > 1) ? "s" : "");
+ warning(dangling_allocations, " dangling allocation",
+ (dangling_allocations > 1) ? "s" : "",
+ " at allocator destruction time");
/* remove ranges */
while (Block *block = _addr_tree.first())
@@ -353,8 +354,8 @@ void Allocator_avl_base::free(void *addr)
size_t new_size = b->size();
if (new_addr != (addr_t)addr)
- PERR("%s: given address (0x%p) is not the block start address (0x%lx)",
- __PRETTY_FUNCTION__, addr, new_addr);
+ error(__PRETTY_FUNCTION__, ": given address (", addr, ") "
+ "is not the block start address (", (void *)new_addr, ")");
_destroy_block(b);
diff --git a/repos/base/src/lib/base/avl_tree.cc b/repos/base/src/lib/base/avl_tree.cc
index 5758ae186..2ea2025ed 100644
--- a/repos/base/src/lib/base/avl_tree.cc
+++ b/repos/base/src/lib/base/avl_tree.cc
@@ -12,7 +12,7 @@
*/
#include
-#include
+#include
using namespace Genode;
@@ -89,7 +89,7 @@ void Avl_node_base::_rebalance_subtree(Avl_node_base *node, Policy &policy)
void Avl_node_base::insert(Avl_node_base *node, Policy &policy)
{
if (node == this) {
- PERR("Inserting element %p twice into avl tree!", node);
+ error("inserting element ", node, " twice into avl tree!");
return;
}
@@ -118,7 +118,7 @@ void Avl_node_base::remove(Policy &policy)
Avl_node_base *l = _child[0];
if (!_parent)
- PERR("Error: tried to remove AVL node that is not in an AVL tree");
+ error("tried to remove AVL node that is not in an AVL tree");
if (l) {
diff --git a/repos/base/src/lib/base/child.cc b/repos/base/src/lib/base/child.cc
index 5d98acb41..7d366fff1 100644
--- a/repos/base/src/lib/base/child.cc
+++ b/repos/base/src/lib/base/child.cc
@@ -57,7 +57,7 @@ namespace {
{
if (_from.valid() && _to.valid() &&
Ram_session_client(_from).transfer_quota(_to, quantum)) {
- PWRN("not enough quota for a donation of %zu bytes", quantum);
+ warning("not enough quota for a donation of ", quantum, " bytes");
throw Parent::Quota_exceeded();
}
}
@@ -202,7 +202,7 @@ void Child::_remove_session(Child::Session *s)
/* return session quota to the ram session of the child */
if (_policy.ref_ram_session()->transfer_quota(_ram, s->donated_ram_quota()))
- PERR("We ran out of our own quota");
+ error("We ran out of our own quota");
destroy(heap(), s);
}
@@ -218,7 +218,7 @@ Service &Child::_parent_service()
void Child::_close(Session* s)
{
if (!s) {
- PWRN("no session structure found");
+ warning("no session structure found");
return;
}
@@ -233,8 +233,7 @@ void Child::_close(Session* s)
*/
try { s->service()->close(s->cap()); }
catch (Blocking_canceled) {
- PDBG("Got Blocking_canceled exception during %s->close call\n",
- s->ident()); }
+ warning("Got Blocking_canceled exception during ", s->ident(), "->close call"); }
/*
* If the session was provided by a child of us,
@@ -249,7 +248,7 @@ void Child::_close(Session* s)
Ram_session_client server_ram(s->service()->ram_session_cap());
if (server_ram.transfer_quota(_policy.ref_ram_cap(),
s->donated_ram_quota())) {
- PERR("Misbehaving server '%s'!", s->service()->name());
+ error("Misbehaving server '", s->service()->name(), "'!");
}
}
@@ -378,12 +377,12 @@ void Child::upgrade(Session_capability to_session, Parent::Upgrade_args const &a
targeted_service = session->service();
if (!targeted_service) {
- PWRN("could not lookup service for session upgrade");
+ warning("could not lookup service for session upgrade");
return;
}
if (!args.valid_string()) {
- PWRN("no valid session-upgrade arguments");
+ warning("no valid session-upgrade arguments");
return;
}
diff --git a/repos/base/src/lib/base/child_process.cc b/repos/base/src/lib/base/child_process.cc
index 05254c38c..ff4c3c97c 100644
--- a/repos/base/src/lib/base/child_process.cc
+++ b/repos/base/src/lib/base/child_process.cc
@@ -13,7 +13,7 @@
*/
/* Genode includes */
-#include
+#include
#include
#include
@@ -39,7 +39,7 @@ Child::Process::Loaded_executable::Loaded_executable(Dataspace_capability elf_ds
addr_t elf_addr;
try { elf_addr = local_rm.attach(elf_ds); }
catch (Region_map::Attach_failed) {
- PERR("local attach of ELF executable failed"); throw; }
+ error("local attach of ELF executable failed"); throw; }
/* setup ELF object and read program entry pointer */
Elf_binary elf(elf_addr);
@@ -55,13 +55,13 @@ Child::Process::Loaded_executable::Loaded_executable(Dataspace_capability elf_ds
local_rm.detach(elf_addr);
if (!ldso_ds.valid()) {
- PERR("attempt to start dynamic executable without dynamic linker");
+ error("attempt to start dynamic executable without dynamic linker");
throw Missing_dynamic_linker();
}
try { elf_addr = local_rm.attach(ldso_ds); }
catch (Region_map::Attach_failed) {
- PERR("local attach of dynamic linker failed"); throw; }
+ error("local attach of dynamic linker failed"); throw; }
elf_ds = ldso_ds;
elf = Elf_binary(elf_addr);
@@ -102,13 +102,13 @@ Child::Process::Loaded_executable::Loaded_executable(Dataspace_capability elf_ds
Dataspace_capability ds_cap;
try { ds_cap = ram.alloc(size); }
catch (Ram_session::Alloc_failed) {
- PERR("allocation of read-write segment failed"); throw; };
+ error("allocation of read-write segment failed"); throw; };
/* attach dataspace */
void *base;
try { base = local_rm.attach(ds_cap); }
catch (Region_map::Attach_failed) {
- PERR("local attach of segment dataspace failed"); throw; }
+ error("local attach of segment dataspace failed"); throw; }
void * const ptr = base;
addr_t const laddr = elf_addr + seg.file_offset();
@@ -134,14 +134,14 @@ Child::Process::Loaded_executable::Loaded_executable(Dataspace_capability elf_ds
off_t const offset = 0;
try { remote_rm.attach_at(ds_cap, addr, size, offset); }
catch (Region_map::Attach_failed) {
- PERR("remote attach of read-write segment failed"); throw; }
+ error("remote attach of read-write segment failed"); throw; }
} else {
/* read-only segment */
if (seg.file_size() != seg.mem_size())
- PWRN("filesz and memsz for read-only segment differ");
+ warning("filesz and memsz for read-only segment differ");
off_t const offset = seg.file_offset();
try {
@@ -151,7 +151,7 @@ Child::Process::Loaded_executable::Loaded_executable(Dataspace_capability elf_ds
remote_rm.attach_at(elf_ds, addr, size, offset);
}
catch (Region_map::Attach_failed) {
- PERR("remote attach of read-only segment failed"); throw; }
+ error("remote attach of read-only segment failed"); throw; }
}
}
diff --git a/repos/base/src/lib/base/elf_binary.cc b/repos/base/src/lib/base/elf_binary.cc
index 4d672267d..8953dff19 100644
--- a/repos/base/src/lib/base/elf_binary.cc
+++ b/repos/base/src/lib/base/elf_binary.cc
@@ -12,7 +12,7 @@
*/
/* Genode includes */
-#include
+#include
#include
/* base-internal includes */
@@ -27,18 +27,18 @@ int Elf_binary::_ehdr_check_compat()
Elf_Ehdr *ehdr = (Elf_Ehdr *)_start;
if (memcmp(ehdr, ELFMAG, SELFMAG) != 0) {
- PERR("binary is not an ELF");
+ error("binary is not an ELF");
return -1;
}
if (ehdr->e_ident[EI_CLASS] != ELFCLASS) {
- PERR("support for 32/64-bit objects only");
+ error("support for 32/64-bit objects only");
return -1;
}
/* start executeables and shared objects with entry points only */
if (!(ehdr->e_type == ET_EXEC || (ehdr->e_type == ET_DYN && ehdr->e_entry))) {
- PERR("program is no executable");
+ error("program is no executable");
return -1;
}
@@ -55,7 +55,7 @@ int Elf_binary::_ph_table_check_compat()
for (i = 0; i < num; i++) {
if (ph_table[i].p_type == PT_LOAD)
if (ph_table[i].p_align & (0x1000 - 1)) {
- PWRN("unsupported alignment 0x%lx", (unsigned long) ph_table[i].p_align);
+ warning("unsupported alignment ", (unsigned long) ph_table[i].p_align);
return -1;
}
if (ph_table[i].p_type == PT_DYNAMIC)
diff --git a/repos/base/src/lib/base/entrypoint.cc b/repos/base/src/lib/base/entrypoint.cc
index 675be7361..1a1ed6d48 100644
--- a/repos/base/src/lib/base/entrypoint.cc
+++ b/repos/base/src/lib/base/entrypoint.cc
@@ -69,7 +69,7 @@ void Entrypoint::_process_incoming_signals()
*/
retry(
[&] () { _signal_proxy_cap.call(); },
- [] () { PWRN("blocking canceled during signal processing"); }
+ [] () { warning("blocking canceled during signal processing"); }
);
} while (!_suspended_callback);
@@ -176,7 +176,7 @@ Entrypoint::Entrypoint(Env &env)
try {
constructor_cap.call();
} catch (Genode::Blocking_canceled) {
- PWRN("blocking canceled in entrypoint constructor");
+ warning("blocking canceled in entrypoint constructor");
}
_rpc_ep->dissolve(&constructor);
diff --git a/repos/base/src/lib/base/heap.cc b/repos/base/src/lib/base/heap.cc
index 18005c129..4a247121e 100644
--- a/repos/base/src/lib/base/heap.cc
+++ b/repos/base/src/lib/base/heap.cc
@@ -13,7 +13,7 @@
#include
#include
-#include
+#include
#include
#include
@@ -86,10 +86,10 @@ Heap::Dataspace *Heap::_allocate_dataspace(size_t size, bool enforce_separate_me
new_ds_cap = _ds_pool.ram_session->alloc(size);
ds_addr = _ds_pool.region_map->attach(new_ds_cap);
} catch (Ram_session::Alloc_failed) {
- PWRN("could not allocate new dataspace of size %zu", size);
+ warning("could not allocate new dataspace of size ", size);
return 0;
} catch (Region_map::Attach_failed) {
- PWRN("could not attach dataspace");
+ warning("could not attach dataspace");
_ds_pool.ram_session->free(new_ds_cap);
return 0;
}
@@ -98,7 +98,7 @@ Heap::Dataspace *Heap::_allocate_dataspace(size_t size, bool enforce_separate_me
/* allocate the Dataspace structure */
if (_unsynchronized_alloc(sizeof(Heap::Dataspace), &ds_meta_data_addr) < 0) {
- PWRN("could not allocate dataspace meta data");
+ warning("could not allocate dataspace meta data");
return 0;
}
@@ -109,7 +109,7 @@ Heap::Dataspace *Heap::_allocate_dataspace(size_t size, bool enforce_separate_me
/* allocate the Dataspace structure */
if (_alloc->alloc_aligned(sizeof(Heap::Dataspace), &ds_meta_data_addr, log2(sizeof(addr_t))).error()) {
- PWRN("could not allocate dataspace meta data - this should never happen");
+ warning("could not allocate dataspace meta data - this should never happen");
return 0;
}
@@ -152,7 +152,7 @@ bool Heap::_unsynchronized_alloc(size_t size, void **out_addr)
Heap::Dataspace *ds = _allocate_dataspace(dataspace_size, true);
if (!ds) {
- PWRN("could not allocate dataspace");
+ warning("could not allocate dataspace");
return false;
}
diff --git a/repos/base/src/lib/base/output.cc b/repos/base/src/lib/base/output.cc
index c3fee71b0..be4f84ad5 100644
--- a/repos/base/src/lib/base/output.cc
+++ b/repos/base/src/lib/base/output.cc
@@ -85,14 +85,18 @@ void Genode::print(Output &output, double value)
out_float(value, 10, 6, [&] (char c) { output.out_char(c); });
}
-void Genode::print(Output &output, Hex const &value)
+void Genode::Hex::print(Output &output) const
{
- if (value.prefix == Hex::PREFIX)
+ if (_prefix == Hex::PREFIX)
output.out_string("0x");
- size_t const pad_len = (value.pad == Hex::PAD) ? value.digits : 0;
+ size_t const pad_len = (_pad == Hex::PAD) ? _digits : 0;
- out_unsigned(value.value, 16, pad_len,
- [&] (char c) { output.out_char(c); });
+ /* mask possible sign-extension bits */
+ unsigned long long mask = 0;
+ for (size_t i = 0; i < _digits; ++i) mask = (mask << 4) | 0xf;
+
+ out_unsigned(_value & mask, 16, pad_len,
+ [&] (char c) { output.out_char(c); });
}
diff --git a/repos/base/src/lib/base/rpc_dispatch_loop.cc b/repos/base/src/lib/base/rpc_dispatch_loop.cc
index 5138c5d44..73f28d8fa 100644
--- a/repos/base/src/lib/base/rpc_dispatch_loop.cc
+++ b/repos/base/src/lib/base/rpc_dispatch_loop.cc
@@ -14,7 +14,6 @@
/* Genode includes */
#include
#include
-#include
/* base-internal includes */
#include
diff --git a/repos/base/src/lib/base/rpc_entrypoint.cc b/repos/base/src/lib/base/rpc_entrypoint.cc
index ea82ea9c5..940f16e32 100644
--- a/repos/base/src/lib/base/rpc_entrypoint.cc
+++ b/repos/base/src/lib/base/rpc_entrypoint.cc
@@ -99,7 +99,7 @@ Rpc_entrypoint::~Rpc_entrypoint()
dissolve(&_exit_handler);
if (!empty())
- PWRN("Object pool not empty in %s", __func__);
+ warning("object pool not empty in ", __func__);
/*
* Now that we finished the 'dissolve' steps above (which need a working
diff --git a/repos/base/src/lib/base/signal.cc b/repos/base/src/lib/base/signal.cc
index b079a264a..4cc3d1669 100644
--- a/repos/base/src/lib/base/signal.cc
+++ b/repos/base/src/lib/base/signal.cc
@@ -189,12 +189,12 @@ Genode::Signal_context_registry *signal_context_registry()
void Signal_context::submit(unsigned num)
{
if (!_receiver) {
- PWRN("signal context with no receiver");
+ warning("signal context with no receiver");
return;
}
if (!signal_context_registry()->test_and_lock(this)) {
- PWRN("encountered dead signal context");
+ warning("encountered dead signal context");
return;
}
@@ -239,7 +239,7 @@ Signal_context_capability Signal_receiver::manage(Signal_context *context)
char buf[64];
snprintf(buf, sizeof(buf), "ram_quota=%zu", quota);
- PINF("upgrading quota donation for PD session (%zu bytes)", quota);
+ log("upgrading quota donation for PD session (", quota, " bytes)");
env()->parent()->upgrade(env()->pd_session_cap(), buf);
}
@@ -284,12 +284,12 @@ void Signal_receiver::dispatch_signals(Signal_source *signal_source)
Signal_context *context = (Signal_context *)(source_signal.imprint());
if (!context) {
- PERR("received null signal imprint, stop signal handling");
+ error("received null signal imprint, stop signal handling");
sleep_forever();
}
if (!signal_context_registry()->test_and_lock(context)) {
- PWRN("encountered dead signal context");
+ warning("encountered dead signal context");
continue;
}
@@ -298,7 +298,7 @@ void Signal_receiver::dispatch_signals(Signal_source *signal_source)
Signal::Data signal(context, source_signal.num());
context->_receiver->local_submit(signal);
} else {
- PWRN("signal context with no receiver");
+ warning("signal context with no receiver");
}
/* free context lock that was taken by 'test_and_lock' */
diff --git a/repos/base/src/lib/base/signal_common.cc b/repos/base/src/lib/base/signal_common.cc
index 29ad1b9f6..2695af383 100644
--- a/repos/base/src/lib/base/signal_common.cc
+++ b/repos/base/src/lib/base/signal_common.cc
@@ -94,7 +94,7 @@ Signal_context::~Signal_context()
* dissolving it from the signal receiver.
*/
if (_receiver)
- PERR("Destructing undissolved signal context");
+ error("Destructing undissolved signal context");
}
@@ -152,7 +152,7 @@ Signal Signal_receiver::pending_signal()
context->_curr_signal = Signal::Data(0, 0);
if (result.num == 0)
- PWRN("returning signal with num == 0");
+ warning("returning signal with num == 0");
Trace::Signal_received trace_event(*context, result.num);
diff --git a/repos/base/src/lib/base/slab.cc b/repos/base/src/lib/base/slab.cc
index c0db8745a..c0e2062f5 100644
--- a/repos/base/src/lib/base/slab.cc
+++ b/repos/base/src/lib/base/slab.cc
@@ -221,7 +221,7 @@ Slab::Slab(size_t slab_size, size_t block_size, void *initial_sb,
_curr_sb = _new_slab_block();
if (!_curr_sb) {
- PERR("failed to obtain initial slab block");
+ error("failed to obtain initial slab block");
throw Out_of_memory();
}
@@ -259,7 +259,7 @@ Slab::Block *Slab::_new_slab_block()
void Slab::_release_backing_store(Block *block)
{
if (block->avail() != _entries_per_block)
- PWRN("freeing non-empty slab block");
+ error("freeing non-empty slab block");
_total_avail -= block->avail();
_num_blocks--;
diff --git a/repos/base/src/lib/base/sliced_heap.cc b/repos/base/src/lib/base/sliced_heap.cc
index 9ad5b3f8f..2022948f8 100644
--- a/repos/base/src/lib/base/sliced_heap.cc
+++ b/repos/base/src/lib/base/sliced_heap.cc
@@ -13,7 +13,7 @@
#include
#include
-#include
+#include
using namespace Genode;
@@ -50,11 +50,11 @@ bool Sliced_heap::alloc(size_t size, void **out_addr)
ds_cap = _ram_session.alloc(size);
block = _region_map.attach(ds_cap);
} catch (Region_map::Attach_failed) {
- PERR("Could not attach dataspace to local address space");
+ error("Could not attach dataspace to local address space");
_ram_session.free(ds_cap);
return false;
} catch (Ram_session::Alloc_failed) {
- PERR("Could not allocate dataspace with size %zu", size);
+ error("Could not allocate dataspace with size %zu", size);
return false;
}
diff --git a/repos/base/src/lib/base/thread.cc b/repos/base/src/lib/base/thread.cc
index 352e53052..cfa662761 100644
--- a/repos/base/src/lib/base/thread.cc
+++ b/repos/base/src/lib/base/thread.cc
@@ -255,8 +255,8 @@ Thread::Thread(Env &env, Name const &name, size_t stack_size)
Thread::~Thread()
{
if (Thread::myself() == this) {
- PERR("thread '%s' tried to self de-struct - sleeping forever.",
- _stack->name().string());
+ error("thread '", _stack->name().string(), "' "
+ "tried to self de-struct - sleeping forever.");
sleep_forever();
}
diff --git a/repos/base/src/lib/base/trace.cc b/repos/base/src/lib/base/trace.cc
index bd21debbd..24459a398 100644
--- a/repos/base/src/lib/base/trace.cc
+++ b/repos/base/src/lib/base/trace.cc
@@ -78,7 +78,7 @@ bool Trace::Logger::_evaluate_control()
Dataspace_capability policy_ds = Cpu_thread_client(thread_cap).trace_policy();
if (!policy_ds.valid()) {
- PWRN("could not obtain trace policy");
+ warning("could not obtain trace policy");
control->error();
enabled = false;
return false;
@@ -104,7 +104,7 @@ bool Trace::Logger::_evaluate_control()
Dataspace_capability buffer_ds = Cpu_thread_client(thread_cap).trace_buffer();
if (!buffer_ds.valid()) {
- PWRN("could not obtain trace buffer");
+ warning("could not obtain trace buffer");
control->error();
enabled = false;
return false;
@@ -144,7 +144,7 @@ void Trace::Logger::init(Thread_capability thread, Cpu_session *cpu_session,
Dataspace_capability ds = cpu->trace_control();
size_t size = Dataspace_client(ds).size();
if ((index + 1)*sizeof(Trace::Control) > size) {
- PERR("thread control index is out of range");
+ error("thread control index is out of range");
return;
}
diff --git a/repos/base/src/lib/cxx/exception.cc b/repos/base/src/lib/cxx/exception.cc
index 9e79fca5b..0408c99cb 100644
--- a/repos/base/src/lib/cxx/exception.cc
+++ b/repos/base/src/lib/cxx/exception.cc
@@ -16,7 +16,8 @@
#include
/* Genode includes */
-#include
+#include
+#include
extern "C" char __eh_frame_start__[]; /* from linker script */
extern "C" void __register_frame (const void *begin); /* from libgcc_eh */
@@ -58,11 +59,13 @@ void terminate_handler()
char *demangled_name = __cxa_demangle(t->name(), nullptr, nullptr, nullptr);
if (demangled_name) {
- PERR("Uncaught exception of type '%s'", demangled_name);
+ Genode::error("Uncaught exception of type "
+ "'", Genode::Cstring(demangled_name), "'");
free(demangled_name);
- } else
- PERR("Uncaught exception of type '%s' (use 'c++filt -t' to demangle)",
- t->name());
+ } else {
+ Genode::error("Uncaught exception of type '", t->name(), "' "
+ "(use 'c++filt -t' to demangle)");
+ }
}
diff --git a/repos/base/src/lib/cxx/misc.cc b/repos/base/src/lib/cxx/misc.cc
index daec9109f..b8a0376eb 100644
--- a/repos/base/src/lib/cxx/misc.cc
+++ b/repos/base/src/lib/cxx/misc.cc
@@ -93,7 +93,7 @@ void __register_frame(void *) { }
*/
extern "C" __attribute__((weak)) void raise()
{
- PDBG("raise called - not implemented\n");
+ warning("cxx: raise called - not implemented");
}
@@ -145,7 +145,6 @@ extern "C" int memcmp(const void *p0, const void *p1, size_t size)
extern "C" __attribute__((weak))
void *memcpy(void *dst, void *src, size_t n)
{
-// PDBG("dst=%p, src=%p, n=%d", dst, src, n);
return Genode::memcpy(dst, src, n);
}
@@ -153,7 +152,6 @@ void *memcpy(void *dst, void *src, size_t n)
extern "C" __attribute__((weak))
void *memmove(void *dst, void *src, size_t n)
{
-// PDBG("dst=%p, src=%p, n=%d", dst, src, n);
return Genode::memmove(dst, src, n);
}
@@ -161,7 +159,6 @@ void *memmove(void *dst, void *src, size_t n)
extern "C" __attribute__((weak))
void *memset(void *s, int c, size_t n)
{
-// PDBG("s=%p, c=%d, n=%d", s, c, n);
return Genode::memset(s, c, n);
}
diff --git a/repos/base/src/lib/cxx/new_delete.cc b/repos/base/src/lib/cxx/new_delete.cc
index 2145c02b7..b86b27a0b 100644
--- a/repos/base/src/lib/cxx/new_delete.cc
+++ b/repos/base/src/lib/cxx/new_delete.cc
@@ -11,7 +11,7 @@
* under the terms of the GNU General Public License version 2.
*/
-#include
+#include
#include
#include
@@ -43,8 +43,8 @@ static void try_dealloc(void *ptr, Deallocator &dealloc)
* the size argument.
*/
if (dealloc.need_size_for_free()) {
- PERR("C++ runtime: delete called with allocator, which needs "
- "'size' on free. Blocking before leaking memory...");
+ Genode::error("C++ runtime: delete called with allocator, which needs "
+ "'size' on free. Blocking before leaking memory...");
sleep_forever();
}
@@ -69,6 +69,6 @@ void operator delete (void *ptr, Deallocator &dealloc) { try_dealloc(ptr, deall
*/
__attribute__((weak)) void operator delete (void *)
{
- PERR("cxx: operator delete (void *) called - not implemented. "
- "A working implementation is available in the 'stdcxx' library.");
+ Genode::error("cxx: operator delete (void *) called - not implemented. "
+ "A working implementation is available in the 'stdcxx' library.");
}
diff --git a/repos/base/src/lib/ldso/debug.cc b/repos/base/src/lib/ldso/debug.cc
index 8a4e0ec09..021c5e288 100644
--- a/repos/base/src/lib/ldso/debug.cc
+++ b/repos/base/src/lib/ldso/debug.cc
@@ -33,8 +33,8 @@ void Linker::dump_link_map(Object *o)
if (o->is_binary())
continue;
- Genode::printf(" " EFMT " .. " EFMT ": %s\n",
- o->link_map()->addr, o->link_map()->addr + o->size() - 1,
- o->name());
+ Genode::log(" ", Genode::Hex(o->link_map()->addr),
+ " .. ", Genode::Hex(o->link_map()->addr + o->size() - 1),
+ ": ", o->name());
}
}
diff --git a/repos/base/src/lib/ldso/dependency.cc b/repos/base/src/lib/ldso/dependency.cc
index 502e712c4..191e7885c 100644
--- a/repos/base/src/lib/ldso/dependency.cc
+++ b/repos/base/src/lib/ldso/dependency.cc
@@ -34,7 +34,7 @@ Linker::Dependency::~Dependency()
if (obj->unload()) {
if (verbose_loading)
- PDBG("Destroy: %s\n", obj->name());
+ Genode::log("Destroy: ", obj->name());
destroy(Genode::env()->heap(), obj);
}
diff --git a/repos/base/src/lib/ldso/exception.cc b/repos/base/src/lib/ldso/exception.cc
index 8cb88dc29..ea055b23d 100644
--- a/repos/base/src/lib/ldso/exception.cc
+++ b/repos/base/src/lib/ldso/exception.cc
@@ -47,7 +47,7 @@ extern "C" int dl_iterate_phdr(int (*callback) (Phdr_info *info, Genode::size_t
info.phnum = e->file()->phdr.count;
if (verbose_exception)
- PDBG("%s reloc " EFMT, e->name(), e->reloc_base());
+ Genode::log(e->name(), " reloc ", Genode::Hex(e->reloc_base()));
if ((err = callback(&info, sizeof(Phdr_info), data)))
break;
diff --git a/repos/base/src/lib/ldso/file.cc b/repos/base/src/lib/ldso/file.cc
index bb89af6d0..8f9ebce24 100644
--- a/repos/base/src/lib/ldso/file.cc
+++ b/repos/base/src/lib/ldso/file.cc
@@ -161,12 +161,12 @@ struct Linker::Elf_file : File
bool check_compat(Elf::Ehdr const *ehdr)
{
if (memcmp(ehdr, ELFMAG, SELFMAG) != 0) {
- PERR("LD: binary is not an ELF");
+ Genode::error("LD: binary is not an ELF");
return false;
}
if (ehdr->e_ident[EI_CLASS] != ELFCLASS) {
- PERR("LD: support for 32/64-bit objects only");
+ Genode::error("LD: support for 32/64-bit objects only");
return false;
}
@@ -215,7 +215,7 @@ struct Linker::Elf_file : File
continue;
if (ph->p_align & (0x1000 - 1)) {
- PERR("LD: Unsupported alignment %p", (void *)ph->p_align);
+ Genode::error("LD: Unsupported alignment ", (void *)ph->p_align);
throw Incompatible();
}
@@ -244,8 +244,9 @@ struct Linker::Elf_file : File
reloc_base = (start == reloc_base) ? 0 : reloc_base;
if (verbose_loading)
- PDBG("reloc_base: " EFMT " start: " EFMT " end: " EFMT,
- reloc_base, start, reloc_base + start + size);
+ Genode::log("LD: reloc_base: ", Genode::Hex(reloc_base),
+ " start: ", Genode::Hex(start),
+ " end: ", Genode::Hex(reloc_base + start + size));
for (unsigned i = 0; i < p.count; i++) {
Elf::Phdr *ph = &p.phdr[i];
@@ -257,7 +258,7 @@ struct Linker::Elf_file : File
load_segment_rw(*ph, i);
else {
- PERR("LD: Non-RW/RX segment");
+ Genode::error("LD: Non-RW/RX segment");
throw Invalid_file();
}
}
@@ -321,7 +322,8 @@ struct Linker::Elf_file : File
File const *Linker::load(char const *path, bool load)
{
if (verbose_loading)
- PDBG("loading: %s (PHDRS only: %s)", path, load ? "no" : "yes");
+ Genode::log("LD loading: ", path, " "
+ "(PHDRS only: ", load ? "no" : "yes", ")");
Elf_file *file = new (env()->heap()) Elf_file(Linker::file(path), load);
return file;
diff --git a/repos/base/src/lib/ldso/include/debug.h b/repos/base/src/lib/ldso/include/debug.h
index 9b3b954e9..9e11b9879 100644
--- a/repos/base/src/lib/ldso/include/debug.h
+++ b/repos/base/src/lib/ldso/include/debug.h
@@ -14,7 +14,8 @@
#ifndef _INCLUDE__DEBUG_H_
#define _INCLUDE__DEBUG_H_
-#include
+#include
+#include
#include
constexpr bool verbose_link_map = false;
@@ -127,8 +128,9 @@ struct Linker::Link_map
return;
for (Link_map *m = first; m; m = m->next)
- PINF("MAP: addr: " EFMT " dynamic: %p %s m: %p p: %p n: %p",
- m->addr, m->dynamic, m->path, m, m->prev, m->next);
+ Genode::log("MAP: addr: ", Genode::Hex(m->addr),
+ " dynamic: ", m->dynamic, " ", Genode::Cstring(m->path),
+ " m: ", m, " p: ", m->prev, " n: ", m->next);
}
};
diff --git a/repos/base/src/lib/ldso/include/dynamic.h b/repos/base/src/lib/ldso/include/dynamic.h
index 354617105..1077211db 100644
--- a/repos/base/src/lib/ldso/include/dynamic.h
+++ b/repos/base/src/lib/ldso/include/dynamic.h
@@ -185,7 +185,7 @@ struct Linker::Dynamic
Reloc_plt(obj, pltrel_type, pltrel, pltrel_size);
break;
default:
- PERR("LD: Invalid PLT relocation %u", pltrel_type);
+ Genode::error("LD: Invalid PLT relocation ", (int)pltrel_type);
throw Incompatible();
}
}
diff --git a/repos/base/src/lib/ldso/include/init.h b/repos/base/src/lib/ldso/include/init.h
index 267ae0b64..2c180911a 100644
--- a/repos/base/src/lib/ldso/include/init.h
+++ b/repos/base/src/lib/ldso/include/init.h
@@ -68,7 +68,7 @@ struct Linker::Init : Genode::List