mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 08:25:38 +00:00
parent
758ba3855e
commit
be20b715ca
80
repos/gems/src/lib/trace_recorder/policy/ctf0/policy.cc
Normal file
80
repos/gems/src/lib/trace_recorder/policy/ctf0/policy.cc
Normal file
@ -0,0 +1,80 @@
|
||||
#include <util/string.h>
|
||||
#include <trace/policy.h>
|
||||
#include <trace_recorder_policy/ctf_stream0.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Ctf;
|
||||
|
||||
enum { MAX_EVENT_SIZE = 64 };
|
||||
|
||||
size_t max_event_size()
|
||||
{
|
||||
return MAX_EVENT_SIZE;
|
||||
}
|
||||
|
||||
size_t trace_eth_packet(char *, char const *, bool, char *, size_t)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t checkpoint(char *dst, char const *name, unsigned long data, void *addr, unsigned char type)
|
||||
{
|
||||
size_t len = strlen(name) + 1;
|
||||
|
||||
new (dst) Checkpoint(name, len, data, addr, type);
|
||||
|
||||
return len + sizeof(Checkpoint);
|
||||
}
|
||||
|
||||
size_t log_output(char *dst, char const *log_message, size_t len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t rpc_call(char *dst, char const *rpc_name, Msgbuf_base const &)
|
||||
{
|
||||
size_t len = strlen(rpc_name) + 1;
|
||||
|
||||
new (dst) Rpc_call(rpc_name, len);
|
||||
|
||||
return len + sizeof(Rpc_call);
|
||||
}
|
||||
|
||||
size_t rpc_returned(char *dst, char const *rpc_name, Msgbuf_base const &)
|
||||
{
|
||||
size_t len = strlen(rpc_name) + 1;
|
||||
|
||||
new (dst) Rpc_returned(rpc_name, len);
|
||||
|
||||
return len + sizeof(Rpc_returned);
|
||||
}
|
||||
|
||||
size_t rpc_dispatch(char *dst, char const *rpc_name)
|
||||
{
|
||||
size_t len = strlen(rpc_name) + 1;
|
||||
|
||||
new (dst) Rpc_dispatch(rpc_name, len);
|
||||
|
||||
return len + sizeof(Rpc_dispatch);
|
||||
}
|
||||
|
||||
size_t rpc_reply(char *dst, char const *rpc_name)
|
||||
{
|
||||
size_t len = strlen(rpc_name) + 1;
|
||||
|
||||
new (dst) Rpc_reply(rpc_name, len);
|
||||
|
||||
return len + sizeof(Rpc_reply);
|
||||
}
|
||||
|
||||
size_t signal_submit(char *dst, unsigned const num)
|
||||
{
|
||||
new (dst) Signal_submit(num);
|
||||
|
||||
return sizeof(Signal_submit);
|
||||
}
|
||||
|
||||
size_t signal_receive(char *dst, Signal_context const & context, unsigned num)
|
||||
{
|
||||
new (dst) Signal_receive(num, (void*)&context);
|
||||
return 0;
|
||||
}
|
5
repos/gems/src/lib/trace_recorder/policy/ctf0/target.mk
Normal file
5
repos/gems/src/lib/trace_recorder/policy/ctf0/target.mk
Normal file
@ -0,0 +1,5 @@
|
||||
TARGET = ctf0_policy
|
||||
|
||||
TARGET_POLICY = ctf0
|
||||
|
||||
include $(PRG_DIR)/../policy.inc
|
41
repos/gems/src/lib/trace_recorder/policy/policy.inc
Normal file
41
repos/gems/src/lib/trace_recorder/policy/policy.inc
Normal file
@ -0,0 +1,41 @@
|
||||
#
|
||||
# \brief Common build rules for creating trace-policy modules
|
||||
# \author Josef Soentgen
|
||||
# \date 2013-08-12
|
||||
#
|
||||
|
||||
CXX_OPT = -g -ffreestanding -fPIC -fno-exceptions -fno-rtti \
|
||||
-nostdinc -nostdlib -MMD
|
||||
|
||||
CXX_OPT += $(CC_CXX_OPT_STD)
|
||||
|
||||
LD_SCRIPT= $(PRG_DIR)/../policy.ld
|
||||
|
||||
-include *.d
|
||||
-include ../*.d
|
||||
|
||||
table.o: table.cc
|
||||
$(MSG_COMP)$@
|
||||
$(VERBOSE)$(CXX) -c $(CC_MARCH) $(CXX_OPT) $(INCLUDES) $< -o $@
|
||||
|
||||
policy.o: policy.cc
|
||||
$(MSG_COMP)$@
|
||||
$(VERBOSE)$(CXX) -c $(CC_MARCH) $(CXX_OPT) $(INCLUDES) $< -o $@
|
||||
|
||||
$(TARGET_POLICY).elf: table.o policy.o
|
||||
$(MSG_LINK)$@
|
||||
$(VERBOSE)$(LD) $(LD_MARCH) -T $(LD_SCRIPT) -Ttext=0 \
|
||||
$^ $(shell $(CXX) $(CC_MARCH) -print-libgcc-file-name) -o $@
|
||||
|
||||
$(INSTALL_DIR)/$(TARGET_POLICY): $(TARGET_POLICY).elf
|
||||
$(VERBOSE)$(OBJCOPY) -O binary $< $@
|
||||
|
||||
$(TARGET): $(INSTALL_DIR)/$(TARGET_POLICY)
|
||||
|
||||
clean cleanall: clean_policy
|
||||
|
||||
clean_policy:
|
||||
$(VERBOSE)$(RM) ../*.o ../*.d *.o *.d $(TARGET_POLICY).elf \
|
||||
$(BUILD_BASE_DIR)/bin/$(TARGET_POLICY)
|
||||
|
||||
vpath table.cc $(REP_DIR)/src/lib/trace_recorder/policy
|
15
repos/gems/src/lib/trace_recorder/policy/policy.ld
Normal file
15
repos/gems/src/lib/trace_recorder/policy/policy.ld
Normal file
@ -0,0 +1,15 @@
|
||||
PHDRS { rw PT_LOAD; }
|
||||
SECTIONS {
|
||||
|
||||
.text : {
|
||||
*(.data.rel) /* must be first because it contains policy module header */
|
||||
*(.data)
|
||||
*(.rodata .rodata.*)
|
||||
*(.text .text.*)
|
||||
*(.bss)
|
||||
*(.got.plt)
|
||||
*(.got)
|
||||
} : rw
|
||||
|
||||
/DISCARD/ : { *(.*) }
|
||||
}
|
32
repos/gems/src/lib/trace_recorder/policy/table.cc
Normal file
32
repos/gems/src/lib/trace_recorder/policy/table.cc
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* \brief Header of tracing policy module
|
||||
* \author Norman Feske
|
||||
* \date 2013-08-15
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-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 <trace/policy.h>
|
||||
#include <base/trace/policy.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
Genode::Trace::Policy_module policy_jump_table =
|
||||
{
|
||||
max_event_size,
|
||||
trace_eth_packet,
|
||||
checkpoint,
|
||||
log_output,
|
||||
rpc_call,
|
||||
rpc_returned,
|
||||
rpc_dispatch,
|
||||
rpc_reply,
|
||||
signal_submit,
|
||||
signal_receive
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user