base-*: remove usage of printf

base generic code:
  * Remove unused verbosity code from mmio framework
  * Remove escape sequence end heuristic from LOG
  * replace Core_console with Core_log (no format specifiers)
  * move test/printf to test/log
  * remove `printf()` tests from the log test
  * check for exact match of the log test output
base-fiasco:
  * remove unused Fiasco::print_l4_threadid function
base-nova:
  * remove unused hexdump utility from core
base-hw:
  * remove unused Kernel::Thread::_print_* debug utilities
  * always print resource summary of core during startup
  * remove Kernel::Ipc_node::pd_label (not used anymore)
base*:
  * Turn `printf`,`PWRN`, etc. calls into their log equivalents

Ref #1987
Fix #2119
This commit is contained in:
Stefan Kalkowski 2016-10-10 16:22:43 +02:00 committed by Christian Helmuth
parent e864e84c5a
commit 2a2e5c2df4
126 changed files with 639 additions and 1020 deletions

View File

@ -0,0 +1,20 @@
/*
* \brief Kernel-specific core's 'log' backend
* \author Stefan Kalkowski
* \date 2016-10-10
*/
/*
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* core includes */
#include <core_log.h>
namespace Fiasco {
#include <l4/sys/kdebug.h>
}
void Genode::Core_log::out(char const c) { Fiasco::outchar(c); }

View File

@ -18,7 +18,6 @@
/* Genode includes */
#include <base/stdint.h>
#include <base/printf.h>
#include <region_map/region_map.h>
#include <util/touch.h>

View File

@ -338,7 +338,7 @@ static Fiasco::l4_kernel_info_t *get_kip()
amok = true;
}
if (!l4_ipc_fpage_received(r)) {
printf("No fpage received\n");
warning("No fpage received");
amok = true;
}

View File

@ -35,8 +35,9 @@ void Rm_client::unmap(addr_t core_local_base, addr_t virt_base, size_t size)
*/
if (verbose_unmap) {
Fiasco::l4_threadid_t tid; tid.raw = badge();
printf("RM client %p (%x.%x) unmap core-local [%lx,%lx)\n",
this, tid.id.task, tid.id.lthread, core_local_base, core_local_base + size);
log("RM client ", this, " (", (unsigned)tid.id.task, ".",
(unsigned)tid.id.lthread, ") unmap core-local [",
Hex(core_local_base), ",", Hex(core_local_base + size), ")");
}
using namespace Fiasco;

View File

@ -3,7 +3,7 @@ TARGET = core
GEN_CORE_DIR = $(BASE_DIR)/src/core
SRC_CC += stack_area.cc \
core_printf.cc \
core_log.cc \
core_region_map.cc \
core_rpc_cap_alloc.cc \
cpu_session_component.cc \
@ -74,5 +74,4 @@ vpath default_log.cc $(GEN_CORE_DIR)
vpath dump_alloc.cc $(GEN_CORE_DIR)
vpath stack_area.cc $(GEN_CORE_DIR)
vpath pager_ep.cc $(GEN_CORE_DIR)
vpath core_printf.cc $(BASE_DIR)/src/lib/base
vpath %.cc $(REP_DIR)/src/core

View File

@ -1,35 +0,0 @@
/*
* \brief Console backend using the Fiasco kernel debugger
* \author Norman Feske
* \date 2006-04-08
*/
/*
* Copyright (C) 2006-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
#define _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
/* Fiasco includes */
namespace Fiasco {
#include <l4/sys/kdebug.h>
}
/* Genode includes */
#include <base/console.h>
namespace Genode {
class Core_console : public Console
{
protected:
void _out_char(char c) { Fiasco::outchar(c); }
};
}
#endif /* _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_ */

View File

@ -14,20 +14,9 @@
#ifndef _INCLUDE__FIASCO__THREAD_HELPER_H_
#define _INCLUDE__FIASCO__THREAD_HELPER_H_
#include <base/printf.h>
namespace Fiasco {
#include <l4/sys/types.h>
inline void print_l4_threadid(l4_threadid_t t)
{
Genode::printf("THREAD %x.%02x\n", t.id.task, t.id.lthread);
Genode::printf(" unsigned version_low:10 = %x\n", t.id.version_low);
Genode::printf(" unsigned lthread:7 = %x\n", t.id.lthread);
Genode::printf(" unsigned task:11 = %x\n", t.id.task);
}
/**
* Sigma0 thread ID
*

View File

@ -15,7 +15,6 @@
#include <base/cancelable_lock.h>
#include <cpu/atomic.h>
#include <cpu/memory_barrier.h>
#include <base/printf.h>
/* L4/Fiasco includes */
namespace Fiasco {

View File

@ -0,0 +1,20 @@
/*
* \brief Kernel-specific core's 'log' backend
* \author Stefan Kalkowski
* \date 2016-10-10
*/
/*
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* core includes */
#include <core_log.h>
namespace Fiasco {
#include <l4/sys/kdebug.h>
}
void Genode::Core_log::out(char const c) { Fiasco::outchar(c); }

View File

@ -17,7 +17,6 @@
#define _CORE__INCLUDE__IRQ_OBJECT_H_
/* Genode includes */
#include <base/printf.h>
#include <irq_session/irq_session.h>
#include <cap_index.h>

View File

@ -56,7 +56,8 @@ namespace Genode {
L4_BASE_TASK_CAP,
snd_fpage,
to_addr + offset))) {
PWRN("could not locally remap 0x%lx to 0x%lx", from_addr, to_addr);
warning("could not locally remap ", (void*)from_addr, " to ",
(void*)to_addr);
return false;
}
}

View File

@ -19,7 +19,6 @@
/* Genode includes */
#include <base/stdint.h>
#include <base/printf.h>
#include <rm_session/rm_session.h>
#include <util/touch.h>

View File

@ -12,7 +12,7 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <base/log.h>
/* core includes */
#include <native_cpu_component.h>
@ -42,7 +42,7 @@ void Genode::Native_cpu_component::enable_vcpu(Genode::Thread_capability thread_
l4_msgtag_t tag = l4_thread_vcpu_control(tid, vcpu_state);
if (l4_msgtag_has_error(tag))
PWRN("l4_thread_vcpu_control failed");
warning("l4_thread_vcpu_control failed");
};
_thread_ep.apply(thread_cap, lambda);
}
@ -81,7 +81,7 @@ Genode::Native_capability Genode::Native_cpu_component::alloc_irq()
Cap_index* i = cap_map()->insert(platform_specific()->cap_id_alloc()->alloc());
l4_msgtag_t res = l4_factory_create_irq(L4_BASE_FACTORY_CAP, i->kcap());
if (l4_error(res)) {
PWRN("Allocation of irq object failed!");
warning("Allocation of irq object failed!");
return Genode::Native_capability();
}

View File

@ -48,8 +48,8 @@ int Platform_thread::start(void *ip, void *sp)
l4_thread_control_bind((l4_utcb_t *)_utcb, _platform_pd->native_task().data()->kcap());
l4_msgtag_t tag = l4_thread_control_commit(_thread.local.data()->kcap());
if (l4_msgtag_has_error(tag)) {
PWRN("l4_thread_control_commit for %lx failed!",
(unsigned long) _thread.local.data()->kcap());
warning("l4_thread_control_commit for ",
Hex(_thread.local.data()->kcap()), " failed!");
return -1;
}
@ -59,7 +59,7 @@ int Platform_thread::start(void *ip, void *sp)
tag = l4_thread_ex_regs(_thread.local.data()->kcap(), (l4_addr_t) ip,
(l4_addr_t) sp, 0);
if (l4_msgtag_has_error(tag)) {
PWRN("l4_thread_ex_regs failed!");
warning("l4_thread_ex_regs failed!");
return -1;
}
@ -161,8 +161,8 @@ void Platform_thread::unbind()
l4_thread_control_pager(_gate.remote);
l4_thread_control_exc_handler(_gate.remote);
if (l4_msgtag_has_error(l4_thread_control_commit(_thread.local.data()->kcap())))
PWRN("l4_thread_control_commit for %lx failed!",
(unsigned long) _thread.local.data()->kcap());
warning("l4_thread_control_commit for ",
Hex(_thread.local.data()->kcap()), " failed!");
/* now force it into a pagefault */
l4_thread_ex_regs(_thread.local.data()->kcap(), 0, 0, L4_THREAD_EX_REGS_CANCEL);
@ -219,7 +219,8 @@ void Platform_thread::affinity(Affinity::Location location)
l4_msgtag_t tag = l4_scheduler_run_thread(L4_BASE_SCHEDULER_CAP,
_thread.local.data()->kcap(), &params);
if (l4_error(tag))
PWRN("setting affinity of %lx to %d failed!", _thread.local.data()->kcap(), cpu);
warning("setting affinity of ", Hex(_thread.local.data()->kcap()),
" to ", cpu, " failed!");
}
@ -254,12 +255,12 @@ void Platform_thread::_finalize_construction(const char *name)
l4_msgtag_t tag = l4_factory_create_irq(L4_BASE_FACTORY_CAP,
_irq.local.data()->kcap());
if (l4_msgtag_has_error(tag))
PWRN("creating thread's irq failed");
warning("creating thread's irq failed");
/* attach thread to irq */
tag = l4_irq_attach(_irq.local.data()->kcap(), 0, _thread.local.data()->kcap());
if (l4_msgtag_has_error(tag))
PWRN("attaching thread's irq failed");
warning("attaching thread's irq failed");
/* set human readable name in kernel debugger */
strncpy(_name, name, sizeof(_name));

View File

@ -92,7 +92,7 @@ Native_capability Rpc_cap_factory::alloc(Native_capability ep)
Native_capability cap;
if (!ep.valid()) {
PWRN("Invalid reference capability!");
warning("Invalid reference capability!");
return cap;
}
@ -110,7 +110,7 @@ Native_capability Rpc_cap_factory::alloc(Native_capability ep)
Core_cap_index* idx = static_cast<Core_cap_index*>(cap_map()->insert(id));
if (!idx) {
PWRN("Out of capability indices!");
warning("Out of capability indices!");
platform_specific()->cap_id_alloc()->free(id);
return cap;
}
@ -164,7 +164,7 @@ void Rpc_cap_factory::free(Native_capability cap)
if (e) {
_pool.remove(e);
} else
PWRN("Could not find capability to be deleted");
warning("Could not find capability to be deleted");
});
if (entry) destroy(_md_alloc, entry);
}

View File

@ -6,7 +6,7 @@ GEN_CORE_DIR = $(BASE_DIR)/src/core
LIBS += base-common
SRC_CC += stack_area.cc \
core_printf.cc \
core_log.cc \
core_region_map.cc \
core_rpc_cap_alloc.cc \
cpu_session_component.cc \
@ -69,6 +69,5 @@ vpath rom_session_component.cc $(GEN_CORE_DIR)
vpath trace_session_component.cc $(GEN_CORE_DIR)
vpath core_rpc_cap_alloc.cc $(GEN_CORE_DIR)
vpath core_region_map.cc $(GEN_CORE_DIR)
vpath core_printf.cc $(BASE_DIR)/src/lib/base
vpath %.cc $(REP_DIR)/src/core
vpath %.cc $(REP_DIR)/src/lib/base

View File

@ -33,7 +33,7 @@ using namespace Genode;
void Thread::_deinit_platform_thread()
{
PWRN("%s: not implemented yet!", __func__);
warning(__func__, ": not implemented yet!");
}

View File

@ -1,35 +0,0 @@
/*
* \brief Console backend using the Fiasco kernel debugger
* \author Norman Feske
* \date 2006-04-08
*/
/*
* Copyright (C) 2006-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
#define _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
/* Fiasco includes */
namespace Fiasco {
#include <l4/sys/kdebug.h>
}
/* Genode includes */
#include <base/console.h>
namespace Genode {
class Core_console : public Console
{
protected:
void _out_char(char c) { Fiasco::outchar(c); }
};
}
#endif /* _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_ */

View File

@ -15,7 +15,6 @@
/* Genode includes */
#include <base/thread.h>
#include <base/printf.h>
#include <base/sleep.h>
#include <base/env.h>
#include <cpu_thread/client.h>

View File

@ -17,7 +17,6 @@ INC_DIR += $(BASE_DIR)/../base-hw/src/include
INC_DIR += $(BASE_DIR)/src/include
# add C++ sources
SRC_CC += console.cc
SRC_CC += cpu_session_component.cc
SRC_CC += cpu_session_support.cc
SRC_CC += cpu_thread_component.cc

View File

@ -1,91 +0,0 @@
/*
* \brief Genode-console backend
* \author Martin Stein
* \date 2011-10-17
*/
/*
* Copyright (C) 2011-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* Genode includes */
#include <base/console.h>
#include <base/printf.h>
/* core includes */
#include <serial.h>
/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>
namespace Genode
{
/**
* Platform specific Genode console
*/
class Platform_console : public Console, public Serial
{
enum { BAUD_RATE = 115200 };
protected:
/**
* Print a char to the console
*/
void _out_char(char c)
{
enum {
ASCII_LINE_FEED = 10,
ASCII_CARRIAGE_RETURN = 13,
};
/* auto complete new line commands */
if (c == ASCII_LINE_FEED)
Serial::put_char(ASCII_CARRIAGE_RETURN);
/* print char */
Serial::put_char(c);
}
public:
/**
* Constructor
*/
Platform_console() : Serial(BAUD_RATE) { }
};
}
using namespace Genode;
/**
* Static object to print log output
*/
static Platform_console * platform_console()
{
return unmanaged_singleton<Platform_console>();
}
/****************************
** Genode print functions **
****************************/
void Genode::printf(const char *format, ...)
{
va_list list;
va_start(list, format);
platform_console()->vprintf(format, list);
va_end(list);
}
void Genode::vprintf(const char *format, va_list list)
{
platform_console()->vprintf(format, list);
}

View File

@ -0,0 +1,72 @@
/*
* \brief Access to the core's log facility
* \author Norman Feske
* \author Stefan Kalkowski
* \date 2016-05-03
*/
/*
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* Genode includes */
#include <base/log.h>
/* base-internal includes */
#include <base/internal/globals.h>
#include <base/internal/output.h>
#include <base/internal/unmanaged_singleton.h>
#include <core_log.h>
#include <serial.h>
#include <kernel/log.h>
using namespace Genode;
static Log *log_ptr;
Log &Log::log() { return *log_ptr; }
static void out_char(char const c)
{
enum {
ASCII_LINE_FEED = 10,
ASCII_CARRIAGE_RETURN = 13,
BAUD_RATE = 115200
};
Serial & serial = *unmanaged_singleton<Serial>(BAUD_RATE);
if (c == ASCII_LINE_FEED) serial.put_char(ASCII_CARRIAGE_RETURN);
serial.put_char(c);
}
void Genode::Core_log::out(char const c) { out_char(c); }
void Genode::init_log()
{
/* ignore subsequent calls */
if (log_ptr) return;
struct Write_fn
{
Core_log log;
void operator () (char const *s) { log.output(s); }
};
typedef Buffered_output<512, Write_fn> Buffered_log_output;
static Buffered_log_output *buffered_log_output =
unmanaged_singleton<Buffered_log_output>(Write_fn());
log_ptr = unmanaged_singleton<Log>(*buffered_log_output);
}
void Kernel::log(char const c) { out_char(c); }

View File

@ -200,8 +200,7 @@ class Kernel::Ipc_node : public Ipc_node_queue::Element
** Accessors **
***************/
Pd * const pd() const { return _pd; }
char const * pd_label() const;
Pd * const pd() const { return _pd; }
Genode::Native_utcb * utcb() { return _utcb; }
};

View File

@ -0,0 +1,19 @@
/*
* \brief Kernel backend log messages
* \author Stefan Kalkowski
* \date 2016-10-10
*/
/*
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _CORE__INCLUDE__KERNEL__LOG_H_
#define _CORE__INCLUDE__KERNEL__LOG_H_
namespace Kernel { void log(char const); }
#endif

View File

@ -86,8 +86,6 @@ class Kernel::Thread
private:
enum { START_VERBOSE = 0 };
enum State
{
ACTIVE = 1,
@ -195,23 +193,6 @@ class Kernel::Thread
*/
size_t _core_to_kernel_quota(size_t const quota) const;
/**
* Print the activity of the thread
*
* \param printing_thread wether this thread caused the debugging
*/
void _print_activity(bool const printing_thread);
/**
* Print the activity of the thread when it awaits a message
*/
void _print_activity_when_awaits_ipc();
/**
* Print activity info that is printed regardless of the thread state
*/
void _print_common_activity();
/*********************************************************
** Kernel-call back-ends, see kernel-interface headers **
@ -340,6 +321,8 @@ class Kernel::Thread
static void syscall_destroy(Thread * thread) {
call(call_id_delete_thread(), (Call_arg)thread); }
void print(Genode::Output &out) const;
/*************
** Cpu_job **

View File

@ -14,9 +14,6 @@
#ifndef _CORE__INCLUDE__MAP_LOCAL_H_
#define _CORE__INCLUDE__MAP_LOCAL_H_
/* Genode includes */
#include <base/printf.h>
/* core includes */
#include <page_flags.h>

View File

@ -17,7 +17,6 @@
/* Genode includes */
#include <util/register.h>
#include <base/printf.h>
/* core includes */
#include <util.h>

View File

@ -17,7 +17,6 @@
/* Genode includes */
#include <util/misc_math.h>
#include <util/register.h>
#include <base/printf.h>
/* base-hw includes */
#include <page_flags.h>

View File

@ -64,13 +64,13 @@ class Genode::Vm_session_component
void pause(void);
void attach(Dataspace_capability ds_cap, addr_t vm_addr) {
PWRN("Not implemented for TrustZone case"); }
warning("Not implemented for TrustZone case"); }
void attach_pic(addr_t vm_addr) {
PWRN("Not implemented for TrustZone case"); }
warning("Not implemented for TrustZone case"); }
void detach(addr_t vm_addr, size_t size) {
PWRN("Not implemented for TrustZone case"); }
warning("Not implemented for TrustZone case"); }
};
#endif /* _CORE__INCLUDE__SPEC__ARM_V7__TRUSTZONE__VM_SESSION_COMPONENT_H_ */

View File

@ -18,7 +18,6 @@
#include <kernel/types.h>
/* Genode includes */
#include <base/printf.h>
#include <base/stdint.h>
/* Core includes */

View File

@ -15,12 +15,8 @@
#define _CORE__INCLUDE__SPEC__X86_64__MUEN__SINFO_INSTANCE_H_
/* base includes */
#include <base/printf.h>
#include <muen/sinfo.h>
/* core includes */
#include <board.h>
namespace Genode
{
/**

View File

@ -51,8 +51,8 @@ class Genode::Vm_session_component
void exception_handler(Signal_context_capability handler)
{
if (!create(&_state, Capability_space::capid(handler), nullptr))
PWRN("Cannot instantiate vm kernel object, "
"invalid signal context?");
warning("Cannot instantiate vm kernel object, "
"invalid signal context?");
}
void run(void)

View File

@ -21,7 +21,6 @@
/* Genode includes */
#include <util/mmio.h>
#include <base/stdint.h>
#include <base/printf.h>
/* core includes */
#include <port_io.h>

View File

@ -17,7 +17,6 @@
/* Genode includes */
#include <util/misc_math.h>
#include <util/register.h>
#include <base/printf.h>
#include <assert.h>
/* base-hw includes */

View File

@ -16,7 +16,6 @@
/* Genode includes */
#include <rm_session/rm_session.h>
#include <base/printf.h>
/* base-internal includes */
#include <base/internal/page_size.h>

View File

@ -84,7 +84,7 @@ void Cpu_job::_interrupt(unsigned const cpu_id)
/* it needs to be a user interrupt */
User_irq * irq = User_irq::object(irq_id);
if (irq) irq->occurred();
else PWRN("Unknown interrupt %u", irq_id);
else Genode::warning("Unknown interrupt ", irq_id);
}
/* end interrupt request at controller */

View File

@ -22,6 +22,7 @@
/* base includes */
#include <base/internal/unmanaged_singleton.h>
#include <base/internal/globals.h>
using namespace Kernel;
@ -59,7 +60,9 @@ extern "C" void init_kernel()
Core_thread::singleton();
Genode::printf("\nkernel initialized\n");
Genode::init_log();
Genode::log("");
Genode::log("kernel initialized");
kernel();
}

View File

@ -252,10 +252,6 @@ void Ipc_node::cancel_waiting()
}
char const * Ipc_node::pd_label() const {
return (_pd) ? _pd->platform_pd()->label() : "?"; }
Ipc_node::~Ipc_node()
{
_cancel_request_queue();

View File

@ -26,6 +26,7 @@
#include <kernel/kernel.h>
#include <kernel/thread.h>
#include <kernel/irq.h>
#include <kernel/log.h>
#include <map_local.h>
#include <platform_pd.h>
#include <pic.h>
@ -176,7 +177,7 @@ Cpu_job * Thread::helping_sink() {
void Thread::_receive_yielded_cpu()
{
if (_state == AWAITS_RESUME) { _become_active(); }
else { PWRN("failed to receive yielded CPU"); }
else { Genode::warning("failed to receive yielded CPU"); }
}
@ -216,7 +217,7 @@ void Thread::_call_start_thread()
/* lookup CPU */
Cpu * const cpu = cpu_pool()->cpu(user_arg_2());
if (!cpu) {
PWRN("failed to lookup CPU");
Genode::warning("failed to lookup CPU");
user_arg_0(-2);
return;
}
@ -230,15 +231,6 @@ void Thread::_call_start_thread()
/* join protection domain */
thread->_pd = (Pd *) user_arg_3();
thread->_pd->admit(thread);
/* print log message */
if (START_VERBOSE) {
Genode::printf("start thread '%s' in program '%s' ",
thread->label(), thread->pd_label());
if (NR_OF_CPUS) {
Genode::printf("on CPU %u/%u ", cpu->id(), NR_OF_CPUS); }
Genode::printf("\n");
}
thread->Ipc_node::_init((Native_utcb *)user_arg_4(), this);
thread->_become_active();
}
@ -262,8 +254,8 @@ void Thread::_call_resume_local_thread()
/* lookup thread */
Thread * const thread = pd()->cap_tree().find<Thread>(user_arg_1());
if (!thread || pd() != thread->pd()) {
PWRN("%s -> %s: failed to lookup thread %u to resume it",
pd_label(), label(), (capid_t)user_arg_1());
warning(*this, ": failed to lookup thread ", (unsigned)user_arg_1(),
" to resume it");
_stop();
return;
}
@ -319,9 +311,8 @@ void Thread::timeout_triggered()
{
Signal_context * const c =
pd()->cap_tree().find<Signal_context>(_timeout_sigid);
if(!c || c->submit(1)) {
PWRN("%s -> %s: failed to submit timeout signal", pd_label(), label());
}
if (!c || c->submit(1))
Genode::warning(*this, ": failed to submit timeout signal");
}
@ -330,8 +321,8 @@ void Thread::_call_send_request_msg()
Object_identity_reference * oir = pd()->cap_tree().find(user_arg_1());
Thread * const dst = (oir) ? oir->object<Thread>() : nullptr;
if (!dst) {
PWRN("%s -> %s: cannot send to unknown recipient %llu",
pd_label(), label(), (unsigned long long)user_arg_1());
Genode::warning(*this, ": cannot send to unknown recipient ",
(unsigned)user_arg_1());
_become_inactive(AWAITS_IPC);
return;
}
@ -386,60 +377,7 @@ Signal_context * const Thread_event::signal_context() const {
return _signal_context; }
void Thread::_print_activity(bool const printing_thread)
{
Genode::printf("\033[33m%s -> %s:\033[0m", pd_label(), label());
switch (_state) {
case AWAITS_START: {
Genode::printf("\033[32m init\033[0m");
break; }
case ACTIVE: {
if (!printing_thread) { Genode::printf("\033[32m run\033[0m"); }
else { Genode::printf("\033[32m debug\033[0m"); }
break; }
case AWAITS_IPC: {
_print_activity_when_awaits_ipc();
break; }
case AWAITS_RESUME: {
Genode::printf("\033[32m await RES\033[0m");
break; }
case AWAITS_SIGNAL: {
Genode::printf("\033[32m await SIG\033[0m");
break; }
case AWAITS_SIGNAL_CONTEXT_KILL: {
Genode::printf("\033[32m await SCK\033[0m");
break; }
case STOPPED: {
Genode::printf("\033[32m stop\033[0m");
break; }
}
_print_common_activity();
}
void Thread::_print_common_activity()
{
Genode::printf(" ip %lx sp %lx\n", ip, sp);
}
void Thread::_print_activity_when_awaits_ipc()
{
switch (Ipc_node::state()) {
case AWAIT_REPLY: {
Thread * const server = dynamic_cast<Thread *>(Ipc_node::callee());
Genode::printf("\033[32m await RPL %s -> %s\033[0m",
server->pd_label(), server->label());
break; }
case AWAIT_REQUEST: {
Genode::printf("\033[32m await REQ\033[0m");
break; }
default: break;
}
}
void Thread::_call_print_char() { Genode::printf("%c", (char)user_arg_1()); }
void Thread::_call_print_char() { Kernel::log((char)user_arg_1()); }
void Thread::_call_await_signal()
@ -447,14 +385,14 @@ void Thread::_call_await_signal()
/* lookup receiver */
Signal_receiver * const r = pd()->cap_tree().find<Signal_receiver>(user_arg_1());
if (!r) {
PWRN("%s -> %s: cannot await, unknown signal receiver %u",
pd_label(), label(), (capid_t)user_arg_1());
Genode::warning(*this, ": cannot await, unknown signal receiver ",
(unsigned)user_arg_1());
user_arg_0(-1);
return;
}
/* register handler at the receiver */
if (r->add_handler(this)) {
PWRN("failed to register handler at signal receiver");
Genode::warning("failed to register handler at signal receiver");
user_arg_0(-1);
return;
}
@ -467,15 +405,14 @@ void Thread::_call_submit_signal()
/* lookup signal context */
Signal_context * const c = pd()->cap_tree().find<Signal_context>(user_arg_1());
if(!c) {
PWRN("%s -> %s: cannot submit unknown signal context",
pd_label(), label());
Genode::warning(*this, ": cannot submit unknown signal context");
user_arg_0(-1);
return;
}
/* trigger signal context */
if (c->submit(user_arg_2())) {
PWRN("failed to submit signal context");
Genode::warning("failed to submit signal context");
user_arg_0(-1);
return;
}
@ -488,8 +425,7 @@ void Thread::_call_ack_signal()
/* lookup signal context */
Signal_context * const c = pd()->cap_tree().find<Signal_context>(user_arg_1());
if (!c) {
PWRN("%s -> %s: cannot ack unknown signal context",
pd_label(), label());
Genode::warning(*this, ": cannot ack unknown signal context");
return;
}
@ -503,15 +439,14 @@ void Thread::_call_kill_signal_context()
/* lookup signal context */
Signal_context * const c = pd()->cap_tree().find<Signal_context>(user_arg_1());
if (!c) {
PWRN("%s -> %s: cannot kill unknown signal context",
pd_label(), label());
Genode::warning(*this, ": cannot kill unknown signal context");
user_arg_0(-1);
return;
}
/* kill signal context */
if (c->kill(this)) {
PWRN("failed to kill signal context");
Genode::warning("failed to kill signal context");
user_arg_0(-1);
return;
}
@ -522,8 +457,7 @@ void Thread::_call_new_irq()
{
Signal_context * const c = pd()->cap_tree().find<Signal_context>(user_arg_3());
if (!c) {
PWRN("%s -> %s: invalid signal context for interrupt",
pd_label(), label());
Genode::warning(*this, ": invalid signal context for interrupt");
user_arg_0(-1);
return;
}
@ -545,7 +479,7 @@ void Thread::_call_new_obj()
if (!thread ||
(static_cast<Core_object<Thread>*>(thread)->capid() != ref->capid())) {
if (thread)
PWRN("faked thread %s -> %s", thread->pd_label(), thread->label());
Genode::warning("faked thread", thread);
user_arg_0(cap_id_invalid());
return;
}
@ -610,8 +544,7 @@ void Thread::_call()
default:
/* check wether this is a core thread */
if (!_core()) {
PWRN("%s -> %s: not entitled to do kernel call",
pd_label(), label());
Genode::warning(*this, ": not entitled to do kernel call");
_stop();
return;
}
@ -648,7 +581,7 @@ void Thread::_call()
case call_id_new_obj(): _call_new_obj(); return;
case call_id_delete_obj(): _call_delete_obj(); return;
default:
PWRN("%s -> %s: unknown kernel call", pd_label(), label());
Genode::warning(*this, ": unknown kernel call");
_stop();
return;
}
@ -674,6 +607,14 @@ Thread_event Thread::* Thread::_event(unsigned const id) const
}
void Thread::print(Genode::Output &out) const
{
Genode::print(out, (_pd) ? _pd->platform_pd()->label() : "?");
Genode::print(out, " -> ");
Genode::print(out, label());
}
/*****************
** Core_thread **
*****************/

View File

@ -13,8 +13,6 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <base/sleep.h>
#include <base/log.h>
/* core includes */
@ -133,7 +131,6 @@ Platform::Platform()
* Core mem alloc must come first because it is
* used by the other allocators.
*/
enum { VERBOSE = 0 };
init_alloc(_core_mem_alloc.phys_alloc(), _ram_regions,
_core_only_ram_regions, get_page_size_log2());
init_alloc(_core_mem_alloc.virt_alloc(), virt_region,
@ -165,32 +162,30 @@ Platform::Platform()
_init_additional();
/* print ressource summary */
if (VERBOSE) {
printf("Core virtual memory allocator\n");
printf("---------------------\n");
(*_core_mem_alloc.virt_alloc())()->dump_addr_tree();
printf("\n");
printf("RAM memory allocator\n");
printf("---------------------\n");
(*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
printf("\n");
printf("IO memory allocator\n");
printf("-------------------\n");
_io_mem_alloc()->dump_addr_tree();
printf("\n");
printf("IO port allocator\n");
printf("-------------------\n");
_io_port_alloc()->dump_addr_tree();
printf("\n");
printf("IRQ allocator\n");
printf("-------------------\n");
_irq_alloc()->dump_addr_tree();
printf("\n");
printf("ROM filesystem\n");
printf("--------------\n");
_rom_fs.print_fs();
printf("\n");
}
log("Core virtual memory allocator");
log("---------------------");
(*_core_mem_alloc.virt_alloc())()->dump_addr_tree();
log("\n");
log("RAM memory allocator");
log("---------------------");
(*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
log("");
log("IO memory allocator");
log("-------------------");
_io_mem_alloc()->dump_addr_tree();
log("");
log("IO port allocator");
log("-------------------");
_io_port_alloc()->dump_addr_tree();
log("");
log("IRQ allocator");
log("-------------------");
_irq_alloc()->dump_addr_tree();
log("");
log("ROM filesystem");
log("--------------");
_rom_fs.print_fs();
log("");
}

View File

@ -63,7 +63,7 @@ void Pager_entrypoint::entry()
/* fetch fault data */
Platform_thread * const pt = (Platform_thread *)po->badge();
if (!pt) {
PWRN("failed to get platform thread of faulter");
Genode::warning("failed to get platform thread of faulter");
return;
}

View File

@ -39,15 +39,15 @@ void Thread::exception(unsigned const cpu)
return;
case UNDEFINED_INSTRUCTION:
if (_cpu->retry_undefined_instr(*this)) { return; }
Genode::warning(pd_label(), " -> ", label(), ": "
"undefined instruction at ip=", Genode::Hex(ip));
Genode::warning(*this, ": undefined instruction at ip=",
Genode::Hex(ip));
_stop();
return;
case RESET:
return;
default:
Genode::warning(pd_label(), " -> ", label(), ": "
"triggered an unknown exception ", cpu_exception);
Genode::warning(*this, ": triggered an unknown exception ",
cpu_exception);
_stop();
return;
}
@ -72,7 +72,7 @@ void Thread::_mmu_exception()
_fault.submit();
return;
}
Genode::error(pd_label(), " -> ", label(), ": raised unhandled ",
Genode::error(*this, ": raised unhandled ",
cpu_exception == DATA_ABORT ? "data abort" : "prefetch abort", " "
"DFSR=", Genode::Hex(Cpu::Dfsr::read()), " "
"ISFR=", Genode::Hex(Cpu::Ifsr::read()), " "

View File

@ -63,7 +63,7 @@ void Vm::proceed(unsigned const cpu)
unsigned const irq = _state->irq_injection;
if (irq) {
if (secure_irq(irq)) {
PWRN("Refuse to inject secure IRQ into VM");
Genode::warning("Refuse to inject secure IRQ into VM");
} else {
pic()->trigger(irq);
_state->irq_injection = 0;

View File

@ -23,8 +23,8 @@ void Vm_session_component::exception_handler(Signal_context_capability handler)
if (!create((void*)_ds.core_local_addr(), Capability_space::capid(handler),
nullptr))
{
PWRN("Cannot instantiate vm kernel object twice,"
"or invalid signal context?");
warning("Cannot instantiate vm kernel object twice,"
"or invalid signal context?");
}
}

View File

@ -12,7 +12,6 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <kernel/interface.h>
/* Core includes */

View File

@ -35,8 +35,8 @@ void Thread::exception(unsigned const cpu)
_mmu_exception();
break;
default:
PWRN("%s -> %s: unhandled exception %lu at ip=%lx addr=%lx",
pd_label(), label(), cpu_exception, ip, Cpu::sbadaddr());
Genode::warning(*this, ": unhandled exception ", cpu_exception,
" at ip=", (void*)ip, " addr=", Cpu::sbadaddr());
_stop();
}
}

View File

@ -24,7 +24,7 @@ void Kernel::Cpu_idle::exception(unsigned const cpu)
return;
}
PWRN("Unknown exception %lu with error code %lu at ip=%p", trapno,
errcode, (void *)ip);
Genode::warning("Unknown exception ", trapno, " with error code ",
errcode, " at ip=", (void *)ip);
assert(0);
}

View File

@ -26,12 +26,11 @@ void Thread::exception(unsigned const cpu)
return;
case NO_MATH_COPROC:
if (_cpu->fpu().fault(*this)) { return; }
PWRN("%s -> %s: FPU error", pd_label(), label());
Genode::warning(*this, ": FPU error");
_stop();
return;
case UNDEFINED_INSTRUCTION:
PWRN("%s -> %s: undefined instruction at ip=%p",
pd_label(), label(), (void*)ip);
Genode::warning(*this, ": undefined instruction at ip=", (void*)ip);
_stop();
return;
case SUPERVISOR_CALL:
@ -42,7 +41,7 @@ void Thread::exception(unsigned const cpu)
_interrupt(cpu);
return;
}
PWRN("%s -> %s: triggered unknown exception %lu with error code %lu"
" at ip=%p", pd_label(), label(), trapno, errcode, (void*)ip);
Genode::warning(*this, ": triggered unknown exception ", trapno,
" with error code ", errcode, " at ip=%p", (void*)ip);
_stop();
}

View File

@ -25,7 +25,7 @@ void Kernel::Cpu_idle::exception(unsigned const cpu)
return;
}
PWRN("Unknown exception %lu with error code %lu at ip=%p", trapno,
errcode, (void *)ip);
Genode::warning("Unknown exception ", trapno, " with error code ", errcode,
" at ip=", (void *)ip);
assert(0);
}

View File

@ -26,12 +26,11 @@ void Thread::exception(unsigned const cpu)
return;
case NO_MATH_COPROC:
if (_cpu->fpu().fault(*this)) { return; }
PWRN("%s -> %s: FPU error", pd_label(), label());
Genode::warning(*this, ": FPU error");
_stop();
return;
case UNDEFINED_INSTRUCTION:
PWRN("%s -> %s: undefined instruction at ip=%p",
pd_label(), label(), (void*)ip);
Genode::warning(*this, ": undefined instruction at ip=", (void*)ip);
_stop();
return;
case SUPERVISOR_CALL:
@ -43,7 +42,7 @@ void Thread::exception(unsigned const cpu)
_interrupt(cpu);
return;
}
PWRN("%s -> %s: triggered unknown exception %lu with error code %lu"
" at ip=%p", pd_label(), label(), trapno, errcode, (void*)ip);
Genode::warning(*this, ": triggered unknown exception ", trapno,
" with error code ", errcode, " at ip=%p", (void*)ip);
_stop();
}

View File

@ -50,8 +50,8 @@ void Kernel::Vm::exception(unsigned const cpu_id)
_context->submit(1);
return;
}
PWRN("VM: triggered unknown exception %lu with error code %lu",
_state->trapno, _state->errcode);
Genode::warning("VM: triggered unknown exception ", _state->trapno,
" with error code ", _state->errcode);
assert(false);
}

View File

@ -81,7 +81,8 @@ Native_region * Platform::_ram_regions(unsigned const i)
}
_regions[i] = { base, size };
} else if (i >= max)
PWRN("physical ram region 0x%llx+0x%llx will be not used", base, size);
warning("physical ram region ", (void*)base, "+", (size_t)size,
" will be not used");
return i < max ? &_regions[i] : nullptr;
}

View File

@ -12,7 +12,6 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <kernel/interface.h>
using namespace Kernel;

View File

@ -12,7 +12,6 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <kernel/interface.h>
using namespace Kernel;

View File

@ -12,7 +12,7 @@
*/
/* Genode includes */
#include <base/printf.h>
#include <base/log.h>
#include <base/thread.h>
#include <base/sleep.h>
#include <timer_session/connection.h>
@ -77,7 +77,7 @@ class Counter : private Thread_deprecated<2 * 1024 * sizeof(Genode::addr_t)>
{
private:
char const _name;
String<64> _name;
unsigned long long volatile _value;
Sync::Signal _sync_sig;
unsigned volatile _stage;
@ -103,7 +103,7 @@ class Counter : private Thread_deprecated<2 * 1024 * sizeof(Genode::addr_t)>
public:
Counter(char const name, size_t const weight,
Counter(char const *name, size_t const weight,
Sync::Session * const sync)
:
Thread_deprecated(weight, "counter"), _name(name), _value(0) ,
@ -123,7 +123,7 @@ class Counter : private Thread_deprecated<2 * 1024 * sizeof(Genode::addr_t)>
void go() { _stage_1_end.submit(); }
void result() { printf("counter %c %llu\n", _name, _value); }
void result() { log("counter ", _name, " ", _value); }
};
@ -145,8 +145,8 @@ int main()
Timer::Connection timer;
Sync::Connection sync;
Sync::Signal sync_sig(&sync, SYNC_SIG);
Counter counter_a('A', Cpu_session::quota_lim_upscale(10, 100), &sync);
Counter counter_b('B', Cpu_session::quota_lim_upscale(90, 100), &sync);
Counter counter_a("A", Cpu_session::quota_lim_upscale(10, 100), &sync);
Counter counter_b("B", Cpu_session::quota_lim_upscale(90, 100), &sync);
timer.sigh(timer_sig);
@ -168,10 +168,10 @@ int main()
sync_sig.threshold(3);
sync_sig.sync();
Cpu_session::Quota quota = Genode::env()->cpu_session()->quota();
Genode::printf("quota super period %lu\n", quota.super_period_us);
Genode::printf("quota %lu\n", quota.us);
log("quota super period ", quota.super_period_us);
log("quota ", quota.us);
counter_a.result();
counter_b.result();
printf("done\n");
log("done");
sleep_forever();
}

View File

@ -0,0 +1,20 @@
/*
* \brief Kernel-specific core's 'log' backend
* \author Stefan Kalkowski
* \date 2016-10-10
*/
/*
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* core includes */
#include <core_log.h>
/* Linux syscall bindings */
#include <linux_syscalls.h>
void Genode::Core_log::out(char const c) { lx_write(1, &c, sizeof(c)); }

View File

@ -207,7 +207,7 @@ namespace Genode {
Cpu_session_capability cpu_session_cap() override
{
PWRN("%s:%u not implemented", __FILE__, __LINE__);
warning(__FILE__, ":", __LINE__, " not implemented");
return Cpu_session_capability();
}
};

View File

@ -23,7 +23,6 @@
#include <util/string.h>
#include <util/misc_math.h>
#include <base/rpc_server.h>
#include <base/printf.h>
/* base-internal includes */
#include <base/internal/capability_space_tpl.h>
@ -79,7 +78,7 @@ namespace Genode {
:
_size(size), _addr(phys_addr), _fd(-1), _owner(_owner)
{
PWRN("Should only be used for IOMEM and not within Linux.");
warning("Should only be used for IOMEM and not within Linux.");
_fname.buf[0] = 0;
}

View File

@ -16,7 +16,6 @@
/* Genode includes */
#include <base/allocator.h>
#include <base/printf.h>
#include <base/rpc_server.h>
#include <io_mem_session/io_mem_session.h>

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 <io_mem_session_component.h>
@ -21,7 +21,5 @@ using namespace Genode;
Io_mem_session_component::Io_mem_session_component(Range_allocator *io_mem_alloc,
Range_allocator *ram_alloc,
Rpc_entrypoint *ds_ep,
const char *args)
{
PWRN("no io_mem support on Linux (args=\"%s\")", args);
}
const char *args) {
warning("no io_mem support on Linux (args=\"", args, "\")"); }

View File

@ -14,7 +14,6 @@
/* Genode includes */
#include <rm_session/rm_session.h>
#include <ram_session/ram_session.h>
#include <base/printf.h>
#include <base/thread.h>
/* base-internal includes */
@ -64,8 +63,11 @@ class Stack_area_region_map : public Genode::Region_map
return local_addr;
}
void detach(Local_addr local_addr) {
PWRN("stack area detach from 0x%p - not implemented", (void *)local_addr); }
void detach(Local_addr local_addr)
{
Genode::warning("stack area detach from ", (void*)local_addr,
" - not implemented");
}
void fault_handler(Genode::Signal_context_capability) { }

View File

@ -27,7 +27,7 @@ SRC_CC = main.cc \
trace_session_component.cc \
thread_linux.cc \
stack_area.cc \
core_printf.cc \
core_log.cc \
default_log.cc \
env_reinit.cc \
thread.cc thread_myself.cc
@ -55,7 +55,6 @@ vpath signal_source_component.cc $(GEN_CORE_DIR)
vpath trace_session_component.cc $(GEN_CORE_DIR)
vpath core_rpc_cap_alloc.cc $(GEN_CORE_DIR)
vpath default_log.cc $(GEN_CORE_DIR)
vpath core_printf.cc $(BASE_DIR)/src/lib/base
vpath thread.cc $(BASE_DIR)/src/lib/base
vpath thread_myself.cc $(BASE_DIR)/src/lib/base
vpath trace.cc $(BASE_DIR)/src/lib/base

View File

@ -1,35 +0,0 @@
/*
* \brief Printf backend using Linux stdout
* \author Norman Feske
* \date 2006-04-08
*
* This console back-end should only be used by core.
*/
/*
* Copyright (C) 2006-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
#define _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
/* Genode includes */
#include <base/console.h>
/* Linux syscall bindings */
#include <linux_syscalls.h>
namespace Genode {
class Core_console : public Console
{
protected:
void _out_char(char c) { lx_write(1, &c, sizeof(c)); }
};
}
#endif /* _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_ */

View File

@ -109,7 +109,6 @@ void Genode::call_global_static_constructors() { }
int main()
{
Genode::init_log();
Genode::bootstrap_component();
/* never reached */

View File

@ -13,7 +13,7 @@
/* Genode includes */
#include <base/component.h>
#include <base/printf.h>
#include <base/log.h>
/* local includes */
#include "testlib.h"
@ -28,7 +28,7 @@ struct Testapp_testclass
{
Testapp_testclass()
{
Genode::printf("Global static constructor of Genode application called\n");
Genode::log("Global static constructor of Genode application called");
}
void dummy() { }
@ -52,7 +52,7 @@ Genode::size_t Component::stack_size() { return 16*1024*sizeof(long); }
*/
void Component::construct(Genode::Env &env)
{
printf("--- lx_hybrid global static constructor test ---\n");
log("--- lx_hybrid global static constructor test ---");
/*
* Call a dummy function on each test object to make sure that the
@ -61,7 +61,7 @@ void Component::construct(Genode::Env &env)
testlib_testobject.dummy();
testapp_testobject.dummy();
printf("--- returning from main ---\n");
log("--- returning from main ---");
exit_status = 0;
env.ep().schedule_suspend(exit_on_suspended, nullptr);
}

View File

@ -13,7 +13,7 @@
/* Genode includes */
#include <base/component.h>
#include <base/printf.h>
#include <base/log.h>
/* Linux includes */
#include <stdlib.h>
@ -35,16 +35,16 @@ Genode::size_t Component::stack_size() { return 16*1024*sizeof(long); }
*/
void Component::construct(Genode::Env &env)
{
printf("--- lx_hybrid exception test ---\n");
log("--- lx_hybrid exception test ---");
try {
printf("Throwing Test_exception\n");
log("Throwing Test_exception");
throw Test_exception();
} catch (Test_exception) {
printf("Caught Test_exception\n");
log("Caught Test_exception");
}
printf("--- returning from main ---\n");
log("--- returning from main ---");
exit_status = 0;
env.ep().schedule_suspend(exit_on_suspended, nullptr);
}

View File

@ -0,0 +1,30 @@
/*
* \brief Kernel-specific core's 'log' backend
* \author Stefan Kalkowski
* \date 2016-10-10
*/
/*
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* core includes */
#include <core_log.h>
/* Genode includes */
#include <bios_data_area.h>
#include <drivers/uart_base.h>
void Genode::Core_log::out(char const c)
{
enum { CLOCK = 0, BAUDRATE = 115200 };
static X86_uart_base uart(Bios_data_area::singleton()->serial_port(),
CLOCK, BAUDRATE);
if (c == '\n')
uart.put_char('\r');
uart.put_char(c);
}

View File

@ -18,7 +18,6 @@
#include <base/cache.h>
#include <base/ipc.h>
#include <base/stdint.h>
#include <base/printf.h>
/* NOVA includes */
#include <nova/syscalls.h>

View File

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

View File

@ -19,7 +19,7 @@
#include <base/lock.h>
#include <base/capability.h>
#include <base/tslab.h>
#include <base/printf.h>
#include <base/log.h>
namespace Genode { class Rpc_cap_factory; }
@ -56,7 +56,7 @@ class Genode::Rpc_cap_factory
Native_capability alloc(Native_capability)
{
PWRN("unexpected call to non-implemented Rpc_cap_factory::alloc");
warning("unexpected call to non-implemented Rpc_cap_factory::alloc");
return Native_capability();
}

View File

@ -83,7 +83,7 @@ class Genode::Signal_broker
Native_capability sm = _source.blocking_semaphore();
if (!sm.valid()) {
PWRN("signal receiver sm is not valid");
warning("signal receiver sm is not valid");
for (;;);
return Signal_context_capability();
}
@ -94,7 +94,7 @@ class Genode::Signal_broker
uint8_t res = Nova::create_si(cap.local_name(), __core_pd_sel, imprint,
sm.local_name());
if (res != Nova::NOVA_OK) {
PWRN("creating signal failed - error %u", res);
warning("creating signal failed - error ", res);
return Signal_context_capability();
}
@ -115,8 +115,8 @@ class Genode::Signal_broker
_obj_pool.apply(context_cap, lambda);
if (!context) {
PWRN("%p - specified signal-context capability has wrong type %lx",
this, context_cap.local_name());
warning(this, " - specified signal-context capability has wrong type ",
Hex(context_cap.local_name()));
return;
}
destroy(&_contexts_slab, context);

View File

@ -16,7 +16,7 @@
/* Genode includes */
#include <rm_session/rm_session.h>
#include <base/printf.h>
#include <base/log.h>
/* base-internal includes */
#include <base/internal/page_size.h>
@ -51,19 +51,6 @@ namespace Genode {
log(" ", __builtin_return_address(3));
log(" ", __builtin_return_address(4));
}
inline void hexdump(void *addr)
{
unsigned char *s = (unsigned char *)addr;
printf("\nhexdump at 0x%p:\n", addr);
for (unsigned j = 0; j < 4; j++) {
printf(" ");
for (unsigned i = 0; i < 16; i++)
printf("0x%02x ", s[j*16 + i]);
printf("\n");
}
}
}
#endif /* _CORE__INCLUDE__UTIL_H_ */

View File

@ -5,7 +5,7 @@ GEN_CORE_DIR = $(BASE_DIR)/src/core
SRC_CC = stack_area.cc \
core_mem_alloc.cc \
core_printf.cc \
core_log.cc \
core_region_map.cc \
core_rpc_cap_alloc.cc \
cpu_session_component.cc \
@ -69,5 +69,4 @@ vpath default_log.cc $(GEN_CORE_DIR)
vpath dump_alloc.cc $(GEN_CORE_DIR)
vpath platform_services.cc $(GEN_CORE_DIR)/spec/x86
vpath stack_area.cc $(GEN_CORE_DIR)
vpath core_printf.cc $(BASE_DIR)/src/lib/base
vpath %.cc $(REP_DIR)/src/core

View File

@ -1,48 +0,0 @@
/*
* \brief Console backend for NOVA
* \author Norman Feske
* \author Alexander Boettcher
* \date 2009-12-28
*/
/*
* Copyright (C) 2009-2015 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
#define _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
/* Genode includes */
#include <base/console.h>
#include <bios_data_area.h>
#include <drivers/uart_base.h>
namespace Genode { class Core_console; }
class Genode::Core_console : public X86_uart_base, public Console
{
private:
enum { CLOCK = 0, BAUDRATE = 115200 };
void _out_char(char c)
{
if (c == '\n')
put_char('\r');
put_char(c);
}
public:
Core_console()
:
X86_uart_base(Bios_data_area::singleton()->serial_port(),
CLOCK, BAUDRATE)
{ }
};
#endif /* _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_ */

View File

@ -0,0 +1,21 @@
/*
* \brief Kernel-specific core's 'log' backend
* \author Stefan Kalkowski
* \date 2016-10-10
*/
/*
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* core includes */
#include <core_log.h>
namespace Okl4 { extern "C" {
#include <l4/kdebug.h>
}; }
void Genode::Core_log::out(char const c) { Okl4::L4_KDB_PrintChar(c); }

View File

@ -11,9 +11,6 @@
* under the terms of the GNU General Public License version 2.
*/
/* Genode includes */
#include <base/printf.h>
/* core includes */
#include <region_map_component.h>

View File

@ -6,7 +6,7 @@ GEN_CORE_DIR = $(BASE_DIR)/src/core
SRC_CC += stack_area.cc \
core_mem_alloc.cc \
core_printf.cc \
core_log.cc \
core_region_map.cc \
core_rpc_cap_alloc.cc \
cpu_session_component.cc \
@ -69,5 +69,3 @@ vpath default_log.cc $(GEN_CORE_DIR)
vpath stack_area.cc $(GEN_CORE_DIR)
vpath pager_ep.cc $(GEN_CORE_DIR)
vpath %.cc $(REP_DIR)/src/core
vpath core_printf.cc $(BASE_DIR)/src/lib/base

View File

@ -1,34 +0,0 @@
/*
* \brief Console backend for OKL4
* \author Norman Feske
* \date 2009-03-25
*/
/*
* Copyright (C) 2009-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
#define _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
namespace Okl4 { extern "C" {
#include <l4/kdebug.h>
} }
#include <base/console.h>
namespace Genode
{
class Core_console : public Console
{
protected:
void _out_char(char c) { Okl4::L4_KDB_PrintChar(c); }
};
}
#endif /* _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_ */

View File

@ -0,0 +1,22 @@
/*
* \brief Kernel-specific core's 'log' backend
* \author Stefan Kalkowski
* \date 2016-10-10
*/
/*
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* core includes */
#include <core_log.h>
/* Pistachio includes */
namespace Pistachio {
#include <l4/kdebug.h>
}
void Genode::Core_log::out(char const c) { Pistachio::L4_KDB_PrintChar(c); }

View File

@ -70,8 +70,8 @@ namespace Genode {
L4_MsgTag_t result = L4_Call(core_pager);
if (L4_IpcFailed(result)) {
PWRN("could not locally remap 0x%lx to 0x%lx, error code is %ld",
from_addr, to_addr, L4_ErrorCode());
warning("could not locally remap ", (void*)from_addr, " to ",
(void*)to_addr, ", error code is ", L4_ErrorCode());
return false;
}
}

View File

@ -22,9 +22,6 @@ namespace Pistachio {
using namespace Genode;
static const bool verbose_unmap = false;
void Rm_client::unmap(addr_t core_local_base, addr_t virt_base, size_t size)
{
/*
@ -38,10 +35,6 @@ void Rm_client::unmap(addr_t core_local_base, addr_t virt_base, size_t size)
L4_Word_t page_size = get_page_size();
if (verbose_unmap)
printf("RM client %p (%lx) unmap core-local [%lx,%lx)\n",
this, badge(), core_local_base, core_local_base + size);
addr_t addr = core_local_base;
for (; addr < core_local_base + size; addr += page_size) {
L4_Fpage_t fp = L4_Fpage(addr, page_size);

View File

@ -5,7 +5,7 @@ LIBS = base-common
GEN_CORE_DIR = $(BASE_DIR)/src/core
SRC_CC = stack_area.cc \
core_printf.cc \
core_log.cc \
core_rpc_cap_alloc.cc \
core_region_map.cc \
cpu_session_component.cc \
@ -69,5 +69,4 @@ vpath core_rpc_cap_alloc.cc $(GEN_CORE_DIR)
vpath core_region_map.cc $(GEN_CORE_DIR)
vpath stack_area.cc $(GEN_CORE_DIR)
vpath pager_ep.cc $(GEN_CORE_DIR)
vpath core_printf.cc $(BASE_DIR)/src/lib/base
vpath %.cc $(REP_DIR)/src/core

View File

@ -1,35 +0,0 @@
/*
* \brief Console backend for Pistachio
* \author Julian Stecklina
* \date 2008-08-20
*/
/*
* Copyright (C) 2008-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
#define _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
/* Pistachio includes */
namespace Pistachio {
#include <l4/kdebug.h>
}
/* Genode includes */
#include <base/console.h>
namespace Genode
{
class Core_console : public Console
{
protected:
void _out_char(char c) { Pistachio::L4_KDB_PrintChar(c); }
};
}
#endif /* _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_ */

View File

@ -37,7 +37,7 @@ SRC_CC += \
capability_space.cc \
pager.cc
LIBS += core_printf base-common syscall
LIBS += core_log base-common syscall
INC_DIR += $(REP_DIR)/src/core/include $(GEN_CORE_DIR)/include \
$(REP_DIR)/src/include $(BASE_DIR)/src/include

View File

@ -0,0 +1,6 @@
SRC_CC = core_log.cc default_log.cc
INC_DIR += $(REP_DIR)/src/include $(BASE_DIR)/src/include $(BASE_DIR)/src/core/include
LIBS += syscall
vpath core_log.cc $(REP_DIR)/src/core
vpath default_log.cc $(BASE_DIR)/src/core

View File

@ -1,6 +0,0 @@
SRC_CC = core_printf.cc default_log.cc
INC_DIR += $(REP_DIR)/src/include $(BASE_DIR)/src/include
LIBS += syscall
vpath core_printf.cc $(BASE_DIR)/src/lib/base
vpath default_log.cc $(BASE_DIR)/src/core

View File

@ -13,7 +13,6 @@
/* base includes */
#include <base/capability.h>
#include <base/printf.h>
/* base-internal includes */
#include <base/internal/capability_data.h>

View File

@ -0,0 +1,21 @@
/*
* \brief Kernel-specific core's 'log' backend
* \author Stefan Kalkowski
* \date 2016-10-10
*/
/*
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* core includes */
#include <core_log.h>
/* seL4 includes */
#include <sel4/arch/functions.h>
#include <sel4/arch/syscalls.h>
void Genode::Core_log::out(char const c) { seL4_DebugPutChar(c); }

View File

@ -59,8 +59,8 @@ class Genode::Cnode_base
int const ret = seL4_CNode_Copy(service, dest_index, dest_depth,
src_root, src_index, src_depth, rights);
if (ret != 0) {
PWRN("%s: seL4_CNode_Copy (0x%lx) returned %d", __FUNCTION__,
from_idx.value(), ret);
warning(__FUNCTION__, ": seL4_CNode_Copy (",
(void*)from_idx.value(), ") returned ", ret);
}
}
@ -112,8 +112,8 @@ class Genode::Cnode_base
int const ret = seL4_CNode_Move(service, dest_index, dest_depth,
src_root, src_index, src_depth);
if (ret != 0) {
PWRN("%s: seL4_CNode_Move (0x%lx) returned %d", __FUNCTION__,
from_idx.value(), ret);
warning(__FUNCTION__, ": seL4_CNode_Move (",
(void*)from_idx.value(), ") returned ", ret);
}
}

View File

@ -14,9 +14,6 @@
#ifndef _CORE__INCLUDE__MAP_LOCAL_H_
#define _CORE__INCLUDE__MAP_LOCAL_H_
/* Genode includes */
#include <base/printf.h>
/* core includes */
#include <util.h>
#include <platform.h>

View File

@ -14,9 +14,6 @@
#ifndef _CORE__INCLUDE__PLATFORM_H_
#define _CORE__INCLUDE__PLATFORM_H_
/* Genode includes */
#include <base/printf.h>
/* local includes */
#include <platform_generic.h>
#include <core_mem_alloc.h>

View File

@ -17,9 +17,6 @@
#ifndef _CORE__INCLUDE__THREAD_SEL4_H_
#define _CORE__INCLUDE__THREAD_SEL4_H_
/* Genode includes */
#include <base/printf.h>
/* base-internal includes */
#include <base/internal/assert.h>

View File

@ -14,10 +14,6 @@
#ifndef _CORE__INCLUDE__UTIL_H_
#define _CORE__INCLUDE__UTIL_H_
/* Genode includes */
#include <rm_session/rm_session.h>
#include <base/printf.h>
/* base-internal includes */
#include <base/internal/page_size.h>

View File

@ -33,7 +33,7 @@ Native_capability Rpc_cap_factory::_alloc(Rpc_cap_factory *owner,
Native_capability ep)
{
if (!ep.valid()) {
PWRN("Invalid entrypoint capability");
warning("Invalid entrypoint capability");
return Native_capability();
}

View File

@ -1,37 +0,0 @@
/*
* \brief Console backend for seL4
* \author Norman Feske
* \date 2014-10-14
*/
/*
* Copyright (C) 2014 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
#define _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_
/* Genode includes */
#include <base/console.h>
/* seL4 includes */
#include <sel4/arch/functions.h>
#include <sel4/arch/syscalls.h>
namespace Genode { class Core_console; }
class Genode::Core_console : public Console
{
protected:
void _out_char(char c)
{
seL4_DebugPutChar(c);
}
};
#endif /* _INCLUDE__BASE__INTERNAL__CORE_CONSOLE_H_ */

View File

@ -13,7 +13,7 @@
/* base includes */
#include <base/capability.h>
#include <base/printf.h>
#include <base/log.h>
#include <util/bit_allocator.h>
/* base-internal includes */
@ -156,7 +156,7 @@ void Capability_space::reset_sel(unsigned sel)
{
int ret = seL4_CNode_Delete(INITIAL_SEL_CNODE, sel, CSPACE_SIZE_LOG2);
if (ret != 0)
PWRN("seL4_CNode_Delete returned %d", ret);
warning("seL4_CNode_Delete returned ", ret);
}

View File

@ -30,32 +30,6 @@ namespace Genode { class Mmio; }
*/
class Genode::Mmio
{
/*
* If set 0 verbosity isn't needed at all and the enum enables the
* compiler to remove all verbosity code. If set 1 verbosity code
* gets compiled and is then switched via '*_verbose' member variables.
*/
enum { VERBOSITY_AVAILABLE = 0 };
/**
* Proclaim a MMIO access
*
* \param _ACCESS_T integer type of access
* \param dst access destination
* \param v access value
* \param w 1: write access 0: read access
*/
template <typename _ACCESS_T>
inline void _access_verbosity(addr_t const dst, _ACCESS_T const v,
bool const w) const
{
if (!VERBOSITY_AVAILABLE) return;
if ((w && !_write_verbose) || (!w && !_read_verbose)) return;
printf("mmio %s 0x%p: 0x", w ? "write" : "read ", (void *)dst);
Trait::Uint_type<_ACCESS_T>::print_hex(v);
printf("\n");
}
/**
* Write '_ACCESS_T' typed 'value' to MMIO base + 'o'
*/
@ -63,7 +37,6 @@ class Genode::Mmio
inline void _write(off_t const o, _ACCESS_T const value)
{
addr_t const dst = (addr_t)base + o;
_access_verbosity<_ACCESS_T>(dst, value, 1);
*(_ACCESS_T volatile *)dst = value;
}
@ -75,23 +48,9 @@ class Genode::Mmio
{
addr_t const dst = (addr_t)base + o;
_ACCESS_T const value = *(_ACCESS_T volatile *)dst;
_access_verbosity<_ACCESS_T>(dst, value, 0);
return value;
}
protected:
/*
* If VERBOSITY_AVAILABLE is set MMIO isn't verbose by default.
* Instead it causes this switches to be asked everytime MMIO
* could be verbose. This way the user can either enable verbosity
* locally by overwriting them in a deriving class or change their
* initialization temporarily to enable verbosity globally and
* then supress it locally by overwriting it.
*/
bool _write_verbose;
bool _read_verbose;
public:
enum { BYTE_WIDTH_LOG2 = 3, BYTE_WIDTH = 1 << BYTE_WIDTH_LOG2 };
@ -287,8 +246,7 @@ class Genode::Mmio
*
* \param mmio_base base address of targeted MMIO region
*/
inline Mmio(addr_t mmio_base)
: _write_verbose(0), _read_verbose(0), base(mmio_base) { }
inline Mmio(addr_t mmio_base) : base(mmio_base) { }
/*************************

View File

@ -16,7 +16,6 @@
/* Genode includes */
#include <base/stdint.h>
#include <base/printf.h>
namespace Genode {
@ -55,45 +54,30 @@ namespace Genode { namespace Trait {
* Access widths wich are dividers to the compound type width
*/
template <unsigned long _DIVISOR_WIDTH> struct Divisor;
static inline void print_hex(bool const v) {
printf("%01x", v); }
};
template <> struct Uint_width<8> : Uint_width<1>
{
typedef uint8_t Type;
enum { WIDTH_LOG2 = 3 };
static inline void print_hex(uint8_t const v) {
printf("%02x", v); }
};
template <> struct Uint_width<16> : Uint_width<8>
{
typedef uint16_t Type;
enum { WIDTH_LOG2 = 4 };
static inline void print_hex(uint16_t const v) {
printf("%04x", v); }
};
template <> struct Uint_width<32> : Uint_width<16>
{
typedef uint32_t Type;
enum { WIDTH_LOG2 = 5 };
static inline void print_hex (uint32_t const v) {
printf("%08x", v); }
};
template <> struct Uint_width<64> : Uint_width<32>
{
typedef uint64_t Type;
enum { WIDTH_LOG2 = 6 };
static inline void print_hex(uint64_t const v) {
printf("%016llx", v); }
};
template <> struct Uint_width<1>::Divisor<1> { enum { WIDTH_LOG2 = 0 }; };

36
repos/base/run/log.run Normal file
View File

@ -0,0 +1,36 @@
build "core init test/log"
create_boot_directory
install_config {
<config>
<parent-provides>
<service name="LOG"/>
<service name="RM"/>
</parent-provides>
<default-route>
<any-service> <parent/> </any-service>
</default-route>
<start name="test-log">
<resource name="RAM" quantum="10M"/>
</start>
</config>
}
build_boot_image "core init test-log"
append qemu_args "-nographic -m 64"
run_genode_until "Test done.*\n" 10
grep_output {\[init -\> test-log\]}
compare_output_to {
[init -> test-log] hex range: [0e00,1680)
[init -> test-log] empty hex range: [0abc0000,0abc0000) (empty!)
[init -> test-log] hex range to limit: [f8,ff]
[init -> test-log] invalid hex range: [f8,08) (overflow!)
[init -> test-log] negative hex char: 0xfe
[init -> test-log] positive hex char: 0x02
[init -> test-log] Test done.
}

View File

@ -1,26 +0,0 @@
build "core init test/printf"
create_boot_directory
install_config {
<config>
<parent-provides>
<service name="LOG"/>
<service name="RM"/>
</parent-provides>
<default-route>
<any-service> <parent/> </any-service>
</default-route>
<start name="test-printf">
<resource name="RAM" quantum="10M"/>
</start>
</config>
}
build_boot_image "core init test-printf"
append qemu_args "-nographic -m 64"
run_genode_until {-1 = -1 = -1} 10
puts "Test succeeded"

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