mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 15:32:25 +00:00
parent
2cb635c3e3
commit
15cc6d688f
repos
base-fiasco/lib/mk
base-foc/lib/mk
base-hw/lib/mk
base-linux/src/core/linux
base-nova/lib/mk
base-okl4/lib/mk
base-pistachio/lib/mk
base-sel4/lib/mk
base/src/core
@ -2,6 +2,7 @@ GEN_CORE_DIR := $(dir $(call select_from_repositories,src/core/main.cc))
|
||||
GEN_SRC_DIR := $(realpath $(GEN_CORE_DIR)/..)
|
||||
|
||||
SRC_CC += stack_area.cc \
|
||||
core_log.cc \
|
||||
core_log_out.cc \
|
||||
core_region_map.cc \
|
||||
core_rpc_cap_alloc.cc \
|
||||
@ -52,6 +53,7 @@ vpath main.cc $(GEN_CORE_DIR)
|
||||
vpath pd_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath rom_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath cap_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath core_log.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_support.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
|
||||
|
@ -4,6 +4,7 @@ LIBS += base-foc-common syscall-foc cxx
|
||||
|
||||
SRC_CC += stack_area.cc \
|
||||
stack_area_addr.cc \
|
||||
core_log.cc \
|
||||
core_log_out.cc \
|
||||
core_region_map.cc \
|
||||
core_rpc_cap_alloc.cc \
|
||||
@ -47,6 +48,7 @@ INC_DIR += $(REP_DIR)/src/core/include \
|
||||
include $(GEN_CORE_DIR)/version.inc
|
||||
|
||||
vpath stack_area.cc $(GEN_CORE_DIR)
|
||||
vpath core_log.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_support.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
|
||||
|
@ -17,6 +17,7 @@ INC_DIR += $(BASE_DIR)/../base-hw/src/lib
|
||||
SRC_CC += cpu_session_component.cc
|
||||
SRC_CC += cpu_session_support.cc
|
||||
SRC_CC += cpu_thread_component.cc
|
||||
SRC_CC += core_log.cc
|
||||
SRC_CC += core_log_out.cc
|
||||
SRC_CC += core_region_map.cc
|
||||
SRC_CC += core_mem_alloc.cc
|
||||
|
@ -29,6 +29,7 @@ SRC_CC = main.cc \
|
||||
trace_session_component.cc \
|
||||
thread_linux.cc \
|
||||
stack_area.cc \
|
||||
core_log.cc \
|
||||
core_log_out.cc \
|
||||
default_log.cc \
|
||||
env_reinit.cc \
|
||||
@ -48,6 +49,7 @@ include $(GEN_CORE_DIR)/version.inc
|
||||
|
||||
vpath main.cc $(GEN_CORE_DIR)
|
||||
vpath pd_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath core_log.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_support.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
|
||||
|
@ -4,6 +4,7 @@ GEN_CORE_DIR = $(BASE_DIR)/src/core
|
||||
|
||||
SRC_CC += stack_area.cc \
|
||||
core_mem_alloc.cc \
|
||||
core_log.cc \
|
||||
core_log_out.cc \
|
||||
core_region_map.cc \
|
||||
core_rpc_cap_alloc.cc \
|
||||
@ -52,6 +53,7 @@ include $(GEN_CORE_DIR)/version.inc
|
||||
vpath main.cc $(GEN_CORE_DIR)
|
||||
vpath pd_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath rom_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath core_log.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_support.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
|
||||
@ -72,5 +74,4 @@ vpath dump_alloc.cc $(GEN_CORE_DIR)
|
||||
vpath platform_rom_modules.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
|
||||
|
@ -7,6 +7,7 @@ GEN_SRC_DIR := $(realpath $(GEN_CORE_DIR)/..)
|
||||
|
||||
SRC_CC += stack_area.cc \
|
||||
core_mem_alloc.cc \
|
||||
core_log.cc \
|
||||
core_log_out.cc \
|
||||
core_region_map.cc \
|
||||
core_rpc_cap_alloc.cc \
|
||||
@ -50,6 +51,7 @@ include $(GEN_CORE_DIR)/version.inc
|
||||
vpath main.cc $(GEN_CORE_DIR)
|
||||
vpath pd_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath rom_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath core_log.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_support.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
|
||||
|
@ -4,6 +4,7 @@ GEN_CORE_DIR := $(dir $(call select_from_repositories,src/core/main.cc))
|
||||
GEN_SRC_DIR := $(realpath $(GEN_CORE_DIR)/..)
|
||||
|
||||
SRC_CC = stack_area.cc \
|
||||
core_log.cc \
|
||||
core_log_out.cc \
|
||||
core_rpc_cap_alloc.cc \
|
||||
core_region_map.cc \
|
||||
@ -48,6 +49,7 @@ include $(GEN_CORE_DIR)/version.inc
|
||||
vpath main.cc $(GEN_CORE_DIR)
|
||||
vpath pd_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath rom_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath core_log.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_support.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
|
||||
|
@ -28,7 +28,7 @@ SRC_CC += \
|
||||
core_region_map.cc \
|
||||
core_mem_alloc.cc \
|
||||
core_rpc_cap_alloc.cc \
|
||||
core_log_out.cc default_log.cc \
|
||||
core_log.cc core_log_out.cc default_log.cc \
|
||||
dump_alloc.cc \
|
||||
stack_area.cc \
|
||||
capability_space.cc \
|
||||
@ -44,6 +44,7 @@ include $(GEN_CORE_DIR)/version.inc
|
||||
vpath main.cc $(GEN_CORE_DIR)
|
||||
vpath pd_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath rom_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath core_log.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_support.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
|
||||
|
52
repos/base/src/core/core_log.cc
Normal file
52
repos/base/src/core/core_log.cc
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* \brief Kernel backend for core log messages
|
||||
* \author Norman Feske
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2016-10-10
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#include <core_log.h>
|
||||
|
||||
static Genode::Core_log_range range { 0, 0 };
|
||||
static unsigned range_pos { 0 };
|
||||
|
||||
static void out_mem(char const c)
|
||||
{
|
||||
struct Log_memory
|
||||
{
|
||||
struct Header { unsigned value; } pos;
|
||||
char data[1];
|
||||
|
||||
unsigned out(char const c, unsigned cur_pos,
|
||||
Genode::Core_log_range const &range)
|
||||
{
|
||||
pos.value = cur_pos;
|
||||
data[cur_pos++] = c;
|
||||
return cur_pos % (range.size - sizeof(Log_memory::Header));
|
||||
}
|
||||
} __attribute__((packed)) * mem = reinterpret_cast<Log_memory *>(range.start);
|
||||
|
||||
if (!mem)
|
||||
return;
|
||||
|
||||
range_pos = mem->out(c, range_pos, range);
|
||||
}
|
||||
|
||||
|
||||
void Genode::init_core_log(Core_log_range const &r) { range = r; }
|
||||
|
||||
|
||||
void Genode::Core_log::output(char const * str)
|
||||
{
|
||||
for (unsigned i = 0; i < Genode::strlen(str); i++) {
|
||||
out(str[i]);
|
||||
out_mem(str[i]);
|
||||
}
|
||||
}
|
@ -19,7 +19,13 @@
|
||||
|
||||
namespace Genode {
|
||||
struct Core_log;
|
||||
Core_log &core_log();
|
||||
|
||||
struct Core_log_range {
|
||||
addr_t start;
|
||||
addr_t size;
|
||||
};
|
||||
|
||||
void init_core_log(Core_log_range const &);
|
||||
}
|
||||
|
||||
|
||||
@ -27,8 +33,7 @@ struct Genode::Core_log
|
||||
{
|
||||
void out(char const c);
|
||||
|
||||
void output(char const * str) {
|
||||
for (unsigned i = 0; i < Genode::strlen(str); i++) out(str[i]); }
|
||||
void output(char const * str);
|
||||
};
|
||||
|
||||
#endif /* _CORE_LOG_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user