mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 07:08:18 +00:00
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:
committed by
Christian Helmuth
parent
e864e84c5a
commit
2a2e5c2df4
@ -1,76 +0,0 @@
|
||||
/*
|
||||
* \brief Core-specific 'printf' implementation
|
||||
* \author Norman Feske
|
||||
* \date 2010-08-31
|
||||
*
|
||||
* In contrast to regular Genode processes, which use the platform-
|
||||
* independent LOG-session interface as back end of 'printf', core has
|
||||
* to rely on a platform-specific back end such as a serial driver or a
|
||||
* kernel-debugger function. The platform-specific back end is called
|
||||
* 'Core_console'.
|
||||
*
|
||||
* This file contains the generic glue code between 'printf' and
|
||||
* 'Core_console'.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-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/printf.h>
|
||||
#include <base/lock.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/core_console.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
/**
|
||||
* Synchronized version of the core console
|
||||
*
|
||||
* This class synchronizes calls of the 'Console::vprintf' function as
|
||||
* used by 'printf' and 'vprintf' to prevent multiple printf-using
|
||||
* threads within core from interfering with each other.
|
||||
*/
|
||||
struct Synchronized_core_console : public Core_console, public Lock
|
||||
{
|
||||
void vprintf(const char *format, va_list list)
|
||||
{
|
||||
Lock::Guard lock_guard(*this);
|
||||
Core_console::vprintf(format, list);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Return singleton instance of synchronized core console
|
||||
*/
|
||||
static Synchronized_core_console &core_console()
|
||||
{
|
||||
static Synchronized_core_console _console;
|
||||
return _console;
|
||||
}
|
||||
|
||||
|
||||
void Genode::printf(const char *format, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, format);
|
||||
|
||||
core_console().vprintf(format, list);
|
||||
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
|
||||
void Genode::vprintf(const char *format, va_list list)
|
||||
{
|
||||
core_console().vprintf(format, list);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,17 @@ using namespace Genode;
|
||||
static Log *log_ptr;
|
||||
|
||||
|
||||
Log &Log::log() { return *log_ptr; }
|
||||
Log &Log::log()
|
||||
{
|
||||
/*
|
||||
* Ensure the log is initialized before use. This is only needed for
|
||||
* components that do not initialize the log explicitly in the startup
|
||||
* code, i.e., Linux hybrid components.
|
||||
*/
|
||||
Genode::init_log();
|
||||
|
||||
return *log_ptr;
|
||||
}
|
||||
|
||||
|
||||
extern "C" int stdout_write(const char *s);
|
||||
|
Reference in New Issue
Block a user