mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 07:08:18 +00:00
Supplement base/log.h with raw output function
This patch introduces the Genode::raw function that prints output directly via a low-level kernel mechanism, if available. On base-linux, it replaces the former 'raw_write_str' function. On base-hw, it replaces the former kernel/log.h interface. Fixes #2012
This commit is contained in:
committed by
Christian Helmuth
parent
ebdb1c6892
commit
2030ae678e
@ -42,3 +42,20 @@ void Log::_release()
|
||||
_lock.unlock();
|
||||
}
|
||||
|
||||
|
||||
void Raw::_acquire()
|
||||
{
|
||||
/*
|
||||
* Mark raw output with distinct color
|
||||
*/
|
||||
_output().out_string("\033[32mKernel: ");
|
||||
}
|
||||
|
||||
|
||||
void Raw::_release()
|
||||
{
|
||||
/*
|
||||
* Reset color and add newline
|
||||
*/
|
||||
_output().out_string("\033[0m\n");
|
||||
}
|
||||
|
35
repos/base/src/lib/base/raw_output.cc
Normal file
35
repos/base/src/lib/base/raw_output.cc
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* \brief Access to raw output back end
|
||||
* \author Norman Feske
|
||||
* \date 2016-06-16
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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/unmanaged_singleton.h>
|
||||
#include <base/internal/output.h>
|
||||
#include <base/internal/raw_write_string.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Output &Raw::_output()
|
||||
{
|
||||
struct Write_fn { void operator () (char const *s) { raw_write_string(s); } };
|
||||
|
||||
typedef Buffered_output<256, Write_fn> Buffered_raw_output;
|
||||
|
||||
static Buffered_raw_output *buffered_raw_output =
|
||||
unmanaged_singleton<Buffered_raw_output>(Write_fn());
|
||||
|
||||
return *buffered_raw_output;
|
||||
}
|
@ -36,7 +36,6 @@
|
||||
wait_for_continue;
|
||||
stdout_write;
|
||||
stdout_reconnect;
|
||||
raw_write_str;
|
||||
|
||||
/* Testing */
|
||||
extern "C++" {
|
||||
|
Reference in New Issue
Block a user