mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-19 07:38:28 +00:00
os: example trace policy-modules
This commit is contained in:
committed by
Norman Feske
parent
baa55dabc4
commit
17eb342156
39
os/src/lib/trace/policy/null/policy.cc
Normal file
39
os/src/lib/trace/policy/null/policy.cc
Normal file
@ -0,0 +1,39 @@
|
||||
#include <trace/policy.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
size_t max_event_size()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t rpc_call(char *dst, char const *rpc_name, Msgbuf_base const &)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t rpc_returned(char *dst, char const *rpc_name, Msgbuf_base const &)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t rpc_dispatch(char *dst, char const *rpc_name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t rpc_reply(char *dst, char const *rpc_name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t signal_submit(char *dst, unsigned const)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t signal_receive(char *dst, Signal_context const &, unsigned)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
5
os/src/lib/trace/policy/null/target.mk
Normal file
5
os/src/lib/trace/policy/null/target.mk
Normal file
@ -0,0 +1,5 @@
|
||||
TARGET = null_policy
|
||||
|
||||
TARGET_POLICY = null
|
||||
|
||||
include $(PRG_DIR)/../policy.inc
|
35
os/src/lib/trace/policy/policy.inc
Normal file
35
os/src/lib/trace/policy/policy.inc
Normal file
@ -0,0 +1,35 @@
|
||||
#
|
||||
# \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
|
||||
|
||||
LD_SCRIPT= $(PRG_DIR)/../policy.ld
|
||||
|
||||
-include *.d
|
||||
-include ../*.d
|
||||
|
||||
LIBS = platform
|
||||
|
||||
%.o : %.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 $^ -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/policy
|
11
os/src/lib/trace/policy/policy.ld
Normal file
11
os/src/lib/trace/policy/policy.ld
Normal file
@ -0,0 +1,11 @@
|
||||
PHDRS { rw PT_LOAD; }
|
||||
SECTIONS {
|
||||
|
||||
.text : {
|
||||
*(.data) /* must be first because it contains policy module header */
|
||||
*(.text .text.*)
|
||||
*(.bss)
|
||||
} : rw
|
||||
|
||||
/DISCARD/ : { *(.*) }
|
||||
}
|
53
os/src/lib/trace/policy/rpc_name/policy.cc
Normal file
53
os/src/lib/trace/policy/rpc_name/policy.cc
Normal file
@ -0,0 +1,53 @@
|
||||
#include <util/string.h>
|
||||
#include <trace/policy.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
enum { MAX_EVENT_SIZE = 64 };
|
||||
|
||||
size_t max_event_size()
|
||||
{
|
||||
return MAX_EVENT_SIZE;
|
||||
}
|
||||
|
||||
size_t rpc_call(char *dst, char const *rpc_name, Msgbuf_base const &)
|
||||
{
|
||||
size_t len = strlen(rpc_name);
|
||||
|
||||
memcpy(dst, (void*)rpc_name, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t rpc_returned(char *dst, char const *rpc_name, Msgbuf_base const &)
|
||||
{
|
||||
size_t len = strlen(rpc_name);
|
||||
|
||||
memcpy(dst, (void*)rpc_name, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t rpc_dispatch(char *dst, char const *rpc_name)
|
||||
{
|
||||
size_t len = strlen(rpc_name);
|
||||
|
||||
memcpy(dst, (void*)rpc_name, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t rpc_reply(char *dst, char const *rpc_name)
|
||||
{
|
||||
size_t len = strlen(rpc_name);
|
||||
|
||||
memcpy(dst, (void*)rpc_name, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t signal_submit(char *dst, unsigned const)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t signal_receive(char *dst, Signal_context const &, unsigned)
|
||||
{
|
||||
return 0;
|
||||
}
|
5
os/src/lib/trace/policy/rpc_name/target.mk
Normal file
5
os/src/lib/trace/policy/rpc_name/target.mk
Normal file
@ -0,0 +1,5 @@
|
||||
TARGET = rpc_name_policy
|
||||
|
||||
TARGET_POLICY = rpc_name
|
||||
|
||||
include $(PRG_DIR)/../policy.inc
|
29
os/src/lib/trace/policy/table.cc
Normal file
29
os/src/lib/trace/policy/table.cc
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* \brief Header of tracing policy module
|
||||
* \author Norman Feske
|
||||
* \date 2013-08-15
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 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.
|
||||
*/
|
||||
|
||||
#include <trace/policy.h>
|
||||
#include <base/trace/policy.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
Genode::Trace::Policy_module policy_jump_table =
|
||||
{
|
||||
max_event_size,
|
||||
rpc_call,
|
||||
rpc_returned,
|
||||
rpc_dispatch,
|
||||
rpc_reply,
|
||||
signal_submit,
|
||||
signal_receive
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user