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

View File

@ -191,7 +191,7 @@ namespace Genode {
* On L4/Fiasco, we don't use directed unmap but rely on the
* in-kernel mapping database. See 'region_map_support.cc'.
*/
void flush(addr_t, size_t) { PDBG("not implemented"); }
void flush(addr_t, size_t) { warning(__func__, " not implemented"); }
};
}

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);
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;
}

View File

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

View File

@ -12,7 +12,7 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <base/log.h>
/* core includes */
#include <ipc_pager.h>
@ -45,7 +45,7 @@ void Ipc_pager::wait_for_fault()
L4_IPC_NEVER, &result);
if (L4_IPC_IS_ERROR(result))
PERR("Ipc error %lx", L4_IPC_ERROR(result));
error(__func__, ": IPC error ", Hex(L4_IPC_ERROR(result)));
} while (L4_IPC_IS_ERROR(result));
}
@ -62,7 +62,7 @@ void Ipc_pager::reply_and_wait_for_fault()
L4_IPC_SEND_TIMEOUT_0, &result);
if (L4_IPC_IS_ERROR(result)) {
PERR("Ipc error %lx", L4_IPC_ERROR(result));
error(__func__, ": IPC error ", Hex(L4_IPC_ERROR(result)));
/* ignore all errors and wait for next proper message */
wait_for_fault();

View File

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

View File

@ -34,9 +34,6 @@ using namespace Fiasco;
using namespace Genode;
static const bool verbose = false;
/**************************
** Static class members **
**************************/
@ -189,7 +186,7 @@ int Platform_pd::_alloc_thread(int thread_id, Platform_thread *thread)
void Platform_pd::_free_thread(int thread_id)
{
if (!_threads[thread_id])
PWRN("double-free of thread %x.%x detected", _pd_id, thread_id);
warning("double-free of thread ", Hex(_pd_id), ".", Hex(thread_id), " detected");
_threads[thread_id] = 0;
}
@ -207,7 +204,7 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
int t = _alloc_thread(thread_id, thread);
if (t < 0) {
PERR("thread alloc failed");
error("thread alloc failed");
return false;
}
thread_id = t;
@ -218,7 +215,6 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
/* finally inform thread about binding */
thread->bind(thread_id, l4_thread_id, this);
if (verbose) _debug_log_threads();
return true;
}
@ -231,8 +227,6 @@ void Platform_pd::unbind_thread(Platform_thread *thread)
thread->unbind();
_free_thread(thread_id);
if (verbose) _debug_log_threads();
}
@ -248,7 +242,6 @@ Platform_pd::Platform_pd(Allocator * md_alloc, char const *,
int ret = _alloc_pd(pd_id);
if (ret < 0) {
_debug_log_pds();
panic("pd alloc failed");
}
@ -268,27 +261,3 @@ Platform_pd::~Platform_pd()
_free_pd();
}
/***********************
** Debugging support **
***********************/
void Platform_pd::_debug_log_threads()
{
int i;
printf("[%02x] ", _pd_id);
for (i = 0; i < THREAD_MAX; ++i) {
printf("%c", !_threads[i] ? '.' : 'X');
if (i == 63) printf("\n ");
}
printf("\n");
}
void Platform_pd::_debug_log_pds()
{
int i;
for (i = 0; i < PD_MAX; ++i)
printf("[%02x] %d %d %d\n", i, _pds()[i].reserved, _pds()[i].free,
_pds()[i].version);
}

View File

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

View File

@ -12,7 +12,6 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <base/log.h>
#include <base/ipc.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)
throw Genode::Blocking_canceled();
PERR("ipc_call error %lx", L4_IPC_ERROR(ipc_result));
error("ipc_call error ", Hex(L4_IPC_ERROR(ipc_result)));
throw Genode::Ipc_error();
}
@ -204,7 +203,7 @@ void Genode::ipc_reply(Native_capability caller, Rpc_exception_code exc,
L4_IPC_SEND_TIMEOUT_0, &result);
if (L4_IPC_IS_ERROR(result))
PERR("ipc_send error %lx, ignored", L4_IPC_ERROR(result));
error("ipc_send error ", Hex(L4_IPC_ERROR(result)), ", ignored");
}
@ -251,7 +250,7 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
* incoming message.
*/
if (L4_IPC_IS_ERROR(ipc_result)) {
PERR("ipc_reply_and_wait error %lx", L4_IPC_ERROR(ipc_result));
error("ipc_reply_and_wait error ", Hex(L4_IPC_ERROR(ipc_result)));
} else {
need_to_wait = false;
}
@ -265,7 +264,7 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
L4_IPC_NEVER, &ipc_result);
if (L4_IPC_IS_ERROR(ipc_result)) {
PERR("ipc_wait error %lx", L4_IPC_ERROR(ipc_result));
error("ipc_wait error ", Hex(L4_IPC_ERROR(ipc_result)));
} else {
need_to_wait = false;
}

View File

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

View File

@ -112,7 +112,7 @@ namespace Genode {
* On Fiasco.OC, we don't use directed unmap but rely on the
* in-kernel mapping database. See 'region_map_support.cc'.
*/
void flush(addr_t, size_t) { PDBG("not implemented"); }
void flush(addr_t, size_t) { warning(__func__, " not implemented"); }
};
}

View File

@ -39,7 +39,7 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
return 0;
if (!map_local_io(base, (addr_t)local_base, size >> get_page_size_log2())) {
PERR("map_local_io failed\n");
error("map_local_io failed");
return 0;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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_cap_idx_t)remote) | L4_ITEM_MAP);
if (l4_msgtag_has_error(tag))
PERR("mapping cap failed");
error("mapping cap failed");
}
@ -119,7 +119,7 @@ Native_capability Rpc_cap_factory::alloc(Native_capability ep)
idx->kcap(),
ref->pt()->thread().local.data()->kcap(), id);
if (l4_msgtag_has_error(tag)) {
PERR("l4_factory_create_gate failed!");
error("l4_factory_create_gate failed!");
cap_map()->remove(idx);
platform_specific()->cap_id_alloc()->free(id);
return cap;
@ -132,7 +132,7 @@ Native_capability Rpc_cap_factory::alloc(Native_capability ep)
idx->pt(ref->pt());
cap = Native_capability(*idx);
} catch (Cap_id_allocator::Out_of_ids) {
PERR("Out of capability ids");
error("out of capability IDs");
}
/*
@ -224,7 +224,7 @@ void Genode::Capability_map::remove(Genode::Cap_index* i)
l4_obj_fpage(i->kcap(), 0, L4_FPAGE_RWX),
L4_FP_ALL_SPACES | L4_FP_DELETE_OBJ);
if (l4_msgtag_has_error(tag))
PERR("destruction of ipc-gate %lx failed!", (unsigned long) i->kcap());
error("destruction of ipc-gate ", i->kcap(), " failed!");
platform_specific()->cap_id_alloc()->free(i->id());

View File

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

View File

@ -13,7 +13,7 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <base/log.h>
#include <irq_session/irq_session.h>
#include "platform.h"
@ -84,5 +84,5 @@ void Genode::Platform::setup_irq_mode(unsigned irq_number, unsigned trigger,
* Set mode
*/
if (l4_error(l4_icu_set_mode(L4_BASE_ICU_CAP, irq_number, mode)))
PERR("Setting mode for IRQ%u failed", irq_number);
error("setting mode for IRQ ", irq_number, " failed");
}

View File

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

View File

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

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

View File

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

View File

@ -14,7 +14,7 @@
#ifndef _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>
namespace Genode
@ -49,14 +49,16 @@ namespace Genode
void free(void *addr, size_t size) override {
_alloc->free(addr, size); }
size_t consumed() const override {
PDBG("Unexpected call");
size_t consumed() const override
{
warning(__func__, "unexpectedly called");
while (1) ;
return 0;
}
size_t overhead(size_t size) const override {
PDBG("Unexpected call");
size_t overhead(size_t size) const override
{
warning(__func__, "unexpectedly called");
while (1) ;
return 0;
}

View File

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

View File

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

View File

@ -15,6 +15,7 @@
#define _CORE__INCLUDE__SPEC__RPI__PIC_H_
/* Genode includes */
#include <base/log.h>
#include <util/mmio.h>
/* core includes */
@ -101,7 +102,7 @@ class Genode::Usb_dwc_otg : Mmio
stat_cnt++;
if (stat_cnt == 8000) {
PLOG("kicked: %d filtered: %d triggered: %d", kick_cnt, filter_cnt, trigger_cnt);
log("kicked: ", kick_cnt, " filtered: ", filter_cnt, " triggered: ", trigger_cnt);
stat_cnt = 0;
}

View File

@ -14,6 +14,8 @@
#ifndef _CORE__INCLUDE__SPEC__X86_64__MUEN__BOARD_H_
#define _CORE__INCLUDE__SPEC__X86_64__MUEN__BOARD_H_
#include <base/internal/globals.h>
namespace Genode
{
struct Board
@ -31,7 +33,7 @@ namespace Genode
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_
/* base includes */
#include <base/printf.h>
#include <base/log.h>
#include <kernel/types.h>
/* core includes */
@ -70,18 +70,19 @@ class Genode::Timer
struct Sinfo::Memregion_info 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();
}
_event_page = (Subject_timed_event *)region.address;
_event_page->event_nr = Board::TIMER_EVENT_KERNEL;
PINF("muen-timer: Page @0x%llx, frequency %llu kHz, event %u",
region.address, _tics_per_ms, _event_page->event_nr);
log("muen-timer: Page @", Hex(region.address), ", "
"frequency ", _tics_per_ms, " kHz, "
"event ", (unsigned)_event_page->event_nr);
if (sinfo()->get_memregion_info("monitor_timed_event", &region)) {
PINF("muen-timer: Found guest timed event page @0x%llx"
" -> enabling preemption", region.address);
log("muen-timer: Found guest timed event page @", Hex(region.address),
" -> enabling preemption");
_guest_event_page = (Subject_timed_event *)region.address;
_guest_event_page->event_nr = Board::TIMER_EVENT_PREEMPT;
}

View File

@ -16,6 +16,7 @@
/* Genode includes */
#include <root/component.h>
#include <base/heap.h>
/* core includes */
#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)
{
if (_sig_cap.valid()) {
PWRN("signal handler already registered for IRQ %u", _irq_number);
warning("signal handler already registered for IRQ ", _irq_number);
return;
}
@ -53,7 +53,7 @@ void Irq_session_component::sigh(Signal_context_capability cap)
if (Kernel::new_irq((addr_t)&_kernel_object, _irq_number,
Capability_space::capid(_sig_cap)))
PWRN("invalid signal handler for IRQ %u", _irq_number);
warning("invalid signal handler for IRQ ", _irq_number);
}
@ -86,7 +86,7 @@ Irq_session_component::Irq_session_component(Range_allocator * const irq_alloc,
/* allocate interrupt */
if (_irq_alloc->alloc_addr(1, _irq_number).error()) {
PERR("unavailable interrupt %d requested", _irq_number);
error("unavailable interrupt ", _irq_number, " requested");
throw Root::Invalid_args();
}

View File

@ -79,7 +79,6 @@ time_t Clock::update_time()
/* update time */
time_t const old_value = _last_timeout_duration;
time_t const new_value = _timer->value(_cpu_id);
// PERR("%lu %lu", old_value, new_value);
time_t const duration = old_value > new_value ? old_value - new_value : 1;
_time += duration;
return duration;

View File

@ -11,6 +11,9 @@
* under the terms of the GNU General Public License version 2.
*/
/* Genode includes */
#include <base/log.h>
/* core includes */
#include <kernel/cpu_scheduler.h>
#include <assert.h>
@ -189,7 +192,7 @@ void Cpu_scheduler::remove(Share * const s)
*
*/
if (s == _head) {
PERR("Removing the head of the CPU scheduler isn't supported by now.");
Genode::error("Removing the head of the CPU scheduler isn't supported by now.");
while (1) ;
}
if (s->_ready) { _fills.remove(s); }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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),
cma->phys_addr(_table)))
PWRN("Cannot instantiate vm kernel object, invalid signal context?");
Genode::warning("Cannot instantiate vm kernel object, invalid signal context?");
}
@ -42,10 +42,10 @@ void Vm_session_component::_attach(addr_t phys_addr, addr_t vm_addr, size_t size
_table->insert_translation(vm_addr, phys_addr, size, pflags, _tt_alloc);
return;
} catch(Allocator::Out_of_memory) {
PERR("Translation table needs to much RAM");
Genode::error("Translation table needs to much RAM");
} catch(...) {
PERR("Invalid mapping %p -> %p (%zx)", (void*)phys_addr,
(void*)vm_addr, size);
Genode::error("Invalid mapping ", Genode::Hex(phys_addr), " -> ",
Genode::Hex(vm_addr), " (", size, ")");
}
}
@ -86,7 +86,7 @@ Vm_session_component::Vm_session_component(Rpc_entrypoint *ds_ep,
/* get some aligned space for the translation table */
if (!cma->alloc_aligned(sizeof(Translation_table), (void**)&tt,
Translation_table::ALIGNM_LOG2).ok()) {
PERR("failed to allocate kernel object");
error("failed to allocate kernel object");
throw Root::Quota_exceeded();
}

View File

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

View File

@ -12,6 +12,12 @@
* 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 */
#include <kernel/cpu.h>
#include <kernel/kernel.h>
@ -35,13 +41,15 @@ void Kernel::Cpu::init(Pic &pic, Kernel::Pd &core_pd, Genode::Board&)
fpu().init();
Genode::init_log();
/*
* Please do not remove the PINF(), because the serial constructor requires
* Please do not remove the log(), because the serial constructor requires
* access to the Bios Data Area, which is available in the initial
* translation table set, but not in the final tables used after
* Cr3::write().
*/
PINF("Switch to core's final translation table");
Genode::log("Switch to core's final translation table");
Cr3::write(Cr3::init((addr_t)core_pd.translation_table()));

View File

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

View File

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

View File

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

View File

@ -40,7 +40,7 @@ namespace Genode {
** Signal context **
********************/
void Signal_context::submit(unsigned) { PERR("not implemented"); }
void Signal_context::submit(unsigned) { Genode::error("not implemented"); }
/************************
@ -67,7 +67,7 @@ Signal_receiver::Signal_receiver()
_cap = env()->pd_session()->alloc_signal_source();
},
[&] () {
PINF("upgrading quota donation for PD session");
log("upgrading quota donation for PD session");
env()->parent()->upgrade(env()->pd_session_cap(), "ram_quota=8K");
}
);
@ -105,7 +105,7 @@ Signal_context_capability Signal_receiver::manage(Signal_context * const c)
return c->_cap;
},
[&] () {
PINF("upgrading quota donation for PD session");
log("upgrading quota donation for PD session");
env()->parent()->upgrade(env()->pd_session_cap(), "ram_quota=8K");
}
);
@ -118,7 +118,7 @@ void Signal_receiver::block_for_signal()
{
/* wait for a signal */
if (Kernel::await_signal(Capability_space::capid(_cap))) {
PERR("failed to receive signal");
Genode::error("failed to receive signal");
return;
}
/* read signal data */
@ -137,4 +137,4 @@ void Signal_receiver::block_for_signal()
}
void Signal_receiver::local_submit(Signal::Data) { PERR("not implemented"); }
void Signal_receiver::local_submit(Signal::Data) { Genode::error("not implemented"); }

View File

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

View File

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

View File

@ -13,7 +13,7 @@
/* Genode includes */
#include <util/arg_string.h>
#include <base/printf.h>
#include <base/log.h>
#include <base/snprintf.h>
/* core-local includes */
@ -112,7 +112,7 @@ void Native_pd_component::_start(Dataspace_component &ds)
int tmp_binary_fd = lx_open(filename, O_CREAT | O_EXCL | O_WRONLY, S_IRWXU);
if (tmp_binary_fd < 0) {
PERR("Could not create file '%s'", filename);
error("Could not create file '", filename, "'");
return; /* XXX reflect error to client */
}
@ -205,6 +205,6 @@ void Native_pd_component::start(Capability<Dataspace> binary)
if (ds)
_start(*ds);
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.
*/
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 */
#include <util/token.h>
#include <util/misc_math.h>
#include <base/printf.h>
#include <base/log.h>
/* local includes */
#include "platform_thread.h"
@ -100,20 +100,19 @@ Platform_thread::~Platform_thread()
void Platform_thread::cancel_blocking()
{
PDBG("send cancel-blocking signal to %ld\n", _tid);
lx_tgkill(_pid, _tid, LX_SIGUSR1);
}
void Platform_thread::pause()
{
PDBG("not implemented");
warning(__func__, "not implemented");
}
void Platform_thread::resume()
{
PDBG("not implemented");
warning(__func__, "not implemented");
}

View File

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

View File

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

View File

@ -14,7 +14,7 @@
/* Genode includes */
#include <base/env.h>
#include <base/child.h>
#include <base/printf.h>
#include <base/log.h>
#include <linux_native_pd/client.h>
/* base-internal includes */
@ -79,7 +79,7 @@ Child::Process::Process(Dataspace_capability elf_ds,
addr_t elf_addr;
try { elf_addr = local_rm.attach(elf_ds); }
catch (Region_map::Attach_failed) {
PERR("local attach of ELF executable failed"); throw; }
error("local attach of ELF executable failed"); throw; }
/* setup ELF object and read program entry pointer */
Elf_binary elf(elf_addr);
@ -97,7 +97,7 @@ Child::Process::Process(Dataspace_capability elf_ds,
if (dynamically_linked) {
if (!ldso_ds.valid()) {
PERR("attempt to start dynamic executable without dynamic linker");
error("attempt to start dynamic executable without dynamic linker");
throw Missing_dynamic_linker();
}

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)
|| (((long)addr_out < 0) && ((long)addr_out > -4095))) {
PERR("_reserve_local: lx_mmap failed (addr_in=%p,addr_out=%p/%ld)",
addr_in, addr_out, (long)addr_out);
error("_reserve_local: lx_mmap failed "
"(addr_in=", addr_in, ",addr_out=", addr_out, "/", (long)addr_out, ")");
throw Region_map::Region_conflict();
}
@ -139,8 +139,9 @@ void *Region_map_mmap::_map_local(Dataspace_capability ds,
if ((use_local_addr && addr_in != addr_out)
|| (((long)addr_out < 0) && ((long)addr_out > -4095))) {
PERR("_map_local: lx_mmap failed (addr_in=%p,addr_out=%p/%ld) overmap=%d",
addr_in, addr_out, (long)addr_out, overmap);
error("_map_local: lx_mmap failed"
"(addr_in=", addr_in, ", addr_out=", addr_out, "/", (long)addr_out, ") "
"overmap=", overmap);
throw Region_map::Region_conflict();
}
@ -151,7 +152,7 @@ void *Region_map_mmap::_map_local(Dataspace_capability ds,
void Region_map_mmap::_add_to_rmap(Region const &region)
{
if (_rmap.add_region(region) < 0) {
PERR("_add_to_rmap: could not add region to sub RM session");
error("_add_to_rmap: could not add region to sub RM session");
throw Region_conflict();
}
}
@ -167,12 +168,12 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
/* only support attach_at for sub RM sessions */
if (_sub_rm && !use_local_addr) {
PERR("Region_map_mmap::attach: attaching w/o local addr not supported\n");
error("Region_map_mmap::attach: attaching w/o local addr not supported");
throw Out_of_metadata();
}
if (offset < 0) {
PERR("Region_map_mmap::attach: negative offset not supported\n");
error("Region_map_mmap::attach: negative offset not supported");
throw Region_conflict();
}
@ -204,7 +205,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
* Case 4
*/
if (is_sub_rm_session(ds)) {
PERR("Region_map_mmap::attach: nesting sub RM sessions is not supported");
error("Region_map_mmap::attach: nesting sub RM sessions is not supported");
throw Invalid_dataspace();
}
@ -213,7 +214,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
* sub RM session
*/
if (region_size + (addr_t)local_addr > _size) {
PERR("Region_map_mmap::attach: dataspace does not fit in sub RM session");
error("Region_map_mmap::attach: dataspace does not fit in sub RM session");
throw Region_conflict();
}
@ -249,7 +250,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
* Detect if sub RM session is already attached
*/
if (rm->_base) {
PERR("Region_map_mmap::attach: mapping a sub RM session twice is not supported");
error("Region_map_mmap::attach: mapping a sub RM session twice is not supported");
throw Out_of_metadata();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@
#ifndef _INCLUDE__NOVA__UTIL_H_
#define _INCLUDE__NOVA__UTIL_H_
#include <base/printf.h>
#include <base/log.h>
#include <base/thread.h>
__attribute__((always_inline))
@ -51,7 +51,8 @@ inline void request_event_portal(Genode::Native_capability const &cap,
utcb->crd_rcv = orig_crd;
if (res)
PERR("request of event (%lu) capability selector failed (res=%u)", event, res);
Genode::error("request of event (", event, ") ",
"capability selector failed (res=", res, ")");
}
@ -111,6 +112,6 @@ inline void delegate_vcpu_portals(Genode::Native_capability const &cap,
utcb->crd_rcv = orig_crd;
if (res)
PERR("setting exception portals for vCPU failed %u", res);
Genode::error("setting exception portals for vCPU failed res=", res);
}
#endif /* _INCLUDE__NOVA__UTIL_H_ */

View File

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

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <base/log.h>
/* core includes */
#include <irq_root.h>
@ -36,7 +36,7 @@ static bool irq_ctrl(Genode::addr_t irq_sel,
msi_addr, msi_data, sig_sel);
if (res != Nova::NOVA_OK)
PERR("setting up MSI failed - error %u", res);
error("setting up MSI failed - error ", res);
/* nova syscall interface specifies msi addr/data to be 32bit */
msi_addr = msi_addr & ~0U;
@ -61,7 +61,7 @@ static void deassociate(Genode::addr_t irq_sel)
addr_t dummy1 = 0, dummy2 = 0;
if (!irq_ctrl(irq_sel, dummy1, dummy2, irq_sel))
PWRN("Irq could not be de-associated");
warning("Irq could not be de-associated");
}
@ -129,7 +129,7 @@ void Irq_object::sigh(Signal_context_capability cap)
void Irq_object::ack_irq()
{
if (Nova::NOVA_OK != Nova::sm_ctrl(irq_sel(), Nova::SEMAPHORE_DOWN))
PERR("Unmasking irq of selector 0x%lx failed", irq_sel());
error("Unmasking irq of selector ", irq_sel(), " failed");
}
@ -145,7 +145,7 @@ void Irq_object::start(unsigned irq, Genode::addr_t const device_phys)
int ret = map_local((Nova::Utcb *)Thread::myself()->utcb(),
src, dst, MAP_FROM_KERNEL_TO_CORE);
if (ret) {
PERR("Getting IRQ from kernel failed - %u", irq);
error("getting IRQ from kernel failed - ", irq);
throw Root::Unavailable();
}
@ -217,7 +217,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
}
if (!irq_alloc || irq_alloc->alloc_addr(1, irq_number).error()) {
PERR("Unavailable IRQ 0x%lx requested", irq_number);
error("unavailable IRQ ", irq_number, " requested");
throw Root::Unavailable();
}

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)
{
Ipc_pager ipc_pager;
@ -105,11 +130,13 @@ void Pager_object::_page_fault_handler(addr_t pager_obj)
const char * client_thread = obj->client_thread();
const char * client_pd = obj->client_pd();
Page_fault_info const fault_info(client_pd, client_thread,
which_cpu(pager_thread),
ipc_pager.fault_ip(), ipc_pager.fault_addr());
/* region manager fault - to be handled */
if (ret == 1) {
PDBG("page fault, pd '%s', thread '%s', cpu %u, ip=%lx, fault "
"address=0x%lx", client_pd, client_thread, which_cpu(pager_thread),
ipc_pager.fault_ip(), ipc_pager.fault_addr());
log("page fault, ", fault_info);
utcb->set_msg_word(0);
utcb->mtd = 0;
@ -121,10 +148,7 @@ void Pager_object::_page_fault_handler(addr_t pager_obj)
/* unhandled case */
obj->_state.mark_dead();
PWRN("unresolvable page fault, pd '%s', thread '%s', cpu %u, ip=%lx, "
"fault address=0x%lx ret=%u", client_pd, client_thread,
which_cpu(pager_thread), ipc_pager.fault_ip(), ipc_pager.fault_addr(),
ret);
warning("unresolvable page fault, ", fault_info, " ret=", ret);
Native_capability pager_cap = obj->Object_pool<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 */
_state.mark_dead();
PWRN("unresolvable exception %u, pd '%s', thread '%s', cpu %u, "
"ip=0x%lx, %s", exit_id, client_pd(), client_thread(),
which_cpu(pager_thread), fault_ip,
res == 0xFF ? "no signal handler" :
(res == NOVA_OK ? "" : "recall failed"));
warning("unresolvable exception ", exit_id, ", "
"pd '", client_pd(), "', "
"thread '", client_thread(), "', "
"cpu ", which_cpu(pager_thread), ", "
"ip=", Hex(fault_ip), " ",
res == 0xFF ? "no signal handler"
: (res == NOVA_OK ? "" : "recall failed"));
Nova::revoke(Obj_crd(exc_pt_sel_client(), NUM_INITIAL_PT_LOG2));
@ -291,7 +317,7 @@ void Pager_object::_invoke_handler(addr_t pager_obj)
Obj_crd snd(cap.base(), 0);
Obj_crd rcv(obj->_client_exc_vcpu + event * items_count + i, 0);
if (map_local(utcb, snd, rcv))
PWRN("could not remap vCPU portal 0x%x", i);
warning("could not remap vCPU portal ", Hex(i));
}
}
@ -379,7 +405,7 @@ void Pager_object::wake_up()
uint8_t res = sm_ctrl(sel_sm_block_pause(), SEMAPHORE_UP);
if (res != NOVA_OK)
PWRN("canceling blocked client failed (thread sm)");
warning("canceling blocked client failed (thread sm)");
}
@ -387,14 +413,14 @@ void Pager_object::client_cancel_blocking()
{
uint8_t res = sm_ctrl(exc_pt_sel_client() + SM_SEL_EC, SEMAPHORE_UP);
if (res != NOVA_OK)
PWRN("canceling blocked client failed (thread sm)");
warning("canceling blocked client failed (thread sm)");
if (!_state.has_signal_sm())
return;
res = sm_ctrl(exc_pt_sel_client() + PT_SEL_STARTUP, SEMAPHORE_UP);
if (res != NOVA_OK)
PWRN("canceling blocked client failed (signal sm)");
warning("canceling blocked client failed (signal sm)");
}
@ -440,7 +466,7 @@ void Pager_object::cleanup_call()
utcb->set_msg_word(0);
utcb->mtd = 0;
if (uint8_t res = call(sel_pt_cleanup()))
PERR("%8p - cleanup call to pager failed res=%d", utcb, res);
error(utcb, " - cleanup call to pager failed res=", res);
}
@ -477,7 +503,7 @@ void Exception_handlers::register_handler(Pager_object *obj, Mtd mtd,
{
unsigned use_cpu = obj->location.xpos();
if (!kernel_hip()->is_cpu_enabled(use_cpu) || !pager_threads[use_cpu]) {
PWRN("invalid CPU parameter used in pager object");
warning("invalid CPU parameter used in pager object");
throw Region_map::Invalid_thread();
}
@ -562,14 +588,14 @@ Pager_object::Pager_object(Cpu_session_capability cpu_session_cap,
/* ypos information not supported by now */
if (location.ypos()) {
PWRN("Unsupported location %ux%u", location.xpos(), location.ypos());
warning("unsupported location ", location.xpos(), "x", location.ypos());
throw Region_map::Invalid_thread();
}
/* place Pager_object on specified CPU by selecting proper pager thread */
unsigned use_cpu = location.xpos();
if (!kernel_hip()->is_cpu_enabled(use_cpu) || !pager_threads[use_cpu]) {
PWRN("invalid CPU parameter used in pager object");
warning("invalid CPU parameter used in pager object");
throw Region_map::Invalid_thread();
}
@ -603,7 +629,7 @@ Pager_object::Pager_object(Cpu_session_capability cpu_session_cap,
res = create_portal(sel_pt_cleanup(), pd_sel, ec_sel, Mtd(0),
reinterpret_cast<addr_t>(_invoke_handler), this);
if (res != Nova::NOVA_OK) {
PERR("could not create pager cleanup portal, error = %u\n", res);
error("could not create pager cleanup portal, error=", res);
throw Region_map::Invalid_thread();
}
@ -661,10 +687,11 @@ uint8_t Pager_object::handle_oom(addr_t transfer_from,
/* request current kernel quota usage of source pd */
Nova::pd_ctrl_debug(transfer_from, limit_source, usage_source);
PINF("oom - '%s':'%s' (%lu/%lu) - transfer %u pages from '%s':'%s' "
"(%lu/%lu)", dst_pd, dst_thread,
usage_before, limit_before, QUOTA_TRANSFER_PAGES,
src_pd, src_thread, usage_source, limit_source);
log("oom - '", dst_pd, "':'", dst_thread, "' "
"(", usage_before, "/", limit_before, ") - "
"transfer ", (long)QUOTA_TRANSFER_PAGES, " pages "
"from '", src_pd, "':'", src_thread, "' "
"(", usage_source, "/", limit_source, ")");
}
uint8_t res = Nova::NOVA_PD_OOM;
@ -687,9 +714,10 @@ uint8_t Pager_object::handle_oom(addr_t transfer_from,
}
}
PWRN("kernel memory quota upgrade failed - trigger memory free up for "
"causing '%s':'%s' - donator is '%s':'%s', policy=%u",
dst_pd, dst_thread, src_pd, src_thread, policy);
warning("kernel memory quota upgrade failed - trigger memory free up for "
"causing '", dst_pd, "':'", dst_thread, "' - "
"donator is '", src_pd, "':'", src_thread, "', "
"policy=", (int)policy);
/* if nothing helps try to revoke memory */
enum { REMOTE_REVOKE = true, PD_SELF = true };
@ -760,14 +788,14 @@ void Pager_object::_oom_handler(addr_t pager_dst, addr_t pager_src,
assert |= utcb->msg_words();
if (assert) {
PERR("unknown OOM case - stop core pager thread");
error("unknown OOM case - stop core pager thread");
utcb->set_msg_word(0);
reply(myself->stack_top(), myself->native_thread().exc_pt_sel + Nova::SM_SEL_EC);
}
/* be strict in case of the -strict- STOP policy - stop causing thread */
if (policy == STOP) {
PERR("PD has insufficient kernel memory left - stop thread");
error("PD has insufficient kernel memory left - stop thread");
utcb->set_msg_word(0);
reply(myself->stack_top(), obj_dst->sel_sm_block_pause());
}
@ -780,7 +808,7 @@ void Pager_object::_oom_handler(addr_t pager_dst, addr_t pager_src,
switch (pager_src) {
case SRC_PD_UNKNOWN:
/* should not happen on Genode - we create and know every PD in core */
PERR("Unknown PD has insufficient kernel memory left - stop thread");
error("Unknown PD has insufficient kernel memory left - stop thread");
utcb->set_msg_word(0);
reply(myself->stack_top(), myself->native_thread().exc_pt_sel + Nova::SM_SEL_EC);
@ -819,8 +847,9 @@ void Pager_object::_oom_handler(addr_t pager_dst, addr_t pager_src,
utcb->set_msg_word(0);
if (res != Nova::NOVA_PD_OOM)
PERR("Upgrading kernel memory failed, policy %u, error %u "
"- stop thread finally", policy, res);
error("upgrading kernel memory failed, policy ", (int)policy, ", "
"error ", (int)res, " - stop thread finally");
/* else: caller will get blocked until RCU period is over */
/* block caller in semaphore */
@ -843,7 +872,7 @@ addr_t Pager_object::get_oom_portal()
return pt_oom;
}
PERR("creating portal for out of memory notification failed");
error("creating portal for out of memory notification failed");
return 0;
}
@ -889,10 +918,10 @@ void Pager_activation_base::entry() { }
Pager_entrypoint::Pager_entrypoint(Rpc_cap_factory &cap_factory)
: _cap_factory(cap_factory)
{
/* sanity check space for pager threads */
/* sanity check for pager threads */
if (kernel_hip()->cpu_max() > PAGER_CPUS) {
PERR("kernel supports more CPUs (%u) than Genode (%u)",
kernel_hip()->cpu_max(), PAGER_CPUS);
error("kernel supports more CPUs (", kernel_hip()->cpu_max(), ") "
"than Genode (", (unsigned)PAGER_CPUS, ")");
nova_die();
}
@ -916,7 +945,7 @@ Pager_capability Pager_entrypoint::manage(Pager_object *obj)
/* let handle pager_object of pager thread on same CPU */
unsigned use_cpu = obj->location.xpos();
if (!kernel_hip()->is_cpu_enabled(use_cpu) || !pager_threads[use_cpu]) {
PWRN("invalid CPU parameter used in pager object");
warning("invalid CPU parameter used in pager object");
return Pager_capability();
}
Native_capability pager_thread_cap =

View File

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

View File

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

View File

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

View File

@ -12,7 +12,6 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <base/thread.h>
/* 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)
return Capability_space::import(pt_sel);
PERR("cap_session - cap=%lx:%lx addr=%lx mtd=%lx xpt=%lx res=%u",
ec_sel, ep.local_name(), entry, mtd, pt_sel, res);
error("cap alloc - "
"cap=", Hex(ec_sel), ":", Hex(ep.local_name()), " "
"entry=", Hex(entry), " "
"mtd=", Hex(mtd), " "
"xpt=", Hex(pt_sel), " "
"res=", res);
_list.remove(pt_cap);
destroy(&_slab, pt_cap);
@ -72,7 +76,7 @@ void Rpc_cap_factory::free(Native_capability cap)
return;
}
}
PDBG("invalid cap object");
warning("attempt to free invalid cap object");
}

View File

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

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;
if (num_data_words*sizeof(mword_t) > rcv_msg.capacity()) {
PERR("receive message buffer too small msg size=%zx, buf size=%zd",
num_data_words*sizeof(mword_t), rcv_msg.capacity());
error("receive message buffer too small msg "
"size=", num_data_words*sizeof(mword_t), " "
"buf size=", rcv_msg.capacity());
num_data_words = rcv_msg.capacity()/sizeof(mword_t);
}
@ -91,7 +92,7 @@ static inline bool copy_msgbuf_to_utcb(Nova::Utcb &utcb,
enum { NUM_MSG_REGS = 256 };
if (num_msg_words > NUM_MSG_REGS) {
PERR("Message does not fit into UTCB message registers\n");
error("message does not fit into UTCB message registers");
num_msg_words = NUM_MSG_REGS;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <base/log.h>
#include <base/allocator_avl.h>
#include <base/sleep.h>
#include <util/misc_math.h>
@ -21,6 +21,7 @@
#include <base/internal/crt0.h>
#include <base/internal/stack_area.h>
#include <base/internal/native_utcb.h>
#include <base/internal/globals.h>
/* core includes */
#include <core_parent.h>
@ -38,8 +39,6 @@ namespace Okl4 {
using namespace Genode;
static const bool verbose_boot_info = false;
enum { MAX_BOOT_MODULES = 64 };
enum { MAX_BOOT_MODULE_NAME_LEN = 32 };
static struct
@ -75,10 +74,6 @@ int Platform::bi_init_mem(Okl4::uintptr_t virt_base, Okl4::uintptr_t virt_end,
Okl4::uintptr_t phys_base, Okl4::uintptr_t phys_end,
const Okl4::bi_user_data_t *data)
{
if (verbose_boot_info)
printf("init_mem: virt=[%08lx,%08lx), phys=[%08lx,%08lx)\n",
virt_base, virt_end, phys_base, phys_end);
Platform *p = (Platform *)data->user_data;
p->_core_mem_alloc.phys_alloc()->add_range(phys_base, phys_end - phys_base + 1);
p->_core_mem_alloc.virt_alloc()->add_range(virt_base, virt_end - virt_base + 1);
@ -89,10 +84,6 @@ int Platform::bi_init_mem(Okl4::uintptr_t virt_base, Okl4::uintptr_t virt_end,
int Platform::bi_add_virt_mem(Okl4::bi_name_t pool, Okl4::uintptr_t base,
Okl4::uintptr_t end, const Okl4::bi_user_data_t *data)
{
if (verbose_boot_info)
printf("add_virt_mem: pool=%d region=[0x%08lx,0x%08lx], %ld pages\n",
pool, base, end, (end - base + 1)/4096);
/* prevent first page from being added to core memory */
if (base < get_page_size() || end < get_page_size())
return 0;
@ -106,10 +97,6 @@ int Platform::bi_add_virt_mem(Okl4::bi_name_t pool, Okl4::uintptr_t base,
int Platform::bi_add_phys_mem(Okl4::bi_name_t pool, Okl4::uintptr_t base,
Okl4::uintptr_t end, const Okl4::bi_user_data_t *data)
{
if (verbose_boot_info)
printf("add_phys_mem: pool=%d region=[0x%08lx,0x%08lx], %ld pages\n",
pool, base, end, (end - base + 1)/4096);
if (pool == 2) {
Platform *p = (Platform *)data->user_data;
p->_core_mem_alloc.phys_alloc()->add_range(base, end - base + 1);
@ -122,10 +109,6 @@ int Platform::bi_export_object(Okl4::bi_name_t pd, Okl4::bi_name_t obj,
Okl4::bi_export_type_t export_type, char *key,
Okl4::size_t key_len, const Okl4::bi_user_data_t * data)
{
if (verbose_boot_info)
printf("export_object: pd=%d obj=%d type=%d key=\"%s\"\n",
pd, obj, export_type, key);
/*
* We walk the boot info only once and collect all memory section
* objects. Each time we detect a memory section outside of roottask
@ -139,7 +122,7 @@ int Platform::bi_export_object(Okl4::bi_name_t pd, Okl4::bi_name_t obj,
return 0;
if (num_boot_module_objects >= MAX_BOOT_MODULES) {
PERR("Maximum number of boot modules exceeded");
error("maximum number of boot modules exceeded");
return -1;
}
@ -168,10 +151,6 @@ Okl4::bi_name_t Platform::bi_new_ms(Okl4::bi_name_t owner,
Okl4::bi_name_t physpool, Okl4::bi_name_t virtpool,
Okl4::bi_name_t zone, const Okl4::bi_user_data_t *data)
{
if (verbose_boot_info)
printf("new_ms: owner=%d region=[%lx,%lx), flags=%lx, attr=%lx, physpool=%d, virtpool=%d, zone=%d\n",
owner, base, base + size - 1, flags, attr, physpool, virtpool, zone);
/* reset module index (see comment in 'bi_export_object') */
if (owner == 0) num_boot_module_memsects = 0;
@ -179,7 +158,7 @@ Okl4::bi_name_t Platform::bi_new_ms(Okl4::bi_name_t owner,
if (virtpool != 3) return 0;
if (num_boot_module_memsects >= MAX_BOOT_MODULES) {
PERR("Maximum number of boot modules exceeded");
error("maximum number of boot modules exceeded");
return -1;
}
@ -237,8 +216,6 @@ Platform::Platform() :
* the location of the boot modules.
*/
printf("parsing boot info at 0x%p...\n", (void *)boot_info_addr);
/*
* Initialize callback function for parsing the boot-info
*
@ -281,19 +258,14 @@ Platform::Platform() :
_vm_start = 0x1000;
_vm_size = 0xb0000000 - 0x1000;
/*
* When dumping 'ram_alloc', there are several small blocks in addition
* to the available free memory visible. These small blocks are used to
* hold the meta data for the ROM modules as initialized by '_setup_rom'.
*/
if (verbose_boot_info) {
printf(":phys_alloc: "); (*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
printf(":virt_alloc: "); (*_core_mem_alloc.virt_alloc())()->dump_addr_tree();
printf(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
printf(":io_port: "); _io_port_alloc()->dump_addr_tree();
printf(":irq: "); _irq_alloc()->dump_addr_tree();
printf(":rom_fs: "); _rom_fs.print_fs();
}
init_log();
log(":phys_alloc: "); (*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
log(":virt_alloc: "); (*_core_mem_alloc.virt_alloc())()->dump_addr_tree();
log(":io_mem: "); _io_mem_alloc()->dump_addr_tree();
log(":io_port: "); _io_port_alloc()->dump_addr_tree();
log(":irq: "); _irq_alloc()->dump_addr_tree();
log(":rom_fs: "); _rom_fs.print_fs();
/* setup task object for core task */
_core_pd = new(core_mem_alloc()) Platform_pd(true);

View File

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

View File

@ -1,4 +1,3 @@
/*
* \brief OKL4 thread facility
* \author Julian Stecklina
@ -15,7 +14,7 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <base/log.h>
#include <util/string.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)
{
if (!_platform_pd) {
PWRN("thread %d is not bound to a PD", _thread_id);
warning("thread ", _thread_id, " is not bound to a PD");
return -1;
}
@ -89,8 +88,7 @@ int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
scheduler, pager, exception_handler,
resources, (void *)utcb_location);
if (ret != 1) {
PERR("L4_ThreadControl returned %d, error code=%d",
ret, (int)L4_ErrorCode());
error("L4_ThreadControl returned ", ret, ", error=", ret, L4_ErrorCode());
return -1;
}
@ -111,7 +109,7 @@ int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
/* assign priority */
if (!L4_Set_Priority(new_thread_id,
Cpu_session::scale_priority(DEFAULT_PRIORITY, _priority)))
PWRN("Could not set thread prioritry to default");
warning("could not set thread prioritry to default");
set_l4_thread_id(new_thread_id);
return 0;
@ -145,7 +143,7 @@ void Platform_thread::unbind()
L4_nilthread, L4_nilthread, L4_nilthread, ~0, 0);
if (res != 1)
PERR("Deleting thread 0x%08lx failed. Continuing...", _l4_thread_id.raw);
error("deleting thread ", Hex(_l4_thread_id.raw), " failed");
_thread_id = THREAD_INVALID;
_l4_thread_id = L4_nilthread;

View File

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

View File

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

View File

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

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