base: avoid use of deprecated base/printf.h

Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.

While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).

To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.

Issue #1987
This commit is contained in:
Norman Feske 2016-07-13 19:07:09 +02:00 committed by Christian Helmuth
parent a5d3aa8373
commit 17c79a9e23
699 changed files with 5156 additions and 5865 deletions

View File

@ -63,8 +63,9 @@ namespace Genode {
L4_IPC_NEVER, &ipc_result); L4_IPC_NEVER, &ipc_result);
if (L4_IPC_IS_ERROR(ipc_result)) { if (L4_IPC_IS_ERROR(ipc_result)) {
PWRN("could not locally remap 0x%lx to 0x%lx, error code is %ld", warning("could not locally remap ", Hex(from_addr), " "
from_addr, to_addr, L4_IPC_ERROR(ipc_result)); "to ", Hex(to_addr), ", "
"error code is ", L4_IPC_ERROR(ipc_result));
return false; return false;
} }
} }
@ -79,7 +80,7 @@ namespace Genode {
*/ */
inline void unmap_local(addr_t virt, size_t num_pages) 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");
} }
} }

View File

@ -191,7 +191,7 @@ namespace Genode {
* On L4/Fiasco, we don't use directed unmap but rely on the * On L4/Fiasco, we don't use directed unmap but rely on the
* in-kernel mapping database. See 'region_map_support.cc'. * 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"); }
}; };
} }

View File

@ -83,7 +83,8 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
L4_IPC_NEVER, &result, &tag); L4_IPC_NEVER, &result, &tag);
if (err || !l4_ipc_fpage_received(result)) { 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; return 0;
} }

View File

@ -12,7 +12,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <util/arg_string.h> #include <util/arg_string.h>
/* core includes */ /* core includes */
@ -52,7 +52,7 @@ bool Irq_object::_associate()
L4_IPC_SHORT_MSG, &dw0, &dw1, L4_IPC_SHORT_MSG, &dw0, &dw1,
L4_IPC_BOTH_TIMEOUT_0, &result); 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); return (err == L4_IPC_RETIMEOUT);
} }
@ -74,7 +74,7 @@ void Irq_object::_wait_for_irq()
L4_IPC_SHORT_MSG, &dw0, &dw1, L4_IPC_SHORT_MSG, &dw0, &dw1,
L4_IPC_NEVER, &result); 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)); } while (L4_IPC_IS_ERROR(result));
} }
@ -89,7 +89,7 @@ void Irq_object::start()
void Irq_object::entry() void Irq_object::entry()
{ {
if (!_associate()) { if (!_associate()) {
PERR("Could not associate with IRQ 0x%x", _irq); error("Could not associate with IRQ ", _irq);
return; return;
} }
@ -133,7 +133,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
throw Root::Unavailable(); throw Root::Unavailable();
if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).error()) { 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(); throw Root::Unavailable();
} }
@ -143,7 +143,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
Irq_session_component::~Irq_session_component() Irq_session_component::~Irq_session_component()
{ {
PERR("Not yet implemented."); error("Not yet implemented.");
} }

View File

@ -12,7 +12,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
/* core includes */ /* core includes */
#include <ipc_pager.h> #include <ipc_pager.h>
@ -45,7 +45,7 @@ void Ipc_pager::wait_for_fault()
L4_IPC_NEVER, &result); L4_IPC_NEVER, &result);
if (L4_IPC_IS_ERROR(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)); } while (L4_IPC_IS_ERROR(result));
} }
@ -62,7 +62,7 @@ void Ipc_pager::reply_and_wait_for_fault()
L4_IPC_SEND_TIMEOUT_0, &result); L4_IPC_SEND_TIMEOUT_0, &result);
if (L4_IPC_IS_ERROR(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 */ /* ignore all errors and wait for next proper message */
wait_for_fault(); wait_for_fault();

View File

@ -12,7 +12,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <base/allocator_avl.h> #include <base/allocator_avl.h>
#include <base/sleep.h> #include <base/sleep.h>
#include <util/misc_math.h> #include <util/misc_math.h>
@ -22,6 +22,7 @@
#include <base/internal/fiasco_thread_helper.h> #include <base/internal/fiasco_thread_helper.h>
#include <base/internal/stack_area.h> #include <base/internal/stack_area.h>
#include <base/internal/capability_space_tpl.h> #include <base/internal/capability_space_tpl.h>
#include <base/internal/globals.h>
/* core includes */ /* core includes */
#include <core_parent.h> #include <core_parent.h>
@ -44,11 +45,6 @@ namespace Fiasco {
using namespace Genode; 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 ** ** Core address space management **
***********************************/ ***********************************/
@ -107,21 +103,22 @@ static void _core_pager_loop()
if (pfa < L4_PAGESIZE) { if (pfa < L4_PAGESIZE) {
/* NULL pointer access */ /* NULL pointer access */
PERR("Possible null pointer %s in %x.%02x at %lx IP %lx", error("possible null pointer ", rw ? "WRITE" : "READ", " "
rw ? "WRITE" : "READ", (int)t.id.task, (int)t.id.lthread, pfa, dw1); "in ", (int)t.id.task, ".", (int)t.id.lthread, " "
"at ", Hex(pfa), " IP ", dw1);
/* do not unblock faulter */ /* do not unblock faulter */
send_reply = false; send_reply = false;
continue; continue;
} else if (!_core_address_ranges().valid_addr(pfa)) { } else if (!_core_address_ranges().valid_addr(pfa)) {
/* page-fault address is not in RAM */ /* page-fault address is not in RAM */
PERR("%s access outside of RAM in %x.%02x at %lx IP %lx", error(rw ? "WRITE" : "READ", " access outside of RAM "
rw ? "WRITE" : "READ", (int)t.id.task, (int)t.id.lthread, pfa, dw1); "in ", (int)t.id.task, ".", (int)t.id.lthread, " "
"at ", Hex(pfa), " IP ", dw1);
/* do not unblock faulter */ /* do not unblock faulter */
send_reply = false; send_reply = false;
continue; 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 */ /* my pf handler is sigma0 - just touch the appropriate page */
if (rw) 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 * Add region to allocator
*/ */
static inline void add_region(Region r, Range_allocator &alloc) 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 */ /* adjust region */
addr_t start = trunc_page(r.start); addr_t start = trunc_page(r.start);
addr_t end = round_page(r.end); 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) 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 */ /* adjust region */
addr_t start = trunc_page(r.start); addr_t start = trunc_page(r.start);
addr_t end = round_page(r.end); addr_t end = round_page(r.end);
@ -350,7 +330,7 @@ static Fiasco::l4_kernel_info_t *get_kip()
bool amok = false; bool amok = false;
if (err) { if (err) {
printf("IPC error %d\n", err); raw("IPC error ", err, " while accessing the KIP");
amok = true; amok = true;
} }
if (!l4_ipc_fpage_received(r)) { 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) if (kip->magic != L4_KERNEL_INFO_MAGIC)
panic("Sigma0 mapped something but not the KIP"); 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; return kip;
} }
@ -392,7 +362,7 @@ void Platform::_setup_basics()
/* update multi-boot info pointer from KIP */ /* update multi-boot info pointer from KIP */
addr_t mb_info_addr = kip->user_ptr; 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 */ /* parse memory descriptors - look for virtual memory configuration */
/* XXX we support only one VM region (here and also inside RM) */ /* XXX we support only one VM region (here and also inside RM) */
@ -451,9 +421,8 @@ void Platform::_setup_rom()
Rom_module *new_rom = new(core_mem_alloc()) Rom_module(rom); Rom_module *new_rom = new(core_mem_alloc()) Rom_module(rom);
_rom_fs.insert(new_rom); _rom_fs.insert(new_rom);
if (verbose) log(" mod[", i, "] ",
printf(" mod[%d] [%p,%p) %s\n", i, Hex_range<addr_t>(new_rom->addr(), new_rom->size()), " ",
(void *)new_rom->addr(), ((char *)new_rom->addr()) + new_rom->size(),
new_rom->name()); new_rom->name());
/* zero remainder of last ROM page */ /* zero remainder of last ROM page */
@ -484,21 +453,21 @@ Platform::Platform() :
if (initialized) panic("Platform constructed twice!"); if (initialized) panic("Platform constructed twice!");
initialized = true; initialized = true;
init_log();
_setup_basics(); _setup_basics();
_setup_mem_alloc(); _setup_mem_alloc();
_setup_io_port_alloc(); _setup_io_port_alloc();
_setup_irq_alloc(); _setup_irq_alloc();
_setup_rom(); _setup_rom();
if (verbose) { log(":ram_alloc: "); _ram_alloc()->dump_addr_tree();
printf(":ram_alloc: "); _ram_alloc()->dump_addr_tree(); log(":region_alloc: "); _region_alloc()->dump_addr_tree();
printf(":region_alloc: "); _region_alloc()->dump_addr_tree(); log(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
printf(":io_mem: "); _io_mem_alloc()->dump_addr_tree(); log(":io_port: "); _io_port_alloc()->dump_addr_tree();
printf(":io_port: "); _io_port_alloc()->dump_addr_tree(); log(":irq: "); _irq_alloc()->dump_addr_tree();
printf(":irq: "); _irq_alloc()->dump_addr_tree(); log(":rom_fs: "); _rom_fs.print_fs();
printf(":rom_fs: "); _rom_fs.print_fs(); log(":core ranges: "); _core_address_ranges()()->dump_addr_tree();
printf(":core ranges: "); _core_address_ranges()()->dump_addr_tree();
}
Fiasco::l4_threadid_t myself = Fiasco::l4_myself(); Fiasco::l4_threadid_t myself = Fiasco::l4_myself();

View File

@ -34,9 +34,6 @@ using namespace Fiasco;
using namespace Genode; using namespace Genode;
static const bool verbose = false;
/************************** /**************************
** Static class members ** ** 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) void Platform_pd::_free_thread(int thread_id)
{ {
if (!_threads[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; _threads[thread_id] = 0;
} }
@ -207,7 +204,7 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
int t = _alloc_thread(thread_id, thread); int t = _alloc_thread(thread_id, thread);
if (t < 0) { if (t < 0) {
PERR("thread alloc failed"); error("thread alloc failed");
return false; return false;
} }
thread_id = t; thread_id = t;
@ -218,7 +215,6 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
/* finally inform thread about binding */ /* finally inform thread about binding */
thread->bind(thread_id, l4_thread_id, this); thread->bind(thread_id, l4_thread_id, this);
if (verbose) _debug_log_threads();
return true; return true;
} }
@ -231,8 +227,6 @@ void Platform_pd::unbind_thread(Platform_thread *thread)
thread->unbind(); thread->unbind();
_free_thread(thread_id); _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); int ret = _alloc_pd(pd_id);
if (ret < 0) { if (ret < 0) {
_debug_log_pds();
panic("pd alloc failed"); panic("pd alloc failed");
} }
@ -268,27 +261,3 @@ Platform_pd::~Platform_pd()
_free_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);
}

View File

@ -15,7 +15,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <util/string.h> #include <util/string.h>
#include <cpu_session/cpu_session.h> #include <cpu_session/cpu_session.h>
@ -52,7 +52,8 @@ int Platform_thread::start(void *ip, void *sp)
&old_eflags, &dummy, &dummy, &old_eflags, &dummy, &dummy,
0, l4_utcb_get()); 0, l4_utcb_get());
if (old_eflags == ~0UL) 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); fiasco_register_thread_name(thread, _name);
return 0; return 0;
@ -61,13 +62,13 @@ int Platform_thread::start(void *ip, void *sp)
void Platform_thread::pause() void Platform_thread::pause()
{ {
PDBG("not implemented"); warning(__func__, " not implemented");
} }
void Platform_thread::resume() void Platform_thread::resume()
{ {
PDBG("not implemented"); warning(__func__, " not implemented");
} }
@ -99,7 +100,8 @@ void Platform_thread::unbind()
&old_eflags, &dummy, &dummy, &old_eflags, &dummy, &dummy,
0, l4_utcb_get()); 0, l4_utcb_get());
if (old_eflags == ~0UL) 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; _thread_id = THREAD_INVALID;
_l4_thread_id = L4_INVALID_ID; _l4_thread_id = L4_INVALID_ID;
@ -109,7 +111,7 @@ void Platform_thread::unbind()
void Platform_thread::state(Thread_state s) void Platform_thread::state(Thread_state s)
{ {
PDBG("Not implemented"); warning(__func__, " not implemented");
throw Cpu_thread::State_access_failed(); throw Cpu_thread::State_access_failed();
} }
@ -129,7 +131,8 @@ Thread_state Platform_thread::state()
&old_eflags, &ip, &sp, &old_eflags, &ip, &sp,
L4_THREAD_EX_REGS_NO_CANCEL, l4_utcb_get()); L4_THREAD_EX_REGS_NO_CANCEL, l4_utcb_get());
if (old_eflags == ~0UL) 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 */ /* fill thread state structure */
s.ip = ip; s.ip = ip;

View File

@ -12,7 +12,6 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h>
#include <base/log.h> #include <base/log.h>
#include <base/ipc.h> #include <base/ipc.h>
#include <base/blocking.h> #include <base/blocking.h>
@ -176,7 +175,7 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
if (L4_IPC_ERROR(ipc_result) == L4_IPC_RECANCELED) if (L4_IPC_ERROR(ipc_result) == L4_IPC_RECANCELED)
throw Genode::Blocking_canceled(); 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(); 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); L4_IPC_SEND_TIMEOUT_0, &result);
if (L4_IPC_IS_ERROR(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. * incoming message.
*/ */
if (L4_IPC_IS_ERROR(ipc_result)) { 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 { } else {
need_to_wait = false; 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); L4_IPC_NEVER, &ipc_result);
if (L4_IPC_IS_ERROR(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 { } else {
need_to_wait = false; need_to_wait = false;
} }

View File

@ -107,12 +107,12 @@ namespace Genode {
l4_msgtag_t tag = l4_msgtag(L4_PROTO_SIGMA0, 2, 0, 0); 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); tag = l4_ipc_call(L4_BASE_PAGER_CAP, l4_utcb(), tag, L4_IPC_NEVER);
if (l4_ipc_error(tag, l4_utcb())) { 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; return false;
} }
if (l4_msgtag_items(tag) < 1) { if (l4_msgtag_items(tag) < 1) {
PERR("Got no mapping!"); error("got no mapping!");
return false; return false;
} }

View File

@ -112,7 +112,7 @@ namespace Genode {
* On Fiasco.OC, we don't use directed unmap but rely on the * On Fiasco.OC, we don't use directed unmap but rely on the
* in-kernel mapping database. See 'region_map_support.cc'. * 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"); }
}; };
} }

View File

@ -39,7 +39,7 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
return 0; return 0;
if (!map_local_io(base, (addr_t)local_base, size >> get_page_size_log2())) { 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; return 0;
} }

View File

@ -12,7 +12,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <base/thread.h> #include <base/thread.h>
/* core includes */ /* core includes */
@ -82,7 +82,7 @@ void Ipc_pager::wait_for_fault()
_parse(label); _parse(label);
return; return;
} }
PERR("Ipc error %d in pagefault from %lx", err, label & ~0x3); error("Ipc error ", err, " in pagefault from ", Hex(label & ~0x3));
} while (true); } while (true);
} }
@ -115,7 +115,7 @@ void Ipc_pager::reply_and_wait_for_fault()
&label, L4_IPC_SEND_TIMEOUT_0); &label, L4_IPC_SEND_TIMEOUT_0);
int err = l4_ipc_error(_tag, l4_utcb()); int err = l4_ipc_error(_tag, l4_utcb());
if (err) { 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(); wait_for_fault();
} else } else
_parse(label); _parse(label);

View File

@ -14,7 +14,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <util/arg_string.h> #include <util/arg_string.h>
#include <util/bit_array.h> #include <util/bit_array.h>
@ -100,9 +100,8 @@ bool Genode::Irq_object::associate(unsigned irq, bool msi,
_polarity = polarity; _polarity = polarity;
using namespace Fiasco; using namespace Fiasco;
if (l4_error(l4_factory_create_irq(L4_BASE_FACTORY_CAP, if (l4_error(l4_factory_create_irq(L4_BASE_FACTORY_CAP, _capability()))) {
_capability()))) { error("l4_factory_create_irq failed!");
PERR("l4_factory_create_irq failed!");
return false; return false;
} }
@ -111,7 +110,7 @@ bool Genode::Irq_object::associate(unsigned irq, bool msi,
gsi |= L4_ICU_FLAG_MSI; gsi |= L4_ICU_FLAG_MSI;
if (l4_error(l4_icu_bind(L4_BASE_ICU_CAP, gsi, _capability()))) { 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; return false;
} }
@ -121,13 +120,13 @@ bool Genode::Irq_object::associate(unsigned irq, bool msi,
if (l4_error(l4_irq_attach(_capability(), reinterpret_cast<l4_umword_t>(this), if (l4_error(l4_irq_attach(_capability(), reinterpret_cast<l4_umword_t>(this),
Interrupt_handler::handler_cap()))) { Interrupt_handler::handler_cap()))) {
PERR("Error attaching to IRQ %u", _irq); error("cannot attach to IRQ ", _irq);
return false; return false;
} }
if (_msi_addr && l4_error(l4_icu_msi_info(L4_BASE_ICU_CAP, gsi, if (_msi_addr && l4_error(l4_icu_msi_info(L4_BASE_ICU_CAP, gsi,
&_msi_data))) { &_msi_data))) {
PERR("Error getting MSI info"); error("cannot get MSI info");
return false; return false;
} }
@ -142,7 +141,7 @@ void Genode::Irq_object::ack_irq()
int err; int err;
l4_msgtag_t tag = l4_irq_unmask(_capability()); l4_msgtag_t tag = l4_irq_unmask(_capability());
if ((err = l4_ipc_error(tag, l4_utcb()))) 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; gsi |= L4_ICU_FLAG_MSI;
if (l4_error(l4_irq_detach(_capability()))) 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()))) if (l4_error(l4_icu_unbind(L4_BASE_ICU_CAP, gsi, _capability())))
PERR("Error unbinding IRQ"); error("cannot unbind IRQ");
cap_map()->remove(_cap); 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); long msi = Arg_string::find_arg(args, "device_config_phys").long_value(0);
if (msi) { if (msi) {
if (msi_alloc.get(irq_args.irq_number(), 1)) { 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(); throw Root::Unavailable();
} }
msi_alloc.set(irq_args.irq_number(), 1); msi_alloc.set(irq_args.irq_number(), 1);
} else { } else {
if (!irq_alloc || irq_alloc->alloc_addr(1, irq_args.irq_number()).error()) { 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(); throw Root::Unavailable();
} }
} }
@ -263,7 +262,7 @@ void Interrupt_handler::entry()
while (true) { while (true) {
tag = l4_ipc_wait(l4_utcb(), &label, L4_IPC_NEVER); tag = l4_ipc_wait(l4_utcb(), &label, L4_IPC_NEVER);
if ((err = l4_ipc_error(tag, l4_utcb()))) if ((err = l4_ipc_error(tag, l4_utcb())))
PERR("IRQ receive: %d\n", err); error("IRQ receive: ", err);
else { else {
Irq_object * irq_object = reinterpret_cast<Irq_object *>(label); Irq_object * irq_object = reinterpret_cast<Irq_object *>(label);
irq_object->notify(); irq_object->notify();

View File

@ -15,7 +15,7 @@
/* Genode includes */ /* Genode includes */
#include <base/env.h> #include <base/env.h>
#include <base/printf.h> #include <base/log.h>
#include <base/lock.h> #include <base/lock.h>
/* core includes */ /* core includes */
@ -48,7 +48,7 @@ void Pager_entrypoint::entry()
apply(_pager.badge(), [&] (Pager_object *obj) { apply(_pager.badge(), [&] (Pager_object *obj) {
/* the pager_object might be destroyed, while we got the message */ /* the pager_object might be destroyed, while we got the message */
if (!obj) { if (!obj) {
PWRN("No pager object found!"); warning("no pager object found!");
return; return;
} }
@ -69,8 +69,9 @@ void Pager_entrypoint::entry()
/* handle request */ /* handle request */
if (obj->pager(_pager)) { if (obj->pager(_pager)) {
/* could not resolv - leave thread in pagefault */ /* could not resolv - leave thread in pagefault */
PDBG("Could not resolve pf=%p ip=%p", warning("could not resolve "
(void*)_pager.fault_addr(), (void*)_pager.fault_ip()); "pf=", Hex(_pager.fault_addr()), " ",
"ip=", Hex(_pager.fault_ip()));
} else { } else {
_pager.set_reply_dst(Native_thread(obj->badge())); _pager.set_reply_dst(Native_thread(obj->badge()));
reply_pending = true; reply_pending = true;
@ -131,7 +132,7 @@ void Pager_entrypoint::entry()
} }
default: default:
PERR("Got unknown message type %x!", _pager.msg_type()); error("got unknown message type ", Hex(_pager.msg_type()));
} }
}); });
}; };

View File

@ -13,7 +13,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <base/allocator_avl.h> #include <base/allocator_avl.h>
#include <base/sleep.h> #include <base/sleep.h>
#include <util/misc_math.h> #include <util/misc_math.h>
@ -21,6 +21,7 @@
/* base-internal includes */ /* base-internal includes */
#include <base/internal/crt0.h> #include <base/internal/crt0.h>
#include <base/internal/stack_area.h> #include <base/internal/stack_area.h>
#include <base/internal/globals.h>
/* core includes */ /* core includes */
#include <core_parent.h> #include <core_parent.h>
@ -47,11 +48,6 @@ static l4_kernel_info_t *kip;
using namespace Genode; 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 ** ** Core address space management **
***********************************/ ***********************************/
@ -90,7 +86,7 @@ static void _core_pager_loop()
tag = l4_ipc_wait(utcb, &label, L4_IPC_NEVER); tag = l4_ipc_wait(utcb, &label, L4_IPC_NEVER);
if (!tag.is_page_fault()) { if (!tag.is_page_fault()) {
PWRN("Received something different than a pagefault, ignoring ..."); warning("received something different than a pagefault, ignoring ...");
continue; continue;
} }
@ -102,21 +98,20 @@ static void _core_pager_loop()
if (pfa < (l4_umword_t)L4_PAGESIZE) { if (pfa < (l4_umword_t)L4_PAGESIZE) {
/* NULL pointer access */ /* NULL pointer access */
PERR("Possible null pointer %s at %lx IP %lx", error("Possible null pointer ", rw ? "WRITE" : "READ", " "
rw ? "WRITE" : "READ", pfa, ip); "at ", Hex(pfa), " IP ", Hex(ip));
/* do not unblock faulter */ /* do not unblock faulter */
send_reply = false; send_reply = false;
continue; continue;
} else if (!_core_address_ranges().valid_addr(pfa)) { } else if (!_core_address_ranges().valid_addr(pfa)) {
/* page-fault address is not in RAM */ /* page-fault address is not in RAM */
PERR("%s access outside of RAM at %lx IP %lx", error(rw ? "WRITE" : "READ", " access outside of RAM "
rw ? "WRITE" : "READ", pfa, ip); "at ", Hex(pfa), " IP ", Hex(ip));
/* do not unblock faulter */ /* do not unblock faulter */
send_reply = false; send_reply = false;
continue; continue;
} else if (verbose_core_pf) }
PDBG("pfa=%lx ip=%lx", pfa, ip);
/* my pf handler is sigma0 - just touch the appropriate page */ /* my pf handler is sigma0 - just touch the appropriate page */
if (rw) 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_thread_control_exc_handler(thread().local.data()->kcap());
l4_msgtag_t tag = l4_thread_control_commit(L4_BASE_THREAD_CAP); l4_msgtag_t tag = l4_thread_control_commit(L4_BASE_THREAD_CAP);
if (l4_msgtag_has_error(tag)) 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 * Add region to allocator
*/ */
static inline void add_region(Region r, Range_allocator &alloc) 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 */ /* adjust region */
addr_t start = trunc_page(r.start); addr_t start = trunc_page(r.start);
addr_t end = round_page(r.end); 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) 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 */ /* adjust region */
addr_t start = trunc_page(r.start); addr_t start = trunc_page(r.start);
addr_t end = round_page(r.end); addr_t end = round_page(r.end);
@ -366,15 +344,10 @@ void Platform::_setup_basics()
if (kip->magic != L4_KERNEL_INFO_MAGIC) if (kip->magic != L4_KERNEL_INFO_MAGIC)
panic("Sigma0 mapped something but not the KIP"); panic("Sigma0 mapped something but not the KIP");
if (verbose) { log("");
printf("\n"); log("KIP @ ", kip);
printf("KIP @ %p\n", kip); log(" magic: ", Hex(kip->magic));
printf(" magic: %08zx\n", (size_t)kip->magic); log(" version: ", Hex(kip->version));
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);
}
/* add KIP as ROM module */ /* add KIP as ROM module */
_kip_rom = Rom_module((addr_t)kip, L4_PAGESIZE, "l4v2_kip"); _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 */ /* update multi-boot info pointer from KIP */
addr_t mb_info_addr = kip->user_ptr; 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 */ /* parse memory descriptors - look for virtual memory configuration */
/* XXX we support only one VM region (here and also inside RM) */ /* XXX we support only one VM region (here and also inside RM) */
@ -447,11 +420,6 @@ void Platform::_setup_rom()
/* map module */ /* map module */
touch_ro((const void*)new_rom->addr(), new_rom->size()); 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 */ /* zero remainder of last ROM page */
size_t count = L4_PAGESIZE - rom.size() % L4_PAGESIZE; size_t count = L4_PAGESIZE - rom.size() % L4_PAGESIZE;
if (count != L4_PAGESIZE) if (count != L4_PAGESIZE)
@ -485,21 +453,21 @@ Platform::Platform() :
if (initialized) panic("Platform constructed twice!"); if (initialized) panic("Platform constructed twice!");
initialized = true; initialized = true;
init_log();
_setup_basics(); _setup_basics();
_setup_mem_alloc(); _setup_mem_alloc();
_setup_io_port_alloc(); _setup_io_port_alloc();
_setup_irq_alloc(); _setup_irq_alloc();
_setup_rom(); _setup_rom();
if (verbose) { log(":ram_alloc: "); _ram_alloc()->dump_addr_tree();
printf(":ram_alloc: "); _ram_alloc()->dump_addr_tree(); log(":region_alloc: "); _region_alloc()->dump_addr_tree();
printf(":region_alloc: "); _region_alloc()->dump_addr_tree(); log(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
printf(":io_mem: "); _io_mem_alloc()->dump_addr_tree(); log(":io_port: "); _io_port_alloc()->dump_addr_tree();
printf(":io_port: "); _io_port_alloc()->dump_addr_tree(); log(":irq: "); _irq_alloc()->dump_addr_tree();
printf(":irq: "); _irq_alloc()->dump_addr_tree(); log(":rom_fs: "); _rom_fs.print_fs();
printf(":rom_fs: "); _rom_fs.print_fs(); log(":core ranges: "); _core_address_ranges()()->dump_addr_tree();
printf(":core ranges: "); _core_address_ranges()()->dump_addr_tree();
}
Core_cap_index* pdi = Core_cap_index* pdi =
reinterpret_cast<Core_cap_index*>(cap_map()->insert(_cap_id_alloc.alloc(), Fiasco::L4_BASE_TASK_CAP)); reinterpret_cast<Core_cap_index*>(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, l4_msgtag_t res = l4_scheduler_info(L4_BASE_SCHEDULER_CAP, &cpus_max,
&cpus); &cpus);
if (l4_error(res)) { 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; return 1;
} }

View File

@ -77,7 +77,7 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
return true; return true;
} }
PERR("thread alloc failed"); error("thread alloc failed");
return false; 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, l4_msgtag_t tag = l4_factory_create_task(L4_BASE_FACTORY_CAP,
_task.local.data()->kcap(), utcb_area); _task.local.data()->kcap(), utcb_area);
if (l4_msgtag_has_error(tag)) if (l4_msgtag_has_error(tag))
PERR("pd creation failed"); error("pd creation failed");
} }

View File

@ -13,7 +13,7 @@
/* Genode includes */ /* Genode includes */
#include <base/ipc.h> #include <base/ipc.h>
#include <base/printf.h> #include <base/log.h>
#include <util/string.h> #include <util/string.h>
/* core includes */ /* core includes */
@ -241,7 +241,7 @@ void Platform_thread::_create_thread()
l4_msgtag_t tag = l4_factory_create_thread(L4_BASE_FACTORY_CAP, l4_msgtag_t tag = l4_factory_create_thread(L4_BASE_FACTORY_CAP,
_thread.local.data()->kcap()); _thread.local.data()->kcap());
if (l4_msgtag_has_error(tag)) 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 */ /* create initial gate for thread */
_gate.local = thread_cap_factory().alloc(_thread.local); _gate.local = thread_cap_factory().alloc(_thread.local);

View File

@ -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_obj_fpage(local.data()->kcap(), 0, L4_FPAGE_RWX),
((l4_cap_idx_t)remote) | L4_ITEM_MAP); ((l4_cap_idx_t)remote) | L4_ITEM_MAP);
if (l4_msgtag_has_error(tag)) 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(), idx->kcap(),
ref->pt()->thread().local.data()->kcap(), id); ref->pt()->thread().local.data()->kcap(), id);
if (l4_msgtag_has_error(tag)) { if (l4_msgtag_has_error(tag)) {
PERR("l4_factory_create_gate failed!"); error("l4_factory_create_gate failed!");
cap_map()->remove(idx); cap_map()->remove(idx);
platform_specific()->cap_id_alloc()->free(id); platform_specific()->cap_id_alloc()->free(id);
return cap; return cap;
@ -132,7 +132,7 @@ Native_capability Rpc_cap_factory::alloc(Native_capability ep)
idx->pt(ref->pt()); idx->pt(ref->pt());
cap = Native_capability(*idx); cap = Native_capability(*idx);
} catch (Cap_id_allocator::Out_of_ids) { } 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_obj_fpage(i->kcap(), 0, L4_FPAGE_RWX),
L4_FP_ALL_SPACES | L4_FP_DELETE_OBJ); L4_FP_ALL_SPACES | L4_FP_DELETE_OBJ);
if (l4_msgtag_has_error(tag)) 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()); platform_specific()->cap_id_alloc()->free(i->id());

View File

@ -13,7 +13,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <base/native_capability.h> #include <base/native_capability.h>
/* core includes */ /* core includes */
@ -56,7 +56,7 @@ void Signal_source_component::submit(Signal_context_component *context,
Signal_source::Signal Signal_source_component::wait_for_signal() Signal_source::Signal Signal_source_component::wait_for_signal()
{ {
if (_signal_queue.empty()) { if (_signal_queue.empty()) {
PWRN("unexpected call of wait_for_signal"); warning("unexpected call of wait_for_signal");
return Signal(0, 0); 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, l4_msgtag_t res = l4_factory_create_irq(L4_BASE_FACTORY_CAP,
_blocking_semaphore.data()->kcap()); _blocking_semaphore.data()->kcap());
if (l4_error(res)) if (l4_error(res))
PERR("Allocation of irq object failed!"); error("Allocation of irq object failed!");
} }

View File

@ -13,7 +13,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <irq_session/irq_session.h> #include <irq_session/irq_session.h>
#include "platform.h" #include "platform.h"
@ -84,5 +84,5 @@ void Genode::Platform::setup_irq_mode(unsigned irq_number, unsigned trigger,
* Set mode * Set mode
*/ */
if (l4_error(l4_icu_set_mode(L4_BASE_ICU_CAP, irq_number, 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");
} }

View File

@ -15,6 +15,7 @@
/* Genode includes */ /* Genode includes */
#include <base/env.h> #include <base/env.h>
#include <base/log.h>
#include <log_session/connection.h> #include <log_session/connection.h>
#include <foc/capability_space.h> #include <foc/capability_space.h>
@ -26,7 +27,7 @@ using namespace Fiasco;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
printf("--- capability integrity test ---\n"); log("--- capability integrity test ---");
enum { COUNT = 1000 }; enum { COUNT = 1000 };
@ -48,6 +49,6 @@ int main(int argc, char **argv)
} catch(...) { } } catch(...) { }
} }
printf("--- finished capability integrity test ---\n"); log("--- finished capability integrity test ---");
return 0; return 0;
} }

View File

@ -11,7 +11,7 @@
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
*/ */
#include <base/printf.h> #include <base/log.h>
#include <util/string.h> #include <util/string.h>
#include <muen/sinfo.h> #include <muen/sinfo.h>
@ -24,16 +24,16 @@ static bool log_channel(
void *data) void *data)
{ {
if (channel->has_event || channel->has_vector) { if (channel->has_event || channel->has_vector) {
PDBG("muen-sinfo: [%s with %s %03d] %s\n", Genode::log("muen-sinfo: [",
channel->writable ? "writer" : "reader", channel->writable ? "writer" : "reader", " with ",
channel->has_event ? "event " : "vector", channel->has_event ? "event " : "vector", " ",
channel->has_event ? channel->event_number : channel->vector, channel->has_event ? channel->event_number : channel->vector,
channel->name); "] ", channel->name);
} else { } else {
PDBG("muen-sinfo: [%s with no %s ] %s\n", Genode::log("muen-sinfo: [",
channel->writable ? "writer" : "reader", channel->writable ? "writer" : "reader", " with no ",
channel->writable ? "event " : "vector", channel->writable ? "event " : "vector", " ",
channel->name); "] ", channel->name);
} }
return true; return true;
@ -41,14 +41,14 @@ static bool log_channel(
/* Log memory region information */ /* Log memory region information */
static bool log_memregion( static bool log_memregion(const struct Genode::Sinfo::Memregion_info * const region,
const struct Genode::Sinfo::Memregion_info * const region,
void *data) void *data)
{ {
PDBG("muen-sinfo: [addr 0x%016llx size 0x%016llx %s%s] %s\n", Genode::log("muen-sinfo: [addr ", Genode::Hex(region->address), " "
region->address, region->size, "size ", Genode::Hex(region->size), " ",
region->writable ? "rw" : "ro", region->writable ? "rw" : "ro",
region->executable ? "x" : "-", region->name); region->executable ? "x" : "-",
"] ", region->name);
return true; return true;
} }
@ -72,7 +72,7 @@ Sinfo::Sinfo(const addr_t base_addr)
sinfo = ((subject_info_type *)base_addr); sinfo = ((subject_info_type *)base_addr);
if (!check_magic()) { if (!check_magic()) {
PERR("muen-sinfo: Subject information MAGIC mismatch\n"); Genode::error("muen-sinfo: Subject information MAGIC mismatch");
return; return;
} }
} }
@ -207,19 +207,19 @@ uint64_t Sinfo::get_sched_end(void)
void Sinfo::log_status() void Sinfo::log_status()
{ {
if (!sinfo) { if (!sinfo) {
PINF("Sinfo API not initialized"); Genode::log("Sinfo API not initialized");
return; return;
} }
if (!check_magic()) { if (!check_magic()) {
PINF("Sinfo MAGIC not found"); Genode::log("Sinfo MAGIC not found");
return; return;
} }
PINF("muen-sinfo: Subject information exports %d memory region(s)\n", Genode::log("muen-sinfo: Subject information exports ",
sinfo->memregion_count); sinfo->memregion_count, " memory region(s)");
for_each_memregion(log_memregion, 0); for_each_memregion(log_memregion, 0);
PINF("muen-sinfo: Subject information exports %d channel(s)\n", Genode::log("muen-sinfo: Subject information exports ",
sinfo->channel_info_count); sinfo->channel_info_count, " channel(s)");
for_each_channel(log_channel, 0); for_each_channel(log_channel, 0);
} }

View File

@ -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(); size_t page_rounded_size = (size + get_page_size() - 1) & get_page_mask();
if (use_local_addr) { if (use_local_addr) {
PERR("Parameter 'use_local_addr' not supported within core"); error("Parameter 'use_local_addr' not supported within core");
return nullptr; return nullptr;
} }
if (offset) { if (offset) {
PERR("Parameter 'offset' not supported within core"); error("Parameter 'offset' not supported within core");
return nullptr; return nullptr;
} }
@ -52,7 +52,7 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
if (!platform()->region_alloc()->alloc_aligned(page_rounded_size, if (!platform()->region_alloc()->alloc_aligned(page_rounded_size,
&virt_addr, &virt_addr,
get_page_size_log2()).ok()) { get_page_size_log2()).ok()) {
PERR("Could not allocate virtual address range in core of size %zd\n", error("could not allocate virtual address range in core of size ",
page_rounded_size); page_rounded_size);
return nullptr; return nullptr;
} }

View File

@ -15,7 +15,7 @@
#define _CORE__INCLUDE__ASSERT_H_ #define _CORE__INCLUDE__ASSERT_H_
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
/** /**
* Suppress assertions in release version * Suppress assertions in release version
@ -43,9 +43,9 @@
do { \ do { \
if (DO_ASSERT) { \ if (DO_ASSERT) { \
if (!(expression)) { \ if (!(expression)) { \
PERR("Assertion failed: "#expression""); \ Genode::error("Assertion failed: "#expression""); \
PERR(" File: %s:%d", __FILE__, __LINE__); \ Genode::error(" File: ", __FILE__, ":", __LINE__); \
PERR(" Function: %s", __PRETTY_FUNCTION__); \ Genode::error(" Function: ", __PRETTY_FUNCTION__); \
while (1) ; \ while (1) ; \
} \ } \
} \ } \

View File

@ -14,7 +14,7 @@
#ifndef _CORE__INCLUDE__CPU_THREAD_ALLOCATOR_H_ #ifndef _CORE__INCLUDE__CPU_THREAD_ALLOCATOR_H_
#define _CORE__INCLUDE__CPU_THREAD_ALLOCATOR_H_ #define _CORE__INCLUDE__CPU_THREAD_ALLOCATOR_H_
#include <base/printf.h> #include <base/log.h>
#include <base/allocator.h> #include <base/allocator.h>
namespace Genode namespace Genode
@ -49,14 +49,16 @@ namespace Genode
void free(void *addr, size_t size) override { void free(void *addr, size_t size) override {
_alloc->free(addr, size); } _alloc->free(addr, size); }
size_t consumed() const override { size_t consumed() const override
PDBG("Unexpected call"); {
warning(__func__, "unexpectedly called");
while (1) ; while (1) ;
return 0; return 0;
} }
size_t overhead(size_t size) const override { size_t overhead(size_t size) const override
PDBG("Unexpected call"); {
warning(__func__, "unexpectedly called");
while (1) ; while (1) ;
return 0; return 0;
} }

View File

@ -81,7 +81,7 @@ class Genode::Signal_broker
auto lambda = [&] (Signal_source_component *s) { auto lambda = [&] (Signal_source_component *s) {
if (!s) { if (!s) {
PERR("unknown signal source"); error("unknown signal source");
return; return;
} }
@ -104,7 +104,7 @@ class Genode::Signal_broker
{ {
auto lambda = [&] (Signal_source_component *s) { auto lambda = [&] (Signal_source_component *s) {
if (!s) { if (!s) {
PERR("unknown signal source"); error("unknown signal source");
throw Invalid_signal_source(); throw Invalid_signal_source();
} }
@ -124,7 +124,7 @@ class Genode::Signal_broker
auto lambda = [&] (Signal_context_component *c) { auto lambda = [&] (Signal_context_component *c) {
if (!c) { if (!c) {
PERR("unknown signal context"); error("unknown signal context");
return; return;
} }

View File

@ -1,4 +1,4 @@
/** /*
* \brief RISCV Sv39 page table format * \brief RISCV Sv39 page table format
* \author Sebastian Sumpf * \author Sebastian Sumpf
* \date 2015-08-04 * \date 2015-08-04
@ -17,6 +17,7 @@
/* Genode includes */ /* Genode includes */
#include <util/misc_math.h> #include <util/misc_math.h>
#include <util/register.h> #include <util/register.h>
#include <base/log.h>
/* Core includes */ /* Core includes */
#include <cpu.h> #include <cpu.h>
@ -175,7 +176,7 @@ class Sv39::Level_x_translation_table
/* sanity check vo bits 38 to 63 must be equal */ /* sanity check vo bits 38 to 63 must be equal */
addr_t sanity = vo >> 38; addr_t sanity = vo >> 38;
if (sanity != 0 && sanity != 0x3ffffff) { if (sanity != 0 && sanity != 0x3ffffff) {
PERR("Invalid virtual address: %lx", vo); Genode::error("invalid virtual address: ", vo);
throw Invalid_range(); throw Invalid_range();
} }
@ -302,7 +303,7 @@ class Sv39::Level_x_translation_table
Level_x_translation_table() Level_x_translation_table()
{ {
if (!_aligned((addr_t)this, ALIGNM_LOG2)) { if (!_aligned((addr_t)this, ALIGNM_LOG2)) {
PWRN("misaligned address"); Genode::warning("misaligned address");
throw Misaligned(); throw Misaligned();
} }
@ -371,7 +372,7 @@ namespace Sv39 {
{ {
if ((vo & ~BLOCK_MASK) || (pa & ~BLOCK_MASK) || if ((vo & ~BLOCK_MASK) || (pa & ~BLOCK_MASK) ||
size < BLOCK_SIZE) { size < BLOCK_SIZE) {
PWRN("invalid range"); Genode::warning("invalid range");
throw Invalid_range(); throw Invalid_range();
} }

View File

@ -15,6 +15,7 @@
#define _CORE__INCLUDE__SPEC__RPI__PIC_H_ #define _CORE__INCLUDE__SPEC__RPI__PIC_H_
/* Genode includes */ /* Genode includes */
#include <base/log.h>
#include <util/mmio.h> #include <util/mmio.h>
/* core includes */ /* core includes */
@ -101,7 +102,7 @@ class Genode::Usb_dwc_otg : Mmio
stat_cnt++; stat_cnt++;
if (stat_cnt == 8000) { 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; stat_cnt = 0;
} }

View File

@ -14,6 +14,8 @@
#ifndef _CORE__INCLUDE__SPEC__X86_64__MUEN__BOARD_H_ #ifndef _CORE__INCLUDE__SPEC__X86_64__MUEN__BOARD_H_
#define _CORE__INCLUDE__SPEC__X86_64__MUEN__BOARD_H_ #define _CORE__INCLUDE__SPEC__X86_64__MUEN__BOARD_H_
#include <base/internal/globals.h>
namespace Genode namespace Genode
{ {
struct Board struct Board
@ -31,7 +33,7 @@ namespace Genode
TIMER_VECTOR_USER = 50, TIMER_VECTOR_USER = 50,
}; };
void init() { } void init() { Genode::init_log(); }
}; };
} }

View File

@ -15,7 +15,7 @@
#define _CORE__INCLUDE__SPEC__X86_64__MUEN__TIMER_H_ #define _CORE__INCLUDE__SPEC__X86_64__MUEN__TIMER_H_
/* base includes */ /* base includes */
#include <base/printf.h> #include <base/log.h>
#include <kernel/types.h> #include <kernel/types.h>
/* core includes */ /* core includes */
@ -70,18 +70,19 @@ class Genode::Timer
struct Sinfo::Memregion_info region; struct Sinfo::Memregion_info region;
if (!sinfo()->get_memregion_info("timed_event", &region)) { if (!sinfo()->get_memregion_info("timed_event", &region)) {
PERR("muen-timer: Unable to retrieve timed event region"); error("muen-timer: Unable to retrieve timed event region");
throw Invalid_region(); throw Invalid_region();
} }
_event_page = (Subject_timed_event *)region.address; _event_page = (Subject_timed_event *)region.address;
_event_page->event_nr = Board::TIMER_EVENT_KERNEL; _event_page->event_nr = Board::TIMER_EVENT_KERNEL;
PINF("muen-timer: Page @0x%llx, frequency %llu kHz, event %u", log("muen-timer: Page @", Hex(region.address), ", "
region.address, _tics_per_ms, _event_page->event_nr); "frequency ", _tics_per_ms, " kHz, "
"event ", (unsigned)_event_page->event_nr);
if (sinfo()->get_memregion_info("monitor_timed_event", &region)) { if (sinfo()->get_memregion_info("monitor_timed_event", &region)) {
PINF("muen-timer: Found guest timed event page @0x%llx" log("muen-timer: Found guest timed event page @", Hex(region.address),
" -> enabling preemption", region.address); " -> enabling preemption");
_guest_event_page = (Subject_timed_event *)region.address; _guest_event_page = (Subject_timed_event *)region.address;
_guest_event_page->event_nr = Board::TIMER_EVENT_PREEMPT; _guest_event_page->event_nr = Board::TIMER_EVENT_PREEMPT;
} }

View File

@ -16,6 +16,7 @@
/* Genode includes */ /* Genode includes */
#include <root/component.h> #include <root/component.h>
#include <base/heap.h>
/* core includes */ /* core includes */
#include <vm_session_component.h> #include <vm_session_component.h>

View File

@ -45,7 +45,7 @@ void Irq_session_component::ack_irq()
void Irq_session_component::sigh(Signal_context_capability cap) void Irq_session_component::sigh(Signal_context_capability cap)
{ {
if (_sig_cap.valid()) { if (_sig_cap.valid()) {
PWRN("signal handler already registered for IRQ %u", _irq_number); warning("signal handler already registered for IRQ ", _irq_number);
return; return;
} }
@ -53,7 +53,7 @@ void Irq_session_component::sigh(Signal_context_capability cap)
if (Kernel::new_irq((addr_t)&_kernel_object, _irq_number, if (Kernel::new_irq((addr_t)&_kernel_object, _irq_number,
Capability_space::capid(_sig_cap))) 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 */ /* allocate interrupt */
if (_irq_alloc->alloc_addr(1, _irq_number).error()) { 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(); throw Root::Invalid_args();
} }

View File

@ -79,7 +79,6 @@ time_t Clock::update_time()
/* update time */ /* update time */
time_t const old_value = _last_timeout_duration; time_t const old_value = _last_timeout_duration;
time_t const new_value = _timer->value(_cpu_id); 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_t const duration = old_value > new_value ? old_value - new_value : 1;
_time += duration; _time += duration;
return duration; return duration;

View File

@ -11,6 +11,9 @@
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
*/ */
/* Genode includes */
#include <base/log.h>
/* core includes */ /* core includes */
#include <kernel/cpu_scheduler.h> #include <kernel/cpu_scheduler.h>
#include <assert.h> #include <assert.h>
@ -189,7 +192,7 @@ void Cpu_scheduler::remove(Share * const s)
* *
*/ */
if (s == _head) { 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) ; while (1) ;
} }
if (s->_ready) { _fills.remove(s); } if (s->_ready) { _fills.remove(s); }

View File

@ -176,7 +176,7 @@ void Ipc_node::send_request(Ipc_node * const callee, capid_t capid, bool help,
unsigned rcv_caps) unsigned rcv_caps)
{ {
if (_state != INACTIVE) { if (_state != INACTIVE) {
PERR("IPC send request: bad state"); Genode::error("IPC send request: bad state");
return; return;
} }
Genode::Allocator &slab = pd()->platform_pd()->capability_slab(); Genode::Allocator &slab = pd()->platform_pd()->capability_slab();
@ -203,7 +203,7 @@ Ipc_node * Ipc_node::helping_sink() {
bool Ipc_node::await_request(unsigned rcv_caps) bool Ipc_node::await_request(unsigned rcv_caps)
{ {
if (_state != INACTIVE) { if (_state != INACTIVE) {
PERR("IPC await request: bad state"); Genode::error("IPC await request: bad state");
return true; return true;
} }
Genode::Allocator &slab = pd()->platform_pd()->capability_slab(); Genode::Allocator &slab = pd()->platform_pd()->capability_slab();

View File

@ -14,6 +14,7 @@
/* core includes */ /* core includes */
#include <kernel/pd.h> #include <kernel/pd.h>
#include <base/log.h>
#include <util.h> #include <util.h>
/* Genode includes */ /* 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, tt->insert_translation(Genode::trunc_page(VIRT_BASE), phys_base, SIZE,
Genode::Page_flags::mode_transition(), alloc); Genode::Page_flags::mode_transition(), alloc);
} catch(...) { } catch(...) {
PERR("Inserting exception vector in page table failed!"); } Genode::error("inserting exception vector in page table failed!"); }
} }

View File

@ -12,7 +12,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
/* core includes*/ /* core includes*/
#include <pager.h> #include <pager.h>
@ -86,9 +86,10 @@ void Pager_object::unresolved_page_fault_occurred()
{ {
Platform_thread * const pt = (Platform_thread *)badge(); Platform_thread * const pt = (Platform_thread *)badge();
if (pt && pt->pd()) if (pt && pt->pd())
PERR("%s -> %s: unresolved pagefault at ip=%lx sp=%lx fault address=%lx", error(pt->pd()->label(), " -> ", pt->label(), ": unresolved pagefault at "
pt->pd()->label(), pt->label(), pt->kernel_object()->ip, "ip=", pt->kernel_object()->ip, " "
pt->kernel_object()->sp, pt->kernel_object()->fault_addr()); "sp=", pt->kernel_object()->sp, " "
"fault address=", pt->kernel_object()->fault_addr());
} }
Pager_object::Pager_object(Cpu_session_capability cpu_session_cap, Pager_object::Pager_object(Cpu_session_capability cpu_session_cap,

View File

@ -200,7 +200,7 @@ Platform::Platform()
void Core_parent::exit(int exit_value) void Core_parent::exit(int exit_value)
{ {
log(__PRETTY_FUNCTION__, "not implemented"); warning(__PRETTY_FUNCTION__, "not implemented");
while (1); while (1);
} }

View File

@ -58,7 +58,7 @@ bool Hw::Address_space::insert_translation(addr_t virt, addr_t phys,
} }
} }
} catch(...) { } catch(...) {
PERR("Invalid mapping %p -> %p (%zx)", (void*)phys, (void*)virt, size); error("invalid mapping ", Hex(phys), " -> ", Hex(virt), " (", size, ")");
} }
return false; return false;
} }
@ -74,7 +74,7 @@ void Hw::Address_space::flush(addr_t virt, size_t size)
/* update translation caches */ /* update translation caches */
Kernel::update_pd(_kernel_pd); Kernel::update_pd(_kernel_pd);
} catch(...) { } 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) _label(label)
{ {
if (!_cap.valid()) { if (!_cap.valid()) {
PERR("failed to create kernel object"); error("failed to create kernel object");
throw Root::Unavailable(); throw Root::Unavailable();
} }
} }
@ -216,10 +216,9 @@ void Core_platform_pd::_map(addr_t start, addr_t end, bool io_mem)
try { try {
_table()->insert_translation(start, start, size, flags, _table_alloc()); _table()->insert_translation(start, start, size, flags, _table_alloc());
} catch(Allocator::Out_of_memory) { } catch(Allocator::Out_of_memory) {
PERR("Translation table needs to much RAM"); error("translation table needs to much RAM");
} catch(...) { } catch(...) {
PERR("Invalid mapping %p -> %p (%zx)", (void*)start, error("invalid mapping ", Hex(start), " size=", size);
(void*)start, size);
} }
} }

View File

@ -69,7 +69,7 @@ Platform_thread::Platform_thread(const char * const label,
/* create UTCB for a core thread */ /* create UTCB for a core thread */
void *utcb_phys; void *utcb_phys;
if (!platform()->ram_alloc()->alloc(sizeof(Native_utcb), &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(); throw Cpu_session::Out_of_metadata();
} }
map_local((addr_t)utcb_phys, (addr_t)_utcb_core_addr, 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), _utcb = core_env()->ram_session()->alloc(sizeof(Native_utcb),
CACHED); CACHED);
} catch (...) { } catch (...) {
PERR("failed to allocate UTCB"); error("failed to allocate UTCB");
throw Cpu_session::Out_of_metadata(); throw Cpu_session::Out_of_metadata();
} }
_utcb_core_addr = (Native_utcb *)core_env()->rm_session()->attach(_utcb); _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 */ /* check if thread is already in another protection domain */
if (_pd && _pd != pd) { if (_pd && _pd != pd) {
PERR("thread already in another protection domain"); error("thread already in another protection domain");
return; return;
} }
@ -139,7 +139,7 @@ int Platform_thread::start(void * const ip, void * const sp)
/* lock the address space */ /* lock the address space */
Locked_ptr<Address_space> locked_ptr(_address_space); Locked_ptr<Address_space> locked_ptr(_address_space);
if (!locked_ptr.valid()) { if (!locked_ptr.valid()) {
PERR("invalid RM client"); error("invalid RM client");
return -1; return -1;
}; };
Page_flags const flags = Page_flags::apply_mapping(true, CACHED, false); 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<Hw::Address_space*>(&*locked_ptr); Hw::Address_space * as = static_cast<Hw::Address_space*>(&*locked_ptr);
if (!as->insert_translation((addr_t)_utcb_pd_addr, dsc->phys_addr(), if (!as->insert_translation((addr_t)_utcb_pd_addr, dsc->phys_addr(),
sizeof(Native_utcb), flags)) { sizeof(Native_utcb), flags)) {
PERR("failed to attach UTCB"); error("failed to attach UTCB");
return -1; return -1;
} }
return 0; return 0;
@ -161,7 +161,7 @@ int Platform_thread::start(void * const ip, void * const sp)
/* start executing new thread */ /* start executing new thread */
if (!_pd) { if (!_pd) {
PWRN("No protection domain associated!"); error("no protection domain associated!");
return -1; return -1;
} }
@ -190,7 +190,7 @@ void Platform_thread::pager(Pager_object * const pager)
if (route_thread_event(kernel_object(), Thread_event_id::FAULT, if (route_thread_event(kernel_object(), Thread_event_id::FAULT,
pager ? Capability_space::capid(pager->cap()) pager ? Capability_space::capid(pager->cap())
: cap_id_invalid())) : cap_id_invalid()))
PERR("failed to set pager object for thread %s", label()); error("failed to set pager object for thread ", label());
_pager = pager; _pager = pager;
} }

View File

@ -16,7 +16,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
/* core includes */ /* core includes */
#include <ram_session_component.h> #include <ram_session_component.h>
@ -35,7 +35,7 @@ void Ram_session_component::_clear_ds (Dataspace_component * ds)
/* allocate range in core's virtual address space */ /* allocate range in core's virtual address space */
void *virt_addr; void *virt_addr;
if (!platform()->region_alloc()->alloc(page_rounded_size, &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", error("could not allocate virtual address range in core of size ",
page_rounded_size); page_rounded_size);
return; return;
} }
@ -43,7 +43,7 @@ void Ram_session_component::_clear_ds (Dataspace_component * ds)
/* map the dataspace's physical pages to corresponding virtual addresses */ /* map the dataspace's physical pages to corresponding virtual addresses */
size_t num_pages = page_rounded_size >> get_page_size_log2(); size_t num_pages = page_rounded_size >> get_page_size_log2();
if (!map_local(ds->phys_addr(), (addr_t)virt_addr, num_pages)) { 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; return;
} }
@ -59,7 +59,7 @@ void Ram_session_component::_clear_ds (Dataspace_component * ds)
/* unmap dataspace from core */ /* unmap dataspace from core */
if (!unmap_local((addr_t)virt_addr, num_pages)) 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 */ /* free core's virtual address space */
platform()->region_alloc()->free(virt_addr, page_rounded_size); platform()->region_alloc()->free(virt_addr, page_rounded_size);

View File

@ -39,15 +39,15 @@ void Thread::exception(unsigned const cpu)
return; return;
case UNDEFINED_INSTRUCTION: case UNDEFINED_INSTRUCTION:
if (_cpu->retry_undefined_instr(*this)) { return; } if (_cpu->retry_undefined_instr(*this)) { return; }
PWRN("%s -> %s: undefined instruction at ip=%p", Genode::warning(pd_label(), " -> ", label(), ": "
pd_label(), label(), (void*)ip); "undefined instruction at ip=", Genode::Hex(ip));
_stop(); _stop();
return; return;
case RESET: case RESET:
return; return;
default: default:
PWRN("%s -> %s: triggered an unknown exception %lu", Genode::warning(pd_label(), " -> ", label(), ": "
pd_label(), label(), (unsigned long)cpu_exception); "triggered an unknown exception ", cpu_exception);
_stop(); _stop();
return; return;
} }
@ -61,21 +61,24 @@ void Thread::_mmu_exception()
_fault_pd = (addr_t)_pd->platform_pd(); _fault_pd = (addr_t)_pd->platform_pd();
_fault_signal = (addr_t)_fault.signal_context(); _fault_signal = (addr_t)_fault.signal_context();
/** /*
* core should never raise a page-fault, * Core should never raise a page-fault. If this happens, print out an
* if this happens print out an error message with debug information * error message with debug information.
*/ */
if (_pd == Kernel::core_pd()) if (_pd == Kernel::core_pd())
PERR("Pagefault in core thread (%s): ip=%p fault=%p", Genode::error("page fault in core thread (", label(), "): "
label(), (void*)ip, (void*)_fault_addr); "ip=", Genode::Hex(ip), " fault=", Genode::Hex(_fault_addr));
_fault.submit(); _fault.submit();
return; return;
} }
PERR("%s -> %s: raised unhandled %s DFSR=0x%08x ISFR=0x%08x " Genode::error(pd_label(), " -> ", label(), ": raised unhandled ",
"DFAR=0x%08x ip=0x%08lx sp=0x%08lx", pd_label(), label(), cpu_exception == DATA_ABORT ? "data abort" : "prefetch abort", " "
cpu_exception == DATA_ABORT ? "data abort" : "prefetch abort", "DFSR=", Genode::Hex(Cpu::Dfsr::read()), " "
Cpu::Dfsr::read(), Cpu::Ifsr::read(), Cpu::Dfar::read(), ip, sp); "ISFR=", Genode::Hex(Cpu::Ifsr::read()), " "
"DFAR=", Genode::Hex(Cpu::Dfar::read()), " "
"ip=", Genode::Hex(ip), " "
"sp=", Genode::Hex(sp));
} }

View File

@ -11,6 +11,7 @@
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
*/ */
#include <base/log.h>
#include <assert.h> #include <assert.h>
#include <platform_pd.h> #include <platform_pd.h>
#include <kernel/vm.h> #include <kernel/vm.h>
@ -59,7 +60,7 @@ struct Kernel::Vm_irq : Kernel::Irq
Cpu_job & job = cpu_pool()->executing_cpu()->scheduled_job(); Cpu_job & job = cpu_pool()->executing_cpu()->scheduled_job();
Vm *vm = dynamic_cast<Vm*>(&job); Vm *vm = dynamic_cast<Vm*>(&job);
if (!vm) if (!vm)
PERR("VM timer interrupt while VM is not runnning!"); Genode::error("VM timer interrupt while VM is not runnning!");
else else
vm->inject_irq(_irq_nr); vm->inject_irq(_irq_nr);
} }

View File

@ -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), if (!create((void*)_ds.core_local_addr(), Capability_space::capid(handler),
cma->phys_addr(_table))) 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); _table->insert_translation(vm_addr, phys_addr, size, pflags, _tt_alloc);
return; return;
} catch(Allocator::Out_of_memory) { } catch(Allocator::Out_of_memory) {
PERR("Translation table needs to much RAM"); Genode::error("Translation table needs to much RAM");
} catch(...) { } catch(...) {
PERR("Invalid mapping %p -> %p (%zx)", (void*)phys_addr, Genode::error("Invalid mapping ", Genode::Hex(phys_addr), " -> ",
(void*)vm_addr, size); 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 */ /* get some aligned space for the translation table */
if (!cma->alloc_aligned(sizeof(Translation_table), (void**)&tt, if (!cma->alloc_aligned(sizeof(Translation_table), (void**)&tt,
Translation_table::ALIGNM_LOG2).ok()) { Translation_table::ALIGNM_LOG2).ok()) {
PERR("failed to allocate kernel object"); error("failed to allocate kernel object");
throw Root::Quota_exceeded(); throw Root::Quota_exceeded();
} }

View File

@ -13,6 +13,7 @@
/* Genode includes */ /* Genode includes */
#include <base/service.h> #include <base/service.h>
#include <base/heap.h>
/* Core includes */ /* Core includes */
#include <platform_services.h> #include <platform_services.h>

View File

@ -12,6 +12,12 @@
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
*/ */
/* Genode includes */
#include <base/log.h>
/* base-internal includes */
#include <base/internal/globals.h> /* init_log() */
/* core includes */ /* core includes */
#include <kernel/cpu.h> #include <kernel/cpu.h>
#include <kernel/kernel.h> #include <kernel/kernel.h>
@ -35,13 +41,15 @@ void Kernel::Cpu::init(Pic &pic, Kernel::Pd &core_pd, Genode::Board&)
fpu().init(); 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 * access to the Bios Data Area, which is available in the initial
* translation table set, but not in the final tables used after * translation table set, but not in the final tables used after
* Cr3::write(). * 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())); Cr3::write(Cr3::init((addr_t)core_pd.translation_table()));

View File

@ -24,13 +24,13 @@ void Kernel::Thread::_mmu_exception()
_fault_signal = (addr_t)_fault.signal_context(); _fault_signal = (addr_t)_fault.signal_context();
_fault_addr = Cpu::Cr2::read(); _fault_addr = Cpu::Cr2::read();
/** /*
* core should never raise a page-fault, * Core should never raise a page-fault. If this happens, print out an
* if this happens print out an error message with debug information * error message with debug information.
*/ */
if (_pd == Kernel::core_pd()) if (_pd == Kernel::core_pd())
PERR("Pagefault in core thread (%s): ip=%p fault=%p", Genode::error("page fault in core thread (", label(), "): "
label(), (void*)ip, (void*)_fault_addr); "ip=", Genode::Hex(ip), " fault=", Genode::Hex(_fault_addr));
_fault.submit(); _fault.submit();
return; return;

View File

@ -82,11 +82,11 @@ bool Platform::get_msi_params(const addr_t mmconf, addr_t &address,
struct Sinfo::Dev_info dev_info; struct Sinfo::Dev_info dev_info;
if (!sinfo()->get_dev_info(sid, &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; return false;
} }
if (!dev_info.msi_capable) { if (!dev_info.msi_capable) {
PERR("device 0x%x not configured for MSI", sid); error("device ", Hex(sid), " not configured for MSI");
return false; 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); address = Msi_address::to_msi_addr(dev_info.irte_start);
irq_number = dev_info.irq_start; irq_number = dev_info.irq_start;
PDBG("enabling MSI for device with SID 0x%x: IRTE %d, IRQ %d", log("enabling MSI for device with SID ", Hex(sid), ": "
sid, dev_info.irte_start, irq_number); "IRTE ", dev_info.irte_start, ", IRQ ", irq_number);
return true; return true;
} }
@ -110,7 +110,7 @@ Native_region * Platform::_ram_regions(unsigned const i)
if (!result.size) { if (!result.size) {
struct Sinfo::Memregion_info region; struct Sinfo::Memregion_info region;
if (!sinfo()->get_memregion_info("ram", &region)) { if (!sinfo()->get_memregion_info("ram", &region)) {
PERR("Unable to retrieve base-hw ram region"); error("Unable to retrieve base-hw ram region");
return 0; return 0;
} }

View File

@ -38,7 +38,7 @@ void Thread::start()
{ {
/* start thread with stack pointer at the top of stack */ /* start thread with stack pointer at the top of stack */
if (native_thread().platform_thread->start((void *)&_thread_start, stack_top())) if (native_thread().platform_thread->start((void *)&_thread_start, stack_top()))
PERR("failed to start thread"); error("failed to start thread");
} }

View File

@ -40,7 +40,7 @@ namespace Genode {
** Signal context ** ** 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(); _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"); 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; 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"); env()->parent()->upgrade(env()->pd_session_cap(), "ram_quota=8K");
} }
); );
@ -118,7 +118,7 @@ void Signal_receiver::block_for_signal()
{ {
/* wait for a signal */ /* wait for a signal */
if (Kernel::await_signal(Capability_space::capid(_cap))) { if (Kernel::await_signal(Capability_space::capid(_cap))) {
PERR("failed to receive signal"); Genode::error("failed to receive signal");
return; return;
} }
/* read signal data */ /* 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"); }

View File

@ -14,7 +14,7 @@
/* Genode includes */ /* Genode includes */
#include <base/thread.h> #include <base/thread.h>
#include <base/printf.h> #include <base/log.h>
#include <base/sleep.h> #include <base/sleep.h>
#include <base/env.h> #include <base/env.h>
#include <cpu_thread/client.h> #include <cpu_thread/client.h>
@ -58,7 +58,7 @@ void Thread::_init_platform_thread(size_t weight, Type type)
/* remap initial main-thread UTCB according to stack-area spec */ /* remap initial main-thread UTCB according to stack-area spec */
try { rm->attach_at(Hw::_main_thread_utcb_ds, utcb_new, utcb_size); } try { rm->attach_at(Hw::_main_thread_utcb_ds, utcb_new, utcb_size); }
catch(...) { catch(...) {
PERR("failed to re-map UTCB"); error("failed to re-map UTCB");
while (1) ; while (1) ;
} }
/* adjust initial object state in case of a main thread */ /* 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(); stack_virtual_size() - size - stack_area_virtual_base();
env_stack_area_region_map->attach_at(ds, dst, size); env_stack_area_region_map->attach_at(ds, dst, size);
} catch (...) { } catch (...) {
PERR("failed to attach userland stack"); error("failed to attach userland stack");
sleep_forever(); sleep_forever();
} }
/* start thread with its initial IP and aligned SP */ /* start thread with its initial IP and aligned SP */

View File

@ -118,13 +118,13 @@ namespace Genode {
Thread_state state() Thread_state state()
{ {
PDBG("Not implemented"); warning("Not implemented");
throw Cpu_thread::State_access_failed(); throw Cpu_thread::State_access_failed();
} }
void state(Thread_state) void state(Thread_state)
{ {
PDBG("Not implemented"); warning("Not implemented");
throw Cpu_thread::State_access_failed(); throw Cpu_thread::State_access_failed();
} }

View File

@ -13,7 +13,7 @@
/* Genode includes */ /* Genode includes */
#include <util/arg_string.h> #include <util/arg_string.h>
#include <base/printf.h> #include <base/log.h>
#include <base/snprintf.h> #include <base/snprintf.h>
/* core-local includes */ /* 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); int tmp_binary_fd = lx_open(filename, O_CREAT | O_EXCL | O_WRONLY, S_IRWXU);
if (tmp_binary_fd < 0) { if (tmp_binary_fd < 0) {
PERR("Could not create file '%s'", filename); error("Could not create file '", filename, "'");
return; /* XXX reflect error to client */ return; /* XXX reflect error to client */
} }
@ -205,6 +205,6 @@ void Native_pd_component::start(Capability<Dataspace> binary)
if (ds) if (ds)
_start(*ds); _start(*ds);
else else
PERR("failed to lookup binary to start"); error("failed to lookup binary to start");
}); });
}; };

View File

@ -173,7 +173,7 @@ namespace Genode {
* as well as in Genode processes. * as well as in Genode processes.
*/ */
if (socket_pair.server_sd != -1 || socket_pair.client_sd != -1) 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");
} }
} }

View File

@ -14,7 +14,7 @@
/* Genode includes */ /* Genode includes */
#include <util/token.h> #include <util/token.h>
#include <util/misc_math.h> #include <util/misc_math.h>
#include <base/printf.h> #include <base/log.h>
/* local includes */ /* local includes */
#include "platform_thread.h" #include "platform_thread.h"
@ -100,20 +100,19 @@ Platform_thread::~Platform_thread()
void Platform_thread::cancel_blocking() void Platform_thread::cancel_blocking()
{ {
PDBG("send cancel-blocking signal to %ld\n", _tid);
lx_tgkill(_pid, _tid, LX_SIGUSR1); lx_tgkill(_pid, _tid, LX_SIGUSR1);
} }
void Platform_thread::pause() void Platform_thread::pause()
{ {
PDBG("not implemented"); warning(__func__, "not implemented");
} }
void Platform_thread::resume() void Platform_thread::resume()
{ {
PDBG("not implemented"); warning(__func__, "not implemented");
} }

View File

@ -15,7 +15,7 @@
#define _INCLUDE__BASE__INTERNAL__REGION_REGISTRY_ #define _INCLUDE__BASE__INTERNAL__REGION_REGISTRY_
#include <dataspace/capability.h> #include <dataspace/capability.h>
#include <base/printf.h> #include <base/log.h>
namespace Genode { namespace Genode {
class Region; class Region;
@ -97,8 +97,7 @@ class Genode::Region_registry
if (!_map[i].used()) break; if (!_map[i].used()) break;
if (i == MAX_REGIONS) { if (i == MAX_REGIONS) {
PERR("maximum number of %d regions reached", error("maximum number of ", (unsigned)MAX_REGIONS, " regions reached");
MAX_REGIONS);
return -1; return -1;
} }

View File

@ -52,7 +52,7 @@ static inline void flush_stack_area()
int ret; int ret;
if ((ret = lx_munmap(base, size)) < 0) { if ((ret = lx_munmap(base, size)) < 0) {
PERR("%s: failed ret=%d", __func__, ret); error(__func__, ": failed ret=", ret);
throw Region_map::Region_conflict(); 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 */ /* reserve at local address failed - unmap incorrect mapping */
if (addr_in != addr_out) { if (addr_in != addr_out) {
lx_munmap((void *)addr_out, size); lx_munmap((void *)addr_out, size);
error(__func__, ": failed addr_in=", addr_in, " addr_out=", addr_out);
PERR("%s: failed addr_in=%p addr_out=%p ret=%ld)", __func__,
addr_in, addr_out, (long)addr_out);
throw Region_map::Region_conflict(); throw Region_map::Region_conflict();
} }

View File

@ -14,7 +14,7 @@
/* Genode includes */ /* Genode includes */
#include <base/env.h> #include <base/env.h>
#include <base/child.h> #include <base/child.h>
#include <base/printf.h> #include <base/log.h>
#include <linux_native_pd/client.h> #include <linux_native_pd/client.h>
/* base-internal includes */ /* base-internal includes */
@ -79,7 +79,7 @@ Child::Process::Process(Dataspace_capability elf_ds,
addr_t elf_addr; addr_t elf_addr;
try { elf_addr = local_rm.attach(elf_ds); } try { elf_addr = local_rm.attach(elf_ds); }
catch (Region_map::Attach_failed) { 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 */ /* setup ELF object and read program entry pointer */
Elf_binary elf(elf_addr); Elf_binary elf(elf_addr);
@ -97,7 +97,7 @@ Child::Process::Process(Dataspace_capability elf_ds,
if (dynamically_linked) { if (dynamically_linked) {
if (!ldso_ds.valid()) { 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(); throw Missing_dynamic_linker();
} }

View File

@ -98,8 +98,8 @@ addr_t Region_map_mmap::_reserve_local(bool use_local_addr,
if ((use_local_addr && addr_in != addr_out) if ((use_local_addr && addr_in != addr_out)
|| (((long)addr_out < 0) && ((long)addr_out > -4095))) { || (((long)addr_out < 0) && ((long)addr_out > -4095))) {
PERR("_reserve_local: lx_mmap failed (addr_in=%p,addr_out=%p/%ld)", error("_reserve_local: lx_mmap failed "
addr_in, addr_out, (long)addr_out); "(addr_in=", addr_in, ",addr_out=", addr_out, "/", (long)addr_out, ")");
throw Region_map::Region_conflict(); 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) if ((use_local_addr && addr_in != addr_out)
|| (((long)addr_out < 0) && ((long)addr_out > -4095))) { || (((long)addr_out < 0) && ((long)addr_out > -4095))) {
PERR("_map_local: lx_mmap failed (addr_in=%p,addr_out=%p/%ld) overmap=%d", error("_map_local: lx_mmap failed"
addr_in, addr_out, (long)addr_out, overmap); "(addr_in=", addr_in, ", addr_out=", addr_out, "/", (long)addr_out, ") "
"overmap=", overmap);
throw Region_map::Region_conflict(); 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 &region) void Region_map_mmap::_add_to_rmap(Region const &region)
{ {
if (_rmap.add_region(region) < 0) { 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(); 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 */ /* only support attach_at for sub RM sessions */
if (_sub_rm && !use_local_addr) { 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(); throw Out_of_metadata();
} }
if (offset < 0) { 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(); throw Region_conflict();
} }
@ -204,7 +205,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
* Case 4 * Case 4
*/ */
if (is_sub_rm_session(ds)) { 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(); throw Invalid_dataspace();
} }
@ -213,7 +214,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
* sub RM session * sub RM session
*/ */
if (region_size + (addr_t)local_addr > _size) { 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(); 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 * Detect if sub RM session is already attached
*/ */
if (rm->_base) { 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(); throw Out_of_metadata();
} }

View File

@ -12,7 +12,6 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h>
#include <base/log.h> #include <base/log.h>
#include <base/component.h> #include <base/component.h>
#include <linux_syscalls.h> #include <linux_syscalls.h>
@ -307,32 +306,32 @@ namespace Genode {
void wait_for_construction() void wait_for_construction()
{ {
PERR("wait_for_construction() called for an adopted thread"); error("wait_for_construction() called for an adopted thread");
} }
void constructed() void constructed()
{ {
PERR("constructed() called for an adopted thread"); error("constructed() called for an adopted thread");
} }
void wait_for_start() void wait_for_start()
{ {
PERR("wait_for_start() called for an adopted thread"); error("wait_for_start() called for an adopted thread");
} }
void started() void started()
{ {
PERR("started() called for an adopted thread"); error("started() called for an adopted thread");
} }
void wait_for_join() void wait_for_join()
{ {
PERR("wait_for_join() called for an adopted thread"); error("wait_for_join() called for an adopted thread");
} }
void joined() 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); int const ret = pthread_create(&meta_data->pt, 0, thread_start, meta_data);
if (ret) { if (ret) {
PERR("pthread_create failed (returned %d, errno=%d)", error("pthread_create failed (returned ", ret, ", errno=", errno, ")");
ret, errno);
destroy(env()->heap(), meta_data); destroy(env()->heap(), meta_data);
throw Out_of_stack_space(); throw Out_of_stack_space();
} }
@ -511,8 +509,8 @@ Thread::~Thread()
if (needs_join) { if (needs_join) {
int const ret = pthread_join(native_thread().meta_data->pt, 0); int const ret = pthread_join(native_thread().meta_data->pt, 0);
if (ret) if (ret)
PWRN("pthread_join unexpectedly returned with %d (errno=%d)", warning("pthread_join unexpectedly returned "
ret, errno); "with ", ret, " (errno=", errno, ")");
} }
Thread_meta_data_created *meta_data = Thread_meta_data_created *meta_data =

View File

@ -57,7 +57,7 @@ extern "C" void wait_for_continue(void);
char str[128]; \ char str[128]; \
Genode::snprintf(str, sizeof(str), \ Genode::snprintf(str, sizeof(str), \
ESC_ERR fmt ESC_END "\n", ##__VA_ARGS__); \ ESC_ERR fmt ESC_END "\n", ##__VA_ARGS__); \
Genode::raw((char const *)str); \ Genode::raw(Genode::Cstring(str)); \
} while (0) } while (0)

View File

@ -7,7 +7,7 @@
/* Genode includes */ /* Genode includes */
#include <base/component.h> #include <base/component.h>
#include <base/thread.h> #include <base/thread.h>
#include <base/printf.h> #include <base/log.h>
/* libc includes */ /* libc includes */
#include <sys/stat.h> #include <sys/stat.h>
@ -32,7 +32,7 @@ struct Thread : Genode::Thread_deprecated<STACK_SIZE>
struct stat buf; struct stat buf;
int ret = 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 * Let main thread procees
@ -56,13 +56,13 @@ struct Unexpected_errno_change { };
*/ */
void Component::construct(Genode::Env &env) 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); static Genode::Lock barrier(Genode::Lock::LOCKED);
int const orig_errno = errno; 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 */ /* create thread, which modifies its thread-local errno value */
static Thread thread(barrier); static Thread thread(barrier);
@ -70,14 +70,14 @@ void Component::construct(Genode::Env &env)
/* block until the thread performed a 'stat' syscall */ /* block until the thread performed a 'stat' syscall */
barrier.lock(); barrier.lock();
Genode::printf("main: after thread completed, errno=%d\n", errno); Genode::log("main: after thread completed, errno=", errno);
if (orig_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(); throw Unexpected_errno_change();
} }
Genode::printf("--- finished thread-local errno test ---\n"); Genode::log("--- finished thread-local errno test ---");
exit_status = 0; exit_status = 0;
env.ep().schedule_suspend(exit_on_suspended, nullptr); env.ep().schedule_suspend(exit_on_suspended, nullptr);
} }

View File

@ -14,7 +14,7 @@
/* Genode includes */ /* Genode includes */
#include <base/component.h> #include <base/component.h>
#include <base/thread.h> #include <base/thread.h>
#include <base/printf.h> #include <base/log.h>
/* libc includes */ /* libc includes */
#include <pthread.h> #include <pthread.h>
@ -31,7 +31,7 @@ static Genode::Lock *main_wait_lock()
static void *pthread_entry(void *) static void *pthread_entry(void *)
{ {
PINF("first message"); Genode::log("first message");
/* /*
* Without the lazy initialization of 'Thread' objects for threads * Without the lazy initialization of 'Thread' objects for threads
@ -42,7 +42,7 @@ static void *pthread_entry(void *)
* will appear in the LOG output. * will appear in the LOG output.
*/ */
PINF("second message"); Genode::log("second message");
main_wait_lock()->unlock(); main_wait_lock()->unlock();
return 0; return 0;
@ -61,7 +61,7 @@ Genode::size_t Component::stack_size() { return 16*1024*sizeof(long); }
*/ */
void Component::construct(Genode::Env &env) 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 */ /* create thread w/o Genode's thread API */
pthread_t pth; pthread_t pth;
@ -70,7 +70,7 @@ void Component::construct(Genode::Env &env)
/* wait until 'pthread_entry' finished */ /* wait until 'pthread_entry' finished */
main_wait_lock()->lock(); main_wait_lock()->lock();
Genode::printf("--- finished pthread IPC test ---\n"); Genode::log("--- finished pthread IPC test ---");
exit_status = 0; exit_status = 0;
env.ep().schedule_suspend(exit_on_suspended, nullptr); env.ep().schedule_suspend(exit_on_suspended, nullptr);
} }

View File

@ -12,7 +12,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <base/env.h> #include <base/env.h>
#include <base/sleep.h> #include <base/sleep.h>
#include <base/thread.h> #include <base/thread.h>
@ -57,18 +57,18 @@ int main()
size_t size(end - beg); size_t size(end - beg);
PLOG("blob region region [%016lx,%016lx) size=%zx", beg, end, size); log("blob region region ", Hex_range<addr_t>(beg, size), " size=", size);
/* RAM dataspace attachment overlapping binary */ /* RAM dataspace attachment overlapping binary */
try { try {
Ram_dataspace_capability ds(env()->ram_session()->alloc(size)); 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); env()->rm_session()->attach_at(ds, beg);
PERR("after RAM dataspace attach -- ERROR"); error("after RAM dataspace attach -- ERROR");
sleep_forever(); sleep_forever();
} catch (Region_map::Region_conflict) { } catch (Region_map::Region_conflict) {
PLOG("OK caught Region_conflict exception"); log("OK caught Region_conflict exception");
} }
/* empty managed dataspace overlapping binary */ /* empty managed dataspace overlapping binary */
@ -77,12 +77,12 @@ int main()
Region_map_client rm(rm_connection.create(size)); Region_map_client rm(rm_connection.create(size));
Dataspace_capability ds(rm.dataspace()); Dataspace_capability ds(rm.dataspace());
PLOG("before sub-RM dataspace attach"); log("before sub-RM dataspace attach");
env()->rm_session()->attach_at(ds, beg); env()->rm_session()->attach_at(ds, beg);
PERR("after sub-RM dataspace attach -- ERROR"); error("after sub-RM dataspace attach -- ERROR");
sleep_forever(); sleep_forever();
} catch (Region_map::Region_conflict) { } 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 */ /* sparsely populated managed dataspace in free VM area */
@ -94,14 +94,14 @@ int main()
Dataspace_capability ds(rm.dataspace()); 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; 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; char const val = *addr;
*addr = 0x55; *addr = 0x55;
PLOG("after touch (%x/%x)", val, *addr); log("after touch (", val, "/", *addr, ")");
} catch (Region_map::Region_conflict) { } catch (Region_map::Region_conflict) {
PERR("Caught Region_conflict exception -- ERROR"); error("Caught Region_conflict exception -- ERROR");
sleep_forever(); sleep_forever();
} }
} }

View File

@ -12,7 +12,7 @@
*/ */
#include <base/env.h> #include <base/env.h>
#include <base/printf.h> #include <base/log.h>
#include <ram_session/connection.h> #include <ram_session/connection.h>
#include <timer_session/connection.h> #include <timer_session/connection.h>
@ -23,31 +23,28 @@ static void test_linux_rmmap_bug()
using namespace Genode; using namespace Genode;
PLOG("line: %d", __LINE__); log("line: ", __LINE__);
Ram_connection ram; Ram_connection ram;
#if 1 /* transfer quota */ #if 1 /* transfer quota */
PLOG("line: %d", __LINE__); log("line: ", __LINE__);
ram.ref_account(env()->ram_session_cap()); ram.ref_account(env()->ram_session_cap());
env()->ram_session()->transfer_quota(ram.cap(), QUOTA); env()->ram_session()->transfer_quota(ram.cap(), QUOTA);
#endif #endif
PLOG("line: %d", __LINE__); log("line: ", __LINE__);
for (unsigned i = 0; i < ROUNDS; ++i) { for (unsigned i = 0; i < ROUNDS; ++i) {
Ram_dataspace_capability ds(ram.alloc(CHUNK)); 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() int main()
{ {
Genode::printf("--- test-rm_session_mmap started ---\n"); Genode::log("--- test-rm_session_mmap started ---");
// Timer::Connection timer;
// timer.msleep(1000);
test_linux_rmmap_bug(); test_linux_rmmap_bug();
} }

View File

@ -14,7 +14,7 @@
#ifndef _INCLUDE__NOVA__UTIL_H_ #ifndef _INCLUDE__NOVA__UTIL_H_
#define _INCLUDE__NOVA__UTIL_H_ #define _INCLUDE__NOVA__UTIL_H_
#include <base/printf.h> #include <base/log.h>
#include <base/thread.h> #include <base/thread.h>
__attribute__((always_inline)) __attribute__((always_inline))
@ -51,7 +51,8 @@ inline void request_event_portal(Genode::Native_capability const &cap,
utcb->crd_rcv = orig_crd; utcb->crd_rcv = orig_crd;
if (res) 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; utcb->crd_rcv = orig_crd;
if (res) 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_ */ #endif /* _INCLUDE__NOVA__UTIL_H_ */

View File

@ -12,7 +12,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
/* core includes */ /* core includes */
#include <core_region_map.h> #include <core_region_map.h>
@ -58,12 +58,12 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
throw Invalid_dataspace(); throw Invalid_dataspace();
if (use_local_addr) { if (use_local_addr) {
PERR("Parameter 'use_local_addr' not supported within core"); error("Parameter 'use_local_addr' not supported within core");
return nullptr; return nullptr;
} }
if (offset) { if (offset) {
PERR("Parameter 'offset' not supported within core"); error("Parameter 'offset' not supported within core");
return nullptr; return nullptr;
} }

View File

@ -17,7 +17,7 @@
#define _CORE__INCLUDE__NOVA_UTIL_H_ #define _CORE__INCLUDE__NOVA_UTIL_H_
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
/* NOVA includes */ /* NOVA includes */
#include <nova/syscalls.h> #include <nova/syscalls.h>
@ -26,8 +26,6 @@
#include <echo.h> #include <echo.h>
#include <util.h> #include <util.h>
enum { verbose_local_map = false };
/** /**
* Return boot CPU number. It is required if threads in core should be placed * Return boot CPU number. It is required if threads in core should be placed
* on the same CPU as the main thread. * 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()); Nova::uint8_t res = Nova::call(echo()->pt_sel());
if (res != Nova::NOVA_OK || utcb->msg_words() != 1 || !utcb->msg[0] || if (res != Nova::NOVA_OK || utcb->msg_words() != 1 || !utcb->msg[0] ||
utcb->msg_items() != 1) { 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", typedef Genode::Hex Hex;
src_crd.addr(), src_crd.order(), src_crd.type(), error("map_local failed ",
dst_crd.addr(), dst_crd.order(), dst_crd.type(), res, Hex(src_crd.addr()), ":", Hex(src_crd.order()), ":", Hex(src_crd.type()), "->",
utcb->msg_items(), utcb->msg_words(), utcb->msg[0], utcb, kern_pd); 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; return res > 0 ? res : -1;
} }
/* clear receive window */ /* clear receive window */
@ -136,10 +140,6 @@ inline int map_local(Nova::Utcb *utcb,
bool kern_pd = false, bool dma_mem = false, bool kern_pd = false, bool dma_mem = false,
bool write_combined = 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 Nova;
using namespace Genode; using namespace Genode;
@ -169,10 +169,6 @@ inline int map_local(Nova::Utcb *utcb,
if ((to_end - to_curr) < (1UL << order)) if ((to_end - to_curr) < (1UL << order))
order = log2(to_end - to_curr); 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, int const res = map_local(utcb,
Mem_crd((from_curr >> 12), order - get_page_size_log2(), permission), Mem_crd((from_curr >> 12), order - get_page_size_log2(), permission),
Mem_crd((to_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(); Genode::addr_t base = start >> get_page_size_log2();
if (start & (get_page_size() - 1)) { if (start & (get_page_size() - 1)) {
PERR("unmap failed - unaligned address specified"); error("unmap failed - unaligned address specified");
return; return;
} }
if (verbose_local_map)
PINF("Unmapping local: range 0x%lx+0x%zx", base, num_pages);
while (num_pages) { while (num_pages) {
unsigned char const base_bit = lsb_bit(base); unsigned char const base_bit = lsb_bit(base);
unsigned char const order_bit = min(log2(num_pages), 31U); 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); 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); unmap_local(crd, self);
num_pages -= 1UL << order; num_pages -= 1UL << order;

View File

@ -19,8 +19,6 @@
#include <platform_generic.h> #include <platform_generic.h>
#include <core_mem_alloc.h> #include <core_mem_alloc.h>
#include <base/printf.h>
namespace Genode { namespace Genode {
class Platform : public Platform_generic class Platform : public Platform_generic

View File

@ -52,12 +52,12 @@ namespace Genode {
inline void backtrace() inline void backtrace()
{ {
using namespace Genode; using namespace Genode;
printf("\nbacktrace\n"); log("\nbacktrace");
printf(" %p\n", __builtin_return_address(0)); log(" ", __builtin_return_address(0));
printf(" %p\n", __builtin_return_address(1)); log(" ", __builtin_return_address(1));
printf(" %p\n", __builtin_return_address(2)); log(" ", __builtin_return_address(2));
printf(" %p\n", __builtin_return_address(3)); log(" ", __builtin_return_address(3));
printf(" %p\n", __builtin_return_address(4)); log(" ", __builtin_return_address(4));
} }

View File

@ -14,7 +14,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
/* core includes */ /* core includes */
#include <irq_root.h> #include <irq_root.h>
@ -36,7 +36,7 @@ static bool irq_ctrl(Genode::addr_t irq_sel,
msi_addr, msi_data, sig_sel); msi_addr, msi_data, sig_sel);
if (res != Nova::NOVA_OK) 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 */ /* nova syscall interface specifies msi addr/data to be 32bit */
msi_addr = msi_addr & ~0U; msi_addr = msi_addr & ~0U;
@ -61,7 +61,7 @@ static void deassociate(Genode::addr_t irq_sel)
addr_t dummy1 = 0, dummy2 = 0; addr_t dummy1 = 0, dummy2 = 0;
if (!irq_ctrl(irq_sel, dummy1, dummy2, irq_sel)) 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() void Irq_object::ack_irq()
{ {
if (Nova::NOVA_OK != Nova::sm_ctrl(irq_sel(), Nova::SEMAPHORE_DOWN)) 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(), int ret = map_local((Nova::Utcb *)Thread::myself()->utcb(),
src, dst, MAP_FROM_KERNEL_TO_CORE); src, dst, MAP_FROM_KERNEL_TO_CORE);
if (ret) { if (ret) {
PERR("Getting IRQ from kernel failed - %u", irq); error("getting IRQ from kernel failed - ", irq);
throw Root::Unavailable(); 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()) { 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(); throw Root::Unavailable();
} }

View File

@ -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) void Pager_object::_page_fault_handler(addr_t pager_obj)
{ {
Ipc_pager ipc_pager; 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_thread = obj->client_thread();
const char * client_pd = obj->client_pd(); 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 */ /* region manager fault - to be handled */
if (ret == 1) { if (ret == 1) {
PDBG("page fault, pd '%s', thread '%s', cpu %u, ip=%lx, fault " log("page fault, ", fault_info);
"address=0x%lx", client_pd, client_thread, which_cpu(pager_thread),
ipc_pager.fault_ip(), ipc_pager.fault_addr());
utcb->set_msg_word(0); utcb->set_msg_word(0);
utcb->mtd = 0; utcb->mtd = 0;
@ -121,10 +148,7 @@ void Pager_object::_page_fault_handler(addr_t pager_obj)
/* unhandled case */ /* unhandled case */
obj->_state.mark_dead(); obj->_state.mark_dead();
PWRN("unresolvable page fault, pd '%s', thread '%s', cpu %u, ip=%lx, " warning("unresolvable page fault, ", fault_info, " ret=", ret);
"fault address=0x%lx ret=%u", client_pd, client_thread,
which_cpu(pager_thread), ipc_pager.fault_ip(), ipc_pager.fault_addr(),
ret);
Native_capability pager_cap = obj->Object_pool<Pager_object>::Entry::cap(); Native_capability pager_cap = obj->Object_pool<Pager_object>::Entry::cap();
@ -165,11 +189,13 @@ void Pager_object::exception(uint8_t exit_id)
/* nobody handles this exception - so thread will be stopped finally */ /* nobody handles this exception - so thread will be stopped finally */
_state.mark_dead(); _state.mark_dead();
PWRN("unresolvable exception %u, pd '%s', thread '%s', cpu %u, " warning("unresolvable exception ", exit_id, ", "
"ip=0x%lx, %s", exit_id, client_pd(), client_thread(), "pd '", client_pd(), "', "
which_cpu(pager_thread), fault_ip, "thread '", client_thread(), "', "
res == 0xFF ? "no signal handler" : "cpu ", which_cpu(pager_thread), ", "
(res == NOVA_OK ? "" : "recall failed")); "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)); 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 snd(cap.base(), 0);
Obj_crd rcv(obj->_client_exc_vcpu + event * items_count + i, 0); Obj_crd rcv(obj->_client_exc_vcpu + event * items_count + i, 0);
if (map_local(utcb, snd, rcv)) 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); uint8_t res = sm_ctrl(sel_sm_block_pause(), SEMAPHORE_UP);
if (res != NOVA_OK) 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); uint8_t res = sm_ctrl(exc_pt_sel_client() + SM_SEL_EC, SEMAPHORE_UP);
if (res != NOVA_OK) if (res != NOVA_OK)
PWRN("canceling blocked client failed (thread sm)"); warning("canceling blocked client failed (thread sm)");
if (!_state.has_signal_sm()) if (!_state.has_signal_sm())
return; return;
res = sm_ctrl(exc_pt_sel_client() + PT_SEL_STARTUP, SEMAPHORE_UP); res = sm_ctrl(exc_pt_sel_client() + PT_SEL_STARTUP, SEMAPHORE_UP);
if (res != NOVA_OK) 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->set_msg_word(0);
utcb->mtd = 0; utcb->mtd = 0;
if (uint8_t res = call(sel_pt_cleanup())) 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(); unsigned use_cpu = obj->location.xpos();
if (!kernel_hip()->is_cpu_enabled(use_cpu) || !pager_threads[use_cpu]) { 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(); 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 */ /* ypos information not supported by now */
if (location.ypos()) { 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(); throw Region_map::Invalid_thread();
} }
/* place Pager_object on specified CPU by selecting proper pager thread */ /* place Pager_object on specified CPU by selecting proper pager thread */
unsigned use_cpu = location.xpos(); unsigned use_cpu = location.xpos();
if (!kernel_hip()->is_cpu_enabled(use_cpu) || !pager_threads[use_cpu]) { 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(); 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), res = create_portal(sel_pt_cleanup(), pd_sel, ec_sel, Mtd(0),
reinterpret_cast<addr_t>(_invoke_handler), this); reinterpret_cast<addr_t>(_invoke_handler), this);
if (res != Nova::NOVA_OK) { 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(); 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 */ /* request current kernel quota usage of source pd */
Nova::pd_ctrl_debug(transfer_from, limit_source, usage_source); Nova::pd_ctrl_debug(transfer_from, limit_source, usage_source);
PINF("oom - '%s':'%s' (%lu/%lu) - transfer %u pages from '%s':'%s' " log("oom - '", dst_pd, "':'", dst_thread, "' "
"(%lu/%lu)", dst_pd, dst_thread, "(", usage_before, "/", limit_before, ") - "
usage_before, limit_before, QUOTA_TRANSFER_PAGES, "transfer ", (long)QUOTA_TRANSFER_PAGES, " pages "
src_pd, src_thread, usage_source, limit_source); "from '", src_pd, "':'", src_thread, "' "
"(", usage_source, "/", limit_source, ")");
} }
uint8_t res = Nova::NOVA_PD_OOM; 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 " warning("kernel memory quota upgrade failed - trigger memory free up for "
"causing '%s':'%s' - donator is '%s':'%s', policy=%u", "causing '", dst_pd, "':'", dst_thread, "' - "
dst_pd, dst_thread, src_pd, src_thread, policy); "donator is '", src_pd, "':'", src_thread, "', "
"policy=", (int)policy);
/* if nothing helps try to revoke memory */ /* if nothing helps try to revoke memory */
enum { REMOTE_REVOKE = true, PD_SELF = true }; 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(); assert |= utcb->msg_words();
if (assert) { if (assert) {
PERR("unknown OOM case - stop core pager thread"); error("unknown OOM case - stop core pager thread");
utcb->set_msg_word(0); utcb->set_msg_word(0);
reply(myself->stack_top(), myself->native_thread().exc_pt_sel + Nova::SM_SEL_EC); 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 */ /* be strict in case of the -strict- STOP policy - stop causing thread */
if (policy == STOP) { 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); utcb->set_msg_word(0);
reply(myself->stack_top(), obj_dst->sel_sm_block_pause()); 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) { switch (pager_src) {
case SRC_PD_UNKNOWN: case SRC_PD_UNKNOWN:
/* should not happen on Genode - we create and know every PD in core */ /* 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); utcb->set_msg_word(0);
reply(myself->stack_top(), myself->native_thread().exc_pt_sel + Nova::SM_SEL_EC); 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); utcb->set_msg_word(0);
if (res != Nova::NOVA_PD_OOM) if (res != Nova::NOVA_PD_OOM)
PERR("Upgrading kernel memory failed, policy %u, error %u " error("upgrading kernel memory failed, policy ", (int)policy, ", "
"- stop thread finally", policy, res); "error ", (int)res, " - stop thread finally");
/* else: caller will get blocked until RCU period is over */ /* else: caller will get blocked until RCU period is over */
/* block caller in semaphore */ /* block caller in semaphore */
@ -843,7 +872,7 @@ addr_t Pager_object::get_oom_portal()
return pt_oom; return pt_oom;
} }
PERR("creating portal for out of memory notification failed"); error("creating portal for out of memory notification failed");
return 0; return 0;
} }
@ -889,10 +918,10 @@ void Pager_activation_base::entry() { }
Pager_entrypoint::Pager_entrypoint(Rpc_cap_factory &cap_factory) Pager_entrypoint::Pager_entrypoint(Rpc_cap_factory &cap_factory)
: _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) { if (kernel_hip()->cpu_max() > PAGER_CPUS) {
PERR("kernel supports more CPUs (%u) than Genode (%u)", error("kernel supports more CPUs (", kernel_hip()->cpu_max(), ") "
kernel_hip()->cpu_max(), PAGER_CPUS); "than Genode (", (unsigned)PAGER_CPUS, ")");
nova_die(); nova_die();
} }
@ -916,7 +945,7 @@ Pager_capability Pager_entrypoint::manage(Pager_object *obj)
/* let handle pager_object of pager thread on same CPU */ /* let handle pager_object of pager thread on same CPU */
unsigned use_cpu = obj->location.xpos(); unsigned use_cpu = obj->location.xpos();
if (!kernel_hip()->is_cpu_enabled(use_cpu) || !pager_threads[use_cpu]) { 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(); return Pager_capability();
} }
Native_capability pager_thread_cap = Native_capability pager_thread_cap =

View File

@ -14,7 +14,6 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h>
#include <base/sleep.h> #include <base/sleep.h>
#include <base/thread.h> #include <base/thread.h>
#include <base/snprintf.h> #include <base/snprintf.h>
@ -30,6 +29,7 @@
/* base-internal includes */ /* base-internal includes */
#include <base/internal/stack_area.h> #include <base/internal/stack_area.h>
#include <base/internal/native_utcb.h> #include <base/internal/native_utcb.h>
#include <base/internal/globals.h>
/* NOVA includes */ /* NOVA includes */
#include <nova/syscalls.h> #include <nova/syscalls.h>
@ -124,8 +124,7 @@ static void page_fault_handler()
(pf_type & Ipc_pager::ERR_W) ? Region_map::State::WRITE_FAULT (pf_type & Ipc_pager::ERR_W) ? Region_map::State::WRITE_FAULT
: Region_map::State::READ_FAULT, 0); : Region_map::State::READ_FAULT, 0);
printf("\nstack pointer 0x%lx, qualifiers 0x%lx %s%s%s%s%s\n", log("\nstack pointer ", Hex(pf_sp), ", qualifiers ", Hex(pf_type), " ",
pf_sp, pf_type,
pf_type & Ipc_pager::ERR_I ? "I" : "i", pf_type & Ipc_pager::ERR_I ? "I" : "i",
pf_type & Ipc_pager::ERR_R ? "R" : "r", pf_type & Ipc_pager::ERR_R ? "R" : "r",
pf_type & Ipc_pager::ERR_U ? "U" : "u", pf_type & Ipc_pager::ERR_U ? "U" : "u",
@ -144,8 +143,7 @@ static void page_fault_handler()
Nova::Utcb * utcb_fault = reinterpret_cast<Nova::Utcb *>(utcb_addr_f); Nova::Utcb * utcb_fault = reinterpret_cast<Nova::Utcb *>(utcb_addr_f);
unsigned last_items = utcb_fault->msg_items(); unsigned last_items = utcb_fault->msg_items();
printf("faulter utcb %p, last message item count %u\n", log("faulter utcb ", utcb_fault, ", last message item count ", last_items);
utcb_fault, last_items);
for (unsigned i = 0; i < last_items; i++) { for (unsigned i = 0; i < last_items; i++) {
Nova::Utcb::Item * item = utcb_fault->get_item(i); Nova::Utcb::Item * item = utcb_fault->get_item(i);
@ -156,11 +154,13 @@ static void page_fault_handler()
if (crd.is_null()) if (crd.is_null())
continue; continue;
printf("%u - type=%x rights=0x%x region=0x%lx+0x%lx " log(i, " - "
"hotspot %lx(%lx) - %s\n", i, crd.type(), crd.rights(), "type=", Hex(crd.type()), " "
crd.addr(), 1UL << (12 +crd.order()), "rights=", Hex(crd.rights()), " "
crd.hotspot(item->hotspot), item->hotspot, "region=", Hex(crd.addr()), "+", Hex(1UL << (12 + crd.order())), " "
item->is_del() ? "delegated" : "translated"); "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; 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); Core_img dump(pf_sp);
while (dump.ip_valid()) { 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(); dump.next_ip();
} }
@ -237,7 +239,7 @@ static void init_core_page_fault_handler()
CORE_PAGER_UTCB_ADDR, core_pager_stack_top(), CORE_PAGER_UTCB_ADDR, core_pager_stack_top(),
EXC_BASE, GLOBAL); EXC_BASE, GLOBAL);
if (ret) if (ret)
PDBG("create_ec returned %u", ret); log(__func__, ": create_ec returned ", ret);
/* set up page-fault portal */ /* set up page-fault portal */
create_pt(PT_SEL_PAGE_FAULT, __core_pd_sel, ec_sel, 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... * Now that we can access the I/O ports for comport 0, printf works...
*/ */
init_log();
/* /*
* remap main utcb to default utcb address * remap main utcb to default utcb address
@ -316,26 +319,26 @@ Platform::Platform() :
*/ */
if (map_local(__main_thread_utcb, (addr_t)__main_thread_utcb, if (map_local(__main_thread_utcb, (addr_t)__main_thread_utcb,
(addr_t)main_thread_utcb(), 1, Rights(true, true, false))) { (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(); nova_die();
} }
/* sanity checks */ /* sanity checks */
if (hip->sel_exc + 3 > NUM_INITIAL_PT_RESERVED) { if (hip->sel_exc + 3 > NUM_INITIAL_PT_RESERVED) {
printf("configuration error\n"); error("configuration error (NUM_INITIAL_PT_RESERVED)");
nova_die(); nova_die();
} }
/* map idle SCs */ /* map idle SCs */
unsigned const log2cpu = log2(hip->cpu_max()); unsigned const log2cpu = log2(hip->cpu_max());
if ((1U << log2cpu) != 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(); nova_die();
} }
sc_idle_base = cap_map()->insert(log2cpu + 1); sc_idle_base = cap_map()->insert(log2cpu + 1);
if (sc_idle_base & ((1UL << 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(); nova_die();
} }
if(map_local(__main_thread_utcb, Obj_crd(0, log2cpu), 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); uint8_t res = Nova::sc_ctrl(sc_idle_base + i, n_time);
if (res != Nova::NOVA_OK) { if (res != Nova::NOVA_OK) {
sc_init = false; sc_init = false;
printf("%u %u %llu - failed\n", i, res, n_time); error(i, " ", res, " ", n_time, " - failed");
} }
} }
if (!sc_init) if (!sc_init)
@ -371,13 +374,13 @@ Platform::Platform() :
if (verbose_boot_info) { if (verbose_boot_info) {
if (hip->has_feature_vmx()) if (hip->has_feature_vmx())
printf("Hypervisor features VMX\n"); log("Hypervisor features VMX");
if (hip->has_feature_svm()) if (hip->has_feature_svm())
printf("Hypervisor features SVM\n"); log("Hypervisor features SVM");
printf("Hypervisor reports %ux%u CPU%c - boot CPU is %lu\n", log("Hypervisor reports ", _cpus.width(), "x", _cpus.height(), " "
_cpus.width(), _cpus.height(), _cpus.total() > 1 ? 's' : ' ', boot_cpu()); "CPU", _cpus.total() > 1 ? "s" : " ", " - boot CPU is ", boot_cpu());
if (!cpuid_invariant_tsc()) if (!cpuid_invariant_tsc())
PWRN("CPU has no invariant TSC."); warning("CPU has no invariant TSC.");
} }
/* initialize core allocators */ /* initialize core allocators */
@ -385,7 +388,7 @@ Platform::Platform() :
/ hip->mem_desc_size; / hip->mem_desc_size;
if (verbose_boot_info) 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); 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] && if (stack_area_virtual_base() <= check[i] &&
check[i] < stack_area_virtual_base() + stack_area_virtual_size()) check[i] < stack_area_virtual_base() + stack_area_virtual_size())
{ {
PERR("overlapping area - [%lx, %lx) vs %lx", error("overlapping area - ",
stack_area_virtual_base(), stack_area_virtual_base() + Hex_range<addr_t>(stack_area_virtual_base(),
stack_area_virtual_size(), check[i]); stack_area_virtual_size()), " vs ",
Hex(check[i]));
nova_die(); nova_die();
} }
} }
@ -447,9 +451,12 @@ Platform::Platform() :
for (unsigned i = 0; i < num_mem_desc; i++, mem_desc++) { for (unsigned i = 0; i < num_mem_desc; i++, mem_desc++) {
if (mem_desc->type != Hip::Mem_desc::AVAILABLE_MEMORY) continue; if (mem_desc->type != Hip::Mem_desc::AVAILABLE_MEMORY) continue;
if (verbose_boot_info) if (verbose_boot_info) {
printf("detected physical memory: 0x%16llx - size: 0x%llx\n", addr_t const base = mem_desc->addr;
mem_desc->addr, mem_desc->size); 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; if (!mem_desc->size) continue;
@ -465,7 +472,8 @@ Platform::Platform() :
size = trunc_page(mem_desc->addr + mem_desc->size) - base; size = trunc_page(mem_desc->addr + mem_desc->size) - base;
if (verbose_boot_info) 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); _io_mem_alloc.remove_range(base, size);
ram_alloc()->add_range(base, size); ram_alloc()->add_range(base, size);
@ -538,10 +546,11 @@ Platform::Platform() :
(mem_d->addr >= mem_desc->addr + mem_desc->size)) (mem_d->addr >= mem_desc->addr + mem_desc->size))
continue; continue;
PERR("region overlap [0x%8llx+0x%8llx] (%d) with " error("region overlap ",
"[0x%8llx+0x%8llx] (%d)", Hex_range<addr_t>(mem_desc->addr, mem_desc->size), " "
mem_desc->addr, mem_desc->size, mem_desc->type, "(", (int)mem_desc->type, ") with ",
mem_d->addr, mem_d->size, mem_d->type); Hex_range<addr_t>(mem_d->addr, mem_d->size), " "
"(", (int)mem_d->type, ")");
nova_die(); nova_die();
} }
} }
@ -579,18 +588,14 @@ Platform::Platform() :
addr_t core_local_addr = _map_pages(rom_mem_start >> get_page_size_log2(), addr_t core_local_addr = _map_pages(rom_mem_start >> get_page_size_log2(),
pages_mapped); pages_mapped);
if (!core_local_addr) { if (!core_local_addr) {
PERR("could not map multi boot module"); error("could not map multi boot module");
nova_die(); nova_die();
} }
/* adjust core_local_addr of module if it was not page aligned */ /* adjust core_local_addr of module if it was not page aligned */
core_local_addr += mem_desc->addr - rom_mem_start; core_local_addr += mem_desc->addr - rom_mem_start;
if (verbose_boot_info) char *name = nullptr;
printf("map multi-boot module: physical 0x%8lx+0x%8llx"
" - ", (addr_t)mem_desc->addr, mem_desc->size);
char * name;
if (aux_in_rom_area) { if (aux_in_rom_area) {
aux = core_local_addr + (mem_desc->aux - mem_desc->addr); aux = core_local_addr + (mem_desc->aux - mem_desc->addr);
aux_len = strlen(reinterpret_cast<char const *>(aux)) + 1; aux_len = strlen(reinterpret_cast<char const *>(aux)) + 1;
@ -629,7 +634,7 @@ Platform::Platform() :
prev_cmd_line_page = curr_cmd_line_page; prev_cmd_line_page = curr_cmd_line_page;
if (!mapped_cmd_line) { if (!mapped_cmd_line) {
PERR("could not map command line"); error("could not map command line");
nova_die(); nova_die();
} }
} }
@ -646,7 +651,11 @@ Platform::Platform() :
memset(reinterpret_cast<void *>(zero_out), 0, round_page(zero_out) - memset(reinterpret_cast<void *>(zero_out), 0, round_page(zero_out) -
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 */ /* revoke mapping of rom module - not needed */
unmap_local(__main_thread_utcb, trunc_page(core_local_addr), 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; _gsi_base_sel = (hip->mem_desc_offset - hip->cpu_desc_offset) / hip->cpu_desc_size;
if (verbose_boot_info) { if (verbose_boot_info) {
printf(":virt_alloc: "); (*_core_mem_alloc.virt_alloc())()->dump_addr_tree(); log(":virt_alloc: "); (*_core_mem_alloc.virt_alloc())()->dump_addr_tree();
printf(":phys_alloc: "); (*_core_mem_alloc.phys_alloc())()->dump_addr_tree(); log(":phys_alloc: "); (*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
printf(":io_mem_alloc: "); _io_mem_alloc()->dump_addr_tree(); log(":io_mem_alloc: "); _io_mem_alloc()->dump_addr_tree();
} }
/* add capability selector ranges to map */ /* add capability selector ranges to map */
@ -706,13 +715,6 @@ Platform::Platform() :
cap_map()->insert(range); 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(); index = range->base() + range->elements();
} }

View File

@ -12,7 +12,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <util/flex_iterator.h> #include <util/flex_iterator.h>
/* core includes */ /* core includes */
@ -35,7 +35,7 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
void Platform_pd::unbind_thread(Platform_thread *thread) void Platform_pd::unbind_thread(Platform_thread *thread)
{ {
PDBG("not implemented"); warning(__func__, "not implemented");
} }

View File

@ -14,7 +14,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
/* core includes */ /* core includes */
#include <ipc_pager.h> #include <ipc_pager.h>
@ -39,7 +39,7 @@ using namespace Genode;
void Platform_thread::affinity(Affinity::Location location) 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; using namespace Nova;
if (!_pager) { if (!_pager) {
PERR("pager undefined"); error("pager undefined");
return -1; return -1;
} }
if (!_pd || (main_thread() && !vcpu() && if (!_pd || (main_thread() && !vcpu() &&
_pd->parent_pt_sel() == Native_thread::INVALID_INDEX)) { _pd->parent_pt_sel() == Native_thread::INVALID_INDEX)) {
PERR("protection domain undefined"); error("protection domain undefined");
return -2; return -2;
} }
addr_t const pt_oom = _pager->get_oom_portal(); addr_t const pt_oom = _pager->get_oom_portal();
if (!pt_oom || map_local((Utcb *)Thread::myself()->utcb(), if (!pt_oom || map_local((Utcb *)Thread::myself()->utcb(),
Obj_crd(pt_oom, 0), Obj_crd(_sel_pt_oom(), 0))) { 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; return -8;
} }
@ -73,7 +73,7 @@ int Platform_thread::start(void *ip, void *sp)
addr_t const utcb = vcpu() ? 0 : round_page(initial_sp); addr_t const utcb = vcpu() ? 0 : round_page(initial_sp);
if (_sel_exc_base == Native_thread::INVALID_INDEX) { if (_sel_exc_base == Native_thread::INVALID_INDEX) {
PERR("exception base not specified"); error("exception base not specified");
return -3; return -3;
} }
@ -85,7 +85,7 @@ int Platform_thread::start(void *ip, void *sp)
utcb, initial_sp, _sel_exc_base, !worker()); utcb, initial_sp, _sel_exc_base, !worker());
if (res == Nova::NOVA_PD_OOM && Nova::NOVA_OK != _pager->handle_oom()) { if (res == Nova::NOVA_PD_OOM && Nova::NOVA_OK != _pager->handle_oom()) {
_pager->assign_pd(Native_thread::INVALID_INDEX); _pager->assign_pd(Native_thread::INVALID_INDEX);
PERR("creation of new thread failed %u", res); error("creation of new thread failed ", res);
return -4; return -4;
} }
} while (res != Nova::NOVA_OK); } 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) { if (_sel_exc_base != Native_thread::INVALID_INDEX) {
PERR("thread already started"); error("thread already started");
return -5; 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, uint8_t res = create_pd(pd_sel, pd_core_sel, initial_pts,
KEEP_FREE_PAGES_NOT_AVAILABLE_FOR_UPGRADE, UPPER_LIMIT_PAGES); KEEP_FREE_PAGES_NOT_AVAILABLE_FOR_UPGRADE, UPPER_LIMIT_PAGES);
if (res != NOVA_OK) { if (res != NOVA_OK) {
PERR("create_pd returned %d", res); error("create_pd returned ", res);
goto cleanup_pd; 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, res = create_ec(_sel_ec(), pd_sel, _location.xpos(), pd_utcb, 0, 0,
THREAD_GLOBAL); THREAD_GLOBAL);
if (res != NOVA_OK) { if (res != NOVA_OK) {
PERR("create_ec returned %d", res); error("create_ec returned ", res);
goto cleanup_pd; goto cleanup_pd;
} }
@ -179,7 +179,7 @@ int Platform_thread::start(void *ip, void *sp)
_pager->initial_esp(0); _pager->initial_esp(0);
_pager->assign_pd(Native_thread::INVALID_INDEX); _pager->assign_pd(Native_thread::INVALID_INDEX);
PERR("create_sc returned %d", res); error("create_sc returned ", res);
goto cleanup_ec; goto cleanup_ec;
} }
@ -214,8 +214,7 @@ void Platform_thread::resume()
uint8_t res; uint8_t res;
do { do {
if (!_pd) { if (!_pd) {
PERR("protection domain undefined %s - resuming thread failed", error("protection domain undefined - resuming thread failed");
__PRETTY_FUNCTION__);
return; return;
} }
res = create_sc(_sel_sc(), _pd->pd_sel(), _sel_ec(), res = create_sc(_sel_sc(), _pd->pd_sel(), _sel_ec(),
@ -305,7 +304,7 @@ const char * Platform_thread::pd_name() const {
Weak_ptr<Address_space> Platform_thread::address_space() Weak_ptr<Address_space> Platform_thread::address_space()
{ {
if (!_pd) { if (!_pd) {
PERR("protection domain undefined %s", __PRETTY_FUNCTION__); error(__PRETTY_FUNCTION__, ": protection domain undefined");
return Weak_ptr<Address_space>(); return Weak_ptr<Address_space>();
} }
return _pd->Address_space::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); uint8_t res = Nova::sc_ctrl(_sel_sc(), time);
if (res != Nova::NOVA_OK) if (res != Nova::NOVA_OK)
PDBG("sc_ctrl failed res=%x", res); warning("sc_ctrl failed res=", res);
return time; return time;
} }
@ -341,12 +340,12 @@ Platform_thread::Platform_thread(size_t, const char *name, unsigned prio,
_name(name) _name(name)
{ {
if (_priority == 0) { 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; _priority = 1;
} }
if (_priority > Nova::Qpd::DEFAULT_PRIORITY) { if (_priority > Nova::Qpd::DEFAULT_PRIORITY) {
PWRN("priority of thread '%s' above maximum - limit to %u", warning("priority of thread '", _name, "' above maximum - limit to ",
_name.string(), Nova::Qpd::DEFAULT_PRIORITY); (unsigned)Nova::Qpd::DEFAULT_PRIORITY);
_priority = Nova::Qpd::DEFAULT_PRIORITY; _priority = Nova::Qpd::DEFAULT_PRIORITY;
} }
} }

View File

@ -12,7 +12,6 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h>
#include <base/thread.h> #include <base/thread.h>
/* core includes */ /* core includes */

View File

@ -43,8 +43,12 @@ Native_capability Rpc_cap_factory::alloc(Native_capability ep, addr_t entry, add
if (res == NOVA_OK) if (res == NOVA_OK)
return Capability_space::import(pt_sel); return Capability_space::import(pt_sel);
PERR("cap_session - cap=%lx:%lx addr=%lx mtd=%lx xpt=%lx res=%u", error("cap alloc - "
ec_sel, ep.local_name(), entry, mtd, pt_sel, res); "cap=", Hex(ec_sel), ":", Hex(ep.local_name()), " "
"entry=", Hex(entry), " "
"mtd=", Hex(mtd), " "
"xpt=", Hex(pt_sel), " "
"res=", res);
_list.remove(pt_cap); _list.remove(pt_cap);
destroy(&_slab, pt_cap); destroy(&_slab, pt_cap);
@ -72,7 +76,7 @@ void Rpc_cap_factory::free(Native_capability cap)
return; return;
} }
} }
PDBG("invalid cap object"); warning("attempt to free invalid cap object");
} }

View File

@ -15,7 +15,7 @@
/* Genode includes */ /* Genode includes */
#include <base/thread.h> #include <base/thread.h>
#include <base/printf.h> #include <base/log.h>
/* base-internal includes */ /* base-internal includes */
#include <base/internal/stack.h> #include <base/internal/stack.h>
@ -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; addr_t rs_sel =native_thread().exc_pt_sel + SM_SEL_EC;
uint8_t res = create_sm(rs_sel, pd_sel, 0); uint8_t res = create_sm(rs_sel, pd_sel, 0);
if (res != NOVA_OK) { if (res != NOVA_OK) {
PERR("create_sm returned %u", res); error("create_sm returned ", res);
throw Cpu_session::Thread_creation_failed(); 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(), uint8_t res = create_ec(native_thread().ec_sel, pd_sel, location.xpos(),
utcb, sp, native_thread().exc_pt_sel, LOCAL_THREAD); utcb, sp, native_thread().exc_pt_sel, LOCAL_THREAD);
if (res != NOVA_OK) { 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(); throw Cpu_session::Thread_creation_failed();
} }
@ -116,7 +116,7 @@ void Thread::start()
if (map_local(reinterpret_cast<Nova::Utcb *>(Thread::myself()->utcb()), if (map_local(reinterpret_cast<Nova::Utcb *>(Thread::myself()->utcb()),
Obj_crd(PT_SEL_PAGE_FAULT, 0), Obj_crd(PT_SEL_PAGE_FAULT, 0),
Obj_crd(native_thread().exc_pt_sel + 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(); throw Cpu_session::Thread_creation_failed();
} }
} }

View File

@ -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; size_t num_data_words = num_msg_words - 1;
if (num_data_words*sizeof(mword_t) > rcv_msg.capacity()) { if (num_data_words*sizeof(mword_t) > rcv_msg.capacity()) {
PERR("receive message buffer too small msg size=%zx, buf size=%zd", error("receive message buffer too small msg "
num_data_words*sizeof(mword_t), rcv_msg.capacity()); "size=", num_data_words*sizeof(mword_t), " "
"buf size=", rcv_msg.capacity());
num_data_words = rcv_msg.capacity()/sizeof(mword_t); 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 }; enum { NUM_MSG_REGS = 256 };
if (num_msg_words > NUM_MSG_REGS) { 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; num_msg_words = NUM_MSG_REGS;
} }

View File

@ -90,7 +90,7 @@ namespace Genode {
/* block on semaphore until signal context was submitted */ /* block on semaphore until signal context was submitted */
if (uint8_t res = si_ctrl(_sem.local_name(), SEMAPHORE_DOWN, if (uint8_t res = si_ctrl(_sem.local_name(), SEMAPHORE_DOWN,
imprint, count)) imprint, count))
PWRN("signal reception failed - error %u", res); warning("signal reception failed - error ", res);
} while (imprint == 0); } while (imprint == 0);

View File

@ -12,7 +12,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
/* NOVA includes */ /* NOVA includes */
#include <nova/syscalls.h> #include <nova/syscalls.h>
@ -55,8 +55,7 @@ void Cap_range::inc(unsigned id)
} }
if (failure) if (failure)
PERR("cap reference counting error - reference overflow of cap=%lx", error("cap reference counting error - reference overflow of cap=", _base + id);
_base + id);
} }
@ -82,8 +81,9 @@ void Cap_range::dec(unsigned const id_start, bool revoke, unsigned num_log_2)
} }
if (failure) if (failure)
PERR("cap reference counting error - one counter of cap range %lx+%x " error("cap reference counting error - one counter of cap ",
"has been already zero", _base + id_start, 1 << num_log_2); "range ", _base + id_start, "+", 1 << num_log_2, " "
"has been already zero");
} }

View File

@ -11,8 +11,6 @@
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
*/ */
#include <base/printf.h>
/* base-internal includes */ /* base-internal includes */
#include <base/internal/capability_data.h> #include <base/internal/capability_data.h>

View File

@ -14,7 +14,7 @@
/* Genode includes */ /* Genode includes */
#include <base/ipc.h> #include <base/ipc.h>
#include <base/thread.h> #include <base/thread.h>
#include <base/printf.h> #include <base/log.h>
/* base-internal includes */ /* base-internal includes */
#include <base/internal/ipc.h> #include <base/internal/ipc.h>
@ -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 */ /* the protocol value is unused as the badge is delivered by the kernel */
if (!copy_msgbuf_to_utcb(utcb, snd_msg, 0)) { if (!copy_msgbuf_to_utcb(utcb, snd_msg, 0)) {
PERR("could not setup IPC"); error("could not setup IPC");
throw Ipc_error(); throw Ipc_error();
} }

View File

@ -14,7 +14,6 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h>
#include <base/rpc_server.h> #include <base/rpc_server.h>
#include <base/env.h> #include <base/env.h>
@ -94,8 +93,7 @@ void Rpc_entrypoint::_dissolve(Rpc_object_base *obj)
utcb->msg[0] = 0xdead; utcb->msg[0] = 0xdead;
utcb->set_msg_word(1); utcb->set_msg_word(1);
if (uint8_t res = call(_cap.local_name())) if (uint8_t res = call(_cap.local_name()))
PERR("%8p - could not clean up entry point of thread 0x%p - res %u", error(utcb, " - could not clean up entry point of thread ", this->utcb(), " - res ", res);
utcb, this->utcb(), res);
} }
@ -140,7 +138,7 @@ void Rpc_entrypoint::_activation_entry()
/* in case of a portal cleanup call we are done here - just reply */ /* in case of a portal cleanup call we are done here - just reply */
if (ep._cap.local_name() == (long)id_pt) { if (ep._cap.local_name() == (long)id_pt) {
if (!rcv_window.prepare_rcv_window(utcb)) 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(); ep._rcv_buf.reset();
reply(utcb, exc, ep._snd_buf); reply(utcb, exc, ep._snd_buf);
@ -153,8 +151,7 @@ void Rpc_entrypoint::_activation_entry()
/* atomically lookup and lock referenced object */ /* atomically lookup and lock referenced object */
auto lambda = [&] (Rpc_object_base *obj) { auto lambda = [&] (Rpc_object_base *obj) {
if (!obj) { if (!obj) {
PERR("could not look up server object, return from call id_pt=%lx", error("could not look up server object, return from call id_pt=", id_pt);
id_pt);
return; return;
} }
@ -166,7 +163,7 @@ void Rpc_entrypoint::_activation_entry()
ep.apply(id_pt, lambda); ep.apply(id_pt, lambda);
if (!rcv_window.prepare_rcv_window(*(Nova::Utcb *)ep.utcb())) 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(); ep._rcv_buf.reset();
reply(utcb, exc, ep._snd_buf); reply(utcb, exc, ep._snd_buf);
@ -238,7 +235,7 @@ Rpc_entrypoint::~Rpc_entrypoint()
typedef Object_pool<Rpc_object_base> Pool; typedef Object_pool<Rpc_object_base> Pool;
Pool::remove_all([&] (Rpc_object_base *obj) { Pool::remove_all([&] (Rpc_object_base *obj) {
PWRN("Object pool not empty in %s", __func__); warning("object pool not empty in ", __func__);
_dissolve(obj); _dissolve(obj);
}); });

View File

@ -14,6 +14,7 @@
/* Genode includes */ /* Genode includes */
#include <base/signal.h> #include <base/signal.h>
#include <base/log.h>
#include <base/trace/events.h> #include <base/trace/events.h>
/* NOVA includes */ /* NOVA includes */
@ -40,8 +41,7 @@ void Signal_transmitter::submit(unsigned cnt)
if (res == NOVA_OK) if (res == NOVA_OK)
return; return;
PDBG("submitting signal failed - error %u - context=0x%lx", res, warning("submitting signal failed - error ", res, " - context=", _context);
_context.local_name());
_context = Signal_context_capability(); _context = Signal_context_capability();
} }

View File

@ -15,7 +15,7 @@
/* Genode includes */ /* Genode includes */
#include <base/thread.h> #include <base/thread.h>
#include <base/printf.h> #include <base/log.h>
#include <base/sleep.h> #include <base/sleep.h>
#include <base/env.h> #include <base/env.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
@ -47,8 +47,8 @@ void Thread::_thread_start()
Thread::myself()->entry(); Thread::myself()->entry();
} catch (...) { } catch (...) {
try { try {
PERR("Thread '%s' died because of an uncaught exception", error("Thread '", Thread::myself()->name(), "' "
Thread::myself()->name().string()); "died because of an uncaught exception");
} catch (...) { } catch (...) {
/* die in a noisy way */ /* die in a noisy way */
nova_die(); nova_die();

View File

@ -16,7 +16,6 @@
/* Genode includes */ /* Genode includes */
#include <base/thread.h> #include <base/thread.h>
#include <base/printf.h>
/* test specific includes */ /* test specific includes */
#include "server.h" #include "server.h"

View File

@ -13,7 +13,7 @@
*/ */
#include <base/thread.h> #include <base/thread.h>
#include <base/printf.h> #include <base/log.h>
#include <base/snprintf.h> #include <base/snprintf.h>
#include <util/touch.h> #include <util/touch.h>
@ -53,7 +53,7 @@ void test_translate()
local_name == (addr_t)Native_thread::INVALID_INDEX) local_name == (addr_t)Native_thread::INVALID_INDEX)
{ {
failed ++; failed ++;
PERR("%s: ipc call failed %lx", __func__, rpc); error(__func__, ": ipc call failed ", Hex(rpc));
ep.dissolve(&component); ep.dissolve(&component);
return; return;
} }
@ -66,21 +66,21 @@ void test_translate()
local_name == (addr_t)Native_thread::INVALID_INDEX) local_name == (addr_t)Native_thread::INVALID_INDEX)
{ {
failed ++; failed ++;
PERR("%s: ipc call failed %lx", __func__, rpc); error(__func__, ": ipc call failed ", Hex(rpc));
ep.dissolve(&component); ep.dissolve(&component);
return; return;
} }
Genode::Native_capability copy2 = Capability_space::import(local_name); Genode::Native_capability copy2 = Capability_space::import(local_name);
PINF("delegation session_cap->copy1->copy2 0x%lx->0x%lx->0x%lx", log("delegation session_cap->copy1->copy2 ",
session_cap.local_name(), copy1.local_name(), copy2.local_name()); session_cap, "->", copy1, "->", copy2);
/* sanity checks translate which must work */ /* sanity checks translate which must work */
Genode::Native_capability got_cap = client.cap_cap(copy2.local_name()); Genode::Native_capability got_cap = client.cap_cap(copy2.local_name());
if (got_cap.local_name() != copy1.local_name()) { if (got_cap.local_name() != copy1.local_name()) {
failed ++; failed ++;
PERR("%u:%s translate failed", __LINE__, __func__); error(__LINE__, ":", __func__, " translate failed");
ep.dissolve(&component); ep.dissolve(&component);
return; return;
} }
@ -88,7 +88,7 @@ void test_translate()
got_cap = client.cap_cap(copy1.local_name()); got_cap = client.cap_cap(copy1.local_name());
if (got_cap.local_name() != session_cap.local_name()) { if (got_cap.local_name() != session_cap.local_name()) {
failed ++; failed ++;
PERR("%u:%s translate failed", __LINE__, __func__); error(__LINE__, ":", __func__, " translate failed");
ep.dissolve(&component); ep.dissolve(&component);
return; return;
} }
@ -96,7 +96,7 @@ void test_translate()
got_cap = client.cap_cap(session_cap.local_name()); got_cap = client.cap_cap(session_cap.local_name());
if (got_cap.local_name() != session_cap.local_name()) { if (got_cap.local_name() != session_cap.local_name()) {
failed ++; failed ++;
PERR("%u:%s translate failed", __LINE__, __func__); error(__LINE__, ":", __func__, " translate failed");
ep.dissolve(&component); ep.dissolve(&component);
return; return;
} }
@ -114,7 +114,7 @@ void test_translate()
Genode::uint8_t res = Nova::lookup(crd_ses); Genode::uint8_t res = Nova::lookup(crd_ses);
if (res != Nova::NOVA_OK || !crd_ses.is_null()) { if (res != Nova::NOVA_OK || !crd_ses.is_null()) {
failed ++; failed ++;
PERR("%u - lookup call failed err=%x", __LINE__, res); error(__LINE__, " - lookup call failed err=", Hex(res));
ep.dissolve(&component); ep.dissolve(&component);
return; return;
} }
@ -123,7 +123,7 @@ void test_translate()
got_cap = client.cap_cap(copy2.local_name()); got_cap = client.cap_cap(copy2.local_name());
if (got_cap.local_name() != session_cap.local_name()) { if (got_cap.local_name() != session_cap.local_name()) {
failed ++; failed ++;
PERR("%u:%s translate failed", __LINE__, __func__); error(__LINE__, ":", __func__, " translate failed");
ep.dissolve(&component); ep.dissolve(&component);
return; return;
} }
@ -148,7 +148,7 @@ void test_revoke()
local_name == (addr_t)Native_thread::INVALID_INDEX) local_name == (addr_t)Native_thread::INVALID_INDEX)
{ {
failed ++; failed ++;
PERR("test_revoke ipc call failed %lx", rpc); error("test_revoke ipc call failed ", Hex(rpc));
ep.dissolve(&component); ep.dissolve(&component);
return; return;
} }
@ -161,7 +161,7 @@ void test_revoke()
local_name == (addr_t)Native_thread::INVALID_INDEX) local_name == (addr_t)Native_thread::INVALID_INDEX)
{ {
failed ++; failed ++;
PERR("test_revoke ipc call failed %lx", rpc); error("test_revoke ipc call failed ", Hex(rpc));
ep.dissolve(&component); ep.dissolve(&component);
return; return;
} }
@ -171,7 +171,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 || if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 ||
crd_dst.order() != 0) { crd_dst.order() != 0) {
failed ++; failed ++;
PERR("%u - lookup call failed %x", __LINE__, res); error(__LINE__, " - lookup call failed ", Hex(res));
ep.dissolve(&component); ep.dissolve(&component);
return; return;
} }
@ -181,7 +181,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_ses.base() != (addr_t)copy_session_cap.local_name() if (res != Nova::NOVA_OK || crd_ses.base() != (addr_t)copy_session_cap.local_name()
|| crd_ses.type() != 3 || crd_ses.order() != 0) { || crd_ses.type() != 3 || crd_ses.order() != 0) {
failed ++; 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); ep.dissolve(&component);
return; return;
} }
@ -190,7 +190,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 || if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 ||
crd_dst.order() != 0) { crd_dst.order() != 0) {
failed ++; 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); ep.dissolve(&component);
return; return;
} }
@ -203,7 +203,7 @@ void test_revoke()
res = Nova::lookup(crd_ses); res = Nova::lookup(crd_ses);
if (res != Nova::NOVA_OK || !crd_ses.is_null()) { if (res != Nova::NOVA_OK || !crd_ses.is_null()) {
failed ++; failed ++;
PERR("%u - lookup call failed err=%x", __LINE__, res); error(__LINE__, " - lookup call failed err=", Hex(res));
ep.dissolve(&component); ep.dissolve(&component);
return; return;
} }
@ -212,7 +212,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 || if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 ||
crd_dst.order() != 0) { crd_dst.order() != 0) {
failed ++; 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); ep.dissolve(&component);
return; return;
} }
@ -231,7 +231,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_ses.base() != (addr_t)copy_session_cap.local_name() || if (res != Nova::NOVA_OK || crd_ses.base() != (addr_t)copy_session_cap.local_name() ||
crd_ses.type() != 3 || crd_ses.order() != 0) { crd_ses.type() != 3 || crd_ses.order() != 0) {
failed ++; 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); ep.dissolve(&component);
return; return;
} }
@ -244,7 +244,7 @@ void test_revoke()
if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 || if (res != Nova::NOVA_OK || crd_dst.base() != local_name || crd_dst.type() != 3 ||
crd_dst.order() != 0) { crd_dst.order() != 0) {
failed ++; 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); ep.dissolve(&component);
return; return;
} }
@ -257,7 +257,7 @@ void test_revoke()
res = Nova::lookup(crd_dst); res = Nova::lookup(crd_dst);
if (res != Nova::NOVA_OK || !crd_dst.is_null()) { if (res != Nova::NOVA_OK || !crd_dst.is_null()) {
failed ++; 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; return;
} }
} }
@ -346,9 +346,9 @@ void test_pat()
if (check_pat && diff_run * 100 / hip->tsc_freq) { if (check_pat && diff_run * 100 / hip->tsc_freq) {
failed ++; failed ++;
PERR("map=%llx remap=%llx --> diff=%llx freq_tsc=%u %llu us", error("map=", Hex(map_run), " remap=", Hex(remap_run), " --> "
map_run, remap_run, diff_run, hip->tsc_freq, "diff=", Hex(diff_run), " freq_tsc=", hip->tsc_freq, " ",
diff_run * 1000 / hip->tsc_freq); diff_run * 1000 / hip->tsc_freq, " us");
} }
Nova::revoke(Nova::Mem_crd(remap_addr >> PAGE_4K, DS_ORDER, all)); 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(); Genode::Native_capability got_cap = client.void_cap();
if (!got_cap.valid()) { 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 ++; failed ++;
break; break;
} }
@ -386,7 +386,7 @@ void test_server_oom()
idx.inc(); idx.inc();
if (i % 5000 == 4999) 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' */ /* 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(); send_cap.solely_map();
if (!client.cap_void(send_cap)) { if (!client.cap_void(send_cap)) {
PERR("sending %4u. cap failed", i); error("sending ", i, ". cap failed");
failed ++; failed ++;
break; break;
} }
if (i % 5000 == 4999) if (i % 5000 == 4999)
PINF("sent %u. cap", i); log("sent ", i, ". cap");
} }
#endif #endif
@ -423,7 +423,7 @@ class Greedy : public Thread_deprecated<4096> {
void entry() void entry()
{ {
PINF("starting"); log("starting");
enum { SUB_RM_SIZE = 2UL * 1024 * 1024 * 1024 }; 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; addr_t const page_fault_portal = native_thread().exc_pt_sel + 14;
PERR("cause mappings in range [0x%lx, 0x%lx) %p", mem, log("cause mappings in range ",
mem + SUB_RM_SIZE - 1, &mem); Hex_range<addr_t>(mem, SUB_RM_SIZE), " ", &mem);
for (addr_t map_to = mem; map_to < mem + SUB_RM_SIZE; map_to += 4096) { 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 */ /* trigger faked page fault */
Genode::uint8_t res = Nova::call(page_fault_portal); Genode::uint8_t res = Nova::call(page_fault_portal);
if (res != Nova::NOVA_OK) { if (res != Nova::NOVA_OK) {
PINF("call result=%u", res); log("call result=", res);
failed++; failed++;
return; return;
} }
@ -460,13 +460,13 @@ class Greedy : public Thread_deprecated<4096> {
/* print status information in interval of 32M */ /* print status information in interval of 32M */
if (!(map_to & (32UL * 1024 * 1024 - 1))) { 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 */ /* trigger some work to see quota in kernel decreasing */
// Nova::Rights rwx(true, true, true); // Nova::Rights rwx(true, true, true);
// Nova::revoke(Nova::Mem_crd((map_to - 32 * 1024 * 1024) >> 12, 12, rwx)); // 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); va_end(list);
if (res == Nova::NOVA_OK) { if (res == Nova::NOVA_OK) {
PERR("res=%u %s - TEST FAILED", res, buf); error("res=", res, " ", Cstring(buf), " - TEST FAILED");
failed++; failed++;
} }
else else
printf("res=%u %s\n", res, buf); log("res=", res, " ", Cstring(buf));
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
printf("testing base-nova platform\n"); log("testing base-nova platform");
try { try {
Genode::config()->xml_node().attribute("check_pat").value(&check_pat); Genode::config()->xml_node().attribute("check_pat").value(&check_pat);
@ -564,7 +564,7 @@ int main(int argc, char **argv)
core_pagefault_oom.join(); core_pagefault_oom.join();
if (!failed) if (!failed)
printf("Test finished\n"); log("Test finished");
return -failed; return -failed;
} }

View File

@ -37,19 +37,19 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
& get_page_mask(); & get_page_mask();
if (use_local_addr) { if (use_local_addr) {
PERR("Parameter 'use_local_addr' not supported within core"); error("parameter 'use_local_addr' not supported within core");
return nullptr; return nullptr;
} }
if (offset) { if (offset) {
PERR("Parameter 'offset' not supported within core"); error("parameter 'offset' not supported within core");
return nullptr; return nullptr;
} }
/* allocate range in core's virtual address space */ /* allocate range in core's virtual address space */
void *virt_addr; void *virt_addr;
if (!platform()->region_alloc()->alloc(page_rounded_size, &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", error("could not allocate virtual address range in core of size ",
page_rounded_size); page_rounded_size);
return nullptr; return nullptr;
} }

View File

@ -15,7 +15,7 @@
#define _CORE__INCLUDE__MAP_LOCAL_H_ #define _CORE__INCLUDE__MAP_LOCAL_H_
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
/* core includes */ /* core includes */
#include <util.h> #include <util.h>
@ -36,8 +36,8 @@ namespace Genode {
L4_FpageAddRightsTo(&fpage, L4_FullyAccessible); L4_FpageAddRightsTo(&fpage, L4_FullyAccessible);
int ret = L4_UnmapFpage(L4_rootspace, fpage); int ret = L4_UnmapFpage(L4_rootspace, fpage);
if (ret != 1) if (ret != 1)
PERR("could not unmap page at %p from core (Error Code %ld)", error("could not unmap page at ", Hex(base), " from core, "
(void *)base, L4_ErrorCode()); "error=", L4_ErrorCode());
} }
/** /**
@ -61,7 +61,7 @@ namespace Genode {
fpage.X.rwx = 7; fpage.X.rwx = 7;
if (L4_MapFpage(L4_rootspace, fpage, phys_desc) != 1) { 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; return false;
} }
offset += get_page_size(); offset += get_page_size();

View File

@ -17,7 +17,7 @@
/* Genode includes */ /* Genode includes */
#include <rm_session/rm_session.h> #include <rm_session/rm_session.h>
#include <base/stdint.h> #include <base/stdint.h>
#include <base/printf.h> #include <base/log.h>
#include <util/touch.h> #include <util/touch.h>
/* base-internal includes */ /* base-internal includes */
@ -50,7 +50,7 @@ namespace Genode {
inline void panic(const char *s) inline void panic(const char *s)
{ {
using namespace Okl4; using namespace Okl4;
PDBG("Panic: %s", s); error("Panic: ", s);
ENTER_KDB("> panic <"); ENTER_KDB("> panic <");
} }
@ -58,7 +58,7 @@ namespace Genode {
{ {
using namespace Okl4; using namespace Okl4;
if (!val) { if (!val) {
PERR("Assertion failed: %s", s); error("assertion failed: ", s);
ENTER_KDB("Assertion failed"); ENTER_KDB("Assertion failed");
} }
} }
@ -117,10 +117,9 @@ namespace Genode {
Region_map::State::Fault_type pf_type, Region_map::State::Fault_type pf_type,
unsigned long faulter_badge) unsigned long faulter_badge)
{ {
printf("%s (%s pf_addr=%p pf_ip=%p from %02lx)\n", msg, log(pf_type == Region_map::State::WRITE_FAULT ? "WRITE" : "READ", " (",
pf_type == Region_map::State::WRITE_FAULT ? "WRITE" : "READ", msg, " pf_addr=", Hex(pf_addr), " pf_ip=", Hex(pf_ip), " "
(void *)pf_addr, (void *)pf_ip, "from ", Hex(faulter_badge), ")");
faulter_badge);
} }
inline addr_t map_src_addr(addr_t core_local, addr_t phys) { return phys; } inline addr_t map_src_addr(addr_t core_local, addr_t phys) { return phys; }

View File

@ -13,7 +13,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <util/arg_string.h> #include <util/arg_string.h>
/* core includes */ /* core includes */
@ -55,8 +55,8 @@ bool Irq_object::_associate()
L4_LoadMR(0, _irq); L4_LoadMR(0, _irq);
int ret = L4_AllowInterruptControl(L4_rootspace); int ret = L4_AllowInterruptControl(L4_rootspace);
if (ret != 1) { if (ret != 1) {
PERR("L4_AllowInterruptControl returned %d, error code=%ld\n", error("L4_AllowInterruptControl returned ", ret, ", error=",
ret, L4_ErrorCode()); L4_ErrorCode());
return false; return false;
} }
@ -67,8 +67,8 @@ bool Irq_object::_associate()
L4_LoadMR(0, _irq); L4_LoadMR(0, _irq);
ret = L4_RegisterInterrupt(thread_get_my_global_id(), IRQ_NOTIFY_BIT, 0, 0); ret = L4_RegisterInterrupt(thread_get_my_global_id(), IRQ_NOTIFY_BIT, 0, 0);
if (ret != 1) { if (ret != 1) {
PERR("L4_RegisterInterrupt returned %d, error code=%ld\n", error("L4_RegisterInterrupt returned ", ret, ", error=",
ret, L4_ErrorCode()); L4_ErrorCode());
return false; return false;
} }
@ -98,7 +98,7 @@ void Irq_object::start()
void Irq_object::entry() void Irq_object::entry()
{ {
if (!_associate()) if (!_associate())
PERR("Could not associate with IRQ 0x%x", _irq); error("could not associate with IRQ ", Hex(_irq));
/* thread is up and ready */ /* thread is up and ready */
_sync_bootup.unlock(); _sync_bootup.unlock();
@ -148,7 +148,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
throw Root::Unavailable(); throw Root::Unavailable();
if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).error()) { 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(); throw Root::Unavailable();
} }
@ -158,7 +158,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
Irq_session_component::~Irq_session_component() Irq_session_component::~Irq_session_component()
{ {
PDBG("Not yet implemented!"); warning(__func__, " not yet implemented!");
} }

View File

@ -12,7 +12,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
/* core includes */ /* core includes */
#include <ipc_pager.h> #include <ipc_pager.h>
@ -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, static inline void print_page_fault(L4_Word_t type, L4_Word_t addr, L4_Word_t ip,
unsigned long badge) unsigned long badge)
{ {
printf("page (%s%s%s) fault at fault_addr=%lx, fault_ip=%lx, from=%lx\n", log("page (",
type & L4_Readable ? "r" : "-", type & L4_Readable ? "r" : "-",
type & L4_Writable ? "w" : "-", type & L4_Writable ? "w" : "-",
type & L4_eXecutable ? "x" : "-", type & L4_eXecutable ? "x" : "-",
addr, ip, badge); ") 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); L4_StoreMR(1, &_fault_ip);
if (verbose_exception) if (verbose_exception)
PERR("Exception (label 0x%x) occured in space %d at IP 0x%p", error("exception (label ", Hex(L4_Label(_faulter_tag)), ") occured, "
(int)L4_Label(_faulter_tag), (int)L4_SenderSpace().raw, "space=", Hex(L4_SenderSpace().raw), ", "
(void *)_fault_ip); "ip=", Hex(_fault_ip));
} }
/* page fault */ /* page fault */
@ -133,8 +133,7 @@ void Ipc_pager::reply_and_wait_for_fault()
_reply_mapping.phys_desc()); _reply_mapping.phys_desc());
if (ret != 1) if (ret != 1)
PERR("L4_MapFpage returned %d, error_code=%d", error("L4_MapFpage returned ", ret, ", error=", L4_ErrorCode());
ret, (int)L4_ErrorCode());
/* reply to page-fault message to resume the faulting thread */ /* reply to page-fault message to resume the faulting thread */
acknowledge_wakeup(); acknowledge_wakeup();

View File

@ -12,7 +12,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <base/allocator_avl.h> #include <base/allocator_avl.h>
#include <base/sleep.h> #include <base/sleep.h>
#include <util/misc_math.h> #include <util/misc_math.h>
@ -21,6 +21,7 @@
#include <base/internal/crt0.h> #include <base/internal/crt0.h>
#include <base/internal/stack_area.h> #include <base/internal/stack_area.h>
#include <base/internal/native_utcb.h> #include <base/internal/native_utcb.h>
#include <base/internal/globals.h>
/* core includes */ /* core includes */
#include <core_parent.h> #include <core_parent.h>
@ -38,8 +39,6 @@ namespace Okl4 {
using namespace Genode; using namespace Genode;
static const bool verbose_boot_info = false;
enum { MAX_BOOT_MODULES = 64 }; enum { MAX_BOOT_MODULES = 64 };
enum { MAX_BOOT_MODULE_NAME_LEN = 32 }; enum { MAX_BOOT_MODULE_NAME_LEN = 32 };
static struct 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, Okl4::uintptr_t phys_base, Okl4::uintptr_t phys_end,
const Okl4::bi_user_data_t *data) 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; 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.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); 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, 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) 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 */ /* prevent first page from being added to core memory */
if (base < get_page_size() || end < get_page_size()) if (base < get_page_size() || end < get_page_size())
return 0; 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, 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) 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) { if (pool == 2) {
Platform *p = (Platform *)data->user_data; Platform *p = (Platform *)data->user_data;
p->_core_mem_alloc.phys_alloc()->add_range(base, end - base + 1); 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::bi_export_type_t export_type, char *key,
Okl4::size_t key_len, const Okl4::bi_user_data_t * data) 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 * We walk the boot info only once and collect all memory section
* objects. Each time we detect a memory section outside of roottask * 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; return 0;
if (num_boot_module_objects >= MAX_BOOT_MODULES) { if (num_boot_module_objects >= MAX_BOOT_MODULES) {
PERR("Maximum number of boot modules exceeded"); error("maximum number of boot modules exceeded");
return -1; 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 physpool, Okl4::bi_name_t virtpool,
Okl4::bi_name_t zone, const Okl4::bi_user_data_t *data) 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') */ /* reset module index (see comment in 'bi_export_object') */
if (owner == 0) num_boot_module_memsects = 0; 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 (virtpool != 3) return 0;
if (num_boot_module_memsects >= MAX_BOOT_MODULES) { if (num_boot_module_memsects >= MAX_BOOT_MODULES) {
PERR("Maximum number of boot modules exceeded"); error("maximum number of boot modules exceeded");
return -1; return -1;
} }
@ -237,8 +216,6 @@ Platform::Platform() :
* the location of the boot modules. * 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 * Initialize callback function for parsing the boot-info
* *
@ -281,19 +258,14 @@ Platform::Platform() :
_vm_start = 0x1000; _vm_start = 0x1000;
_vm_size = 0xb0000000 - 0x1000; _vm_size = 0xb0000000 - 0x1000;
/* init_log();
* When dumping 'ram_alloc', there are several small blocks in addition
* to the available free memory visible. These small blocks are used to log(":phys_alloc: "); (*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
* hold the meta data for the ROM modules as initialized by '_setup_rom'. log(":virt_alloc: "); (*_core_mem_alloc.virt_alloc())()->dump_addr_tree();
*/ log(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
if (verbose_boot_info) { log(":io_port: "); _io_port_alloc()->dump_addr_tree();
printf(":phys_alloc: "); (*_core_mem_alloc.phys_alloc())()->dump_addr_tree(); log(":irq: "); _irq_alloc()->dump_addr_tree();
printf(":virt_alloc: "); (*_core_mem_alloc.virt_alloc())()->dump_addr_tree(); log(":rom_fs: "); _rom_fs.print_fs();
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();
}
/* setup task object for core task */ /* setup task object for core task */
_core_pd = new(core_mem_alloc()) Platform_pd(true); _core_pd = new(core_mem_alloc()) Platform_pd(true);

View File

@ -29,9 +29,6 @@ namespace Okl4 { extern "C" {
using namespace Genode; using namespace Genode;
static const bool verbose = false;
/**************************** /****************************
** Private object members ** ** Private object members **
****************************/ ****************************/
@ -61,8 +58,7 @@ void Platform_pd::_create_pd(bool syscall)
resources, &old_resources); resources, &old_resources);
if (ret != 1) if (ret != 1)
PERR("L4_SpaceControl(new) returned %d, error code=%d", error("L4_SpaceControl(new) returned ", ret, ", error=", L4_ErrorCode());
ret, (int)L4_ErrorCode());
} }
@ -87,8 +83,7 @@ void Platform_pd::_destroy_pd()
resources, &old_resources); resources, &old_resources);
if (ret != 1) if (ret != 1)
PERR("L4_SpaceControl(delete) returned %d, error code=%d", error("L4_SpaceControl(delete) returned ", ret, ", error=", L4_ErrorCode());
ret, (int)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) void Platform_pd::_free_thread(int thread_id)
{ {
if (!_threads[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; _threads[thread_id] = 0;
} }
@ -186,7 +182,7 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
int t = _alloc_thread(thread_id, thread); int t = _alloc_thread(thread_id, thread);
if (t < 0) { if (t < 0) {
PERR("thread alloc failed"); error("thread alloc failed");
return false; return false;
} }
thread_id = t; thread_id = t;
@ -206,8 +202,6 @@ void Platform_pd::unbind_thread(Platform_thread *thread)
thread->unbind(); thread->unbind();
_free_thread(thread_id); _free_thread(thread_id);
if (verbose) _debug_log_threads();
} }
@ -232,23 +226,17 @@ void Platform_pd::space_pager(Platform_thread *thread)
resources, &old_resources); resources, &old_resources);
if (ret != 1) if (ret != 1)
PERR("L4_SpaceControl(new space_pager...) returned %d, error code=%d", error("L4_SpaceControl(new space_pager...) returned ", ret, ", error=",
ret, (int)L4_ErrorCode()); L4_ErrorCode());
/* grant the pager mapping rights regarding this space */ /* grant the pager mapping rights regarding this space */
if(!L4_AllowUserMapping(pager_space, 0x0, 0xff000000)) if(!L4_AllowUserMapping(pager_space, 0x0, 0xff000000))
PERR("Failed to delegate pt access to %lx, error %lx", error("failed to delegate pt access to ", Hex(pager_space.raw), ", "
pager_space.raw, L4_ErrorCode()); "error=", L4_ErrorCode());
} }
void Platform_pd::_setup_address_space() void Platform_pd::_setup_address_space() { }
{
PERR("not yet implemented");
}
static const bool verbose_unmap = false;
static void unmap_log2_range(unsigned pd_id, addr_t base, size_t size_log2) 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); L4_FpageAddRightsTo(&fpage, L4_FullyAccessible);
int ret = L4_UnmapFpage(L4_SpaceId(pd_id), fpage); int ret = L4_UnmapFpage(L4_SpaceId(pd_id), fpage);
if (ret != 1) if (ret != 1)
PERR("could not unmap page at %p from space %x (Error Code %ld)", error("could not unmap page at ", Hex(base), " from space ", Hex(pd_id), ", "
(void *)base, pd_id, L4_ErrorCode()); "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 remaining_size = size;
L4_Word_t size_log2 = get_page_size_log2(); 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 * Let unmap granularity ('size_log2') grow
*/ */
@ -334,7 +319,7 @@ Platform_pd::Platform_pd(Allocator *, char const *label)
_pd_id = _alloc_pd(); _pd_id = _alloc_pd();
if (_pd_id > PD_MAX) if (_pd_id > PD_MAX)
PERR("pd alloc failed"); error("pd alloc failed");
_create_pd(true); _create_pd(true);
} }
@ -352,18 +337,3 @@ Platform_pd::~Platform_pd()
_free_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.");
}

View File

@ -1,4 +1,3 @@
/* /*
* \brief OKL4 thread facility * \brief OKL4 thread facility
* \author Julian Stecklina * \author Julian Stecklina
@ -15,7 +14,7 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/log.h>
#include <util/string.h> #include <util/string.h>
#include <util/misc_math.h> #include <util/misc_math.h>
@ -43,7 +42,7 @@ using namespace Okl4;
int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no) int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
{ {
if (!_platform_pd) { 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; return -1;
} }
@ -89,8 +88,7 @@ int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
scheduler, pager, exception_handler, scheduler, pager, exception_handler,
resources, (void *)utcb_location); resources, (void *)utcb_location);
if (ret != 1) { if (ret != 1) {
PERR("L4_ThreadControl returned %d, error code=%d", error("L4_ThreadControl returned ", ret, ", error=", ret, L4_ErrorCode());
ret, (int)L4_ErrorCode());
return -1; return -1;
} }
@ -111,7 +109,7 @@ int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
/* assign priority */ /* assign priority */
if (!L4_Set_Priority(new_thread_id, if (!L4_Set_Priority(new_thread_id,
Cpu_session::scale_priority(DEFAULT_PRIORITY, _priority))) 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); set_l4_thread_id(new_thread_id);
return 0; return 0;
@ -145,7 +143,7 @@ void Platform_thread::unbind()
L4_nilthread, L4_nilthread, L4_nilthread, ~0, 0); L4_nilthread, L4_nilthread, L4_nilthread, ~0, 0);
if (res != 1) 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; _thread_id = THREAD_INVALID;
_l4_thread_id = L4_nilthread; _l4_thread_id = L4_nilthread;

View File

@ -39,7 +39,7 @@ void Ram_session_component::_clear_ds (Dataspace_component *ds)
/* allocate range in core's virtual address space */ /* allocate range in core's virtual address space */
void *virt_addr; void *virt_addr;
if (!platform()->region_alloc()->alloc(page_rounded_size, &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", error("could not allocate virtual address range in core of size ",
page_rounded_size); page_rounded_size);
return; return;
} }
@ -47,7 +47,7 @@ void Ram_session_component::_clear_ds (Dataspace_component *ds)
/* map the dataspace's physical pages to corresponding virtual addresses */ /* map the dataspace's physical pages to corresponding virtual addresses */
size_t num_pages = page_rounded_size >> get_page_size_log2(); size_t num_pages = page_rounded_size >> get_page_size_log2();
if (!map_local(ds->phys_addr(), (addr_t)virt_addr, num_pages)) { 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; return;
} }
@ -58,8 +58,8 @@ void Ram_session_component::_clear_ds (Dataspace_component *ds)
/* unmap dataspace from core */ /* unmap dataspace from core */
if (!unmap_local((addr_t)virt_addr, num_pages)) if (!unmap_local((addr_t)virt_addr, num_pages))
PERR("could not unmap core-local address range at %p (Error Code %ld)", error("could not unmap core-local address range at ", virt_addr, ", "
virt_addr, Okl4::L4_ErrorCode()); "error=", Okl4::L4_ErrorCode());
/* free core's virtual address space */ /* free core's virtual address space */
platform()->region_alloc()->free(virt_addr, page_rounded_size); platform()->region_alloc()->free(virt_addr, page_rounded_size);

View File

@ -58,7 +58,7 @@ Thread_state Platform_thread::state()
void Platform_thread::state(Thread_state) void Platform_thread::state(Thread_state)
{ {
PDBG("Not implemented"); warning("Platform_thread::state not implemented");
throw Cpu_thread::State_access_failed(); throw Cpu_thread::State_access_failed();
} }

View File

@ -12,7 +12,6 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/printf.h>
#include <base/log.h> #include <base/log.h>
#include <base/ipc.h> #include <base/ipc.h>
#include <base/blocking.h> #include <base/blocking.h>
@ -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; unsigned const num_data_words = num_msg_words - data_start_idx;
if (num_data_words*sizeof(L4_Word_t) > rcv_msg.capacity()) { if (num_data_words*sizeof(L4_Word_t) > rcv_msg.capacity()) {
PERR("receive message buffer too small msg size=%zd, buf size=%zd", error("receive message buffer too small,"
num_data_words*sizeof(L4_Word_t), rcv_msg.capacity()); "msg size=", num_data_words*sizeof(L4_Word_t), ", "
"buf size=", rcv_msg.capacity());
return Rpc_exception_code::INVALID_OBJECT; 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); L4_MsgTag_t rcv_tag = L4_Reply(Capability_space::ipc_cap_data(caller).dst);
if (L4_IpcFailed(rcv_tag)) if (L4_IpcFailed(rcv_tag))
PERR("ipc error in _reply - gets ignored"); error("ipc error in ipc_reply - gets ignored");
} }

Some files were not shown because too many files have changed in this diff Show More