This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH 03/05] Linux Kernel Markers : powerpc optimization
- From: Mathieu Desnoyers <mathieu dot desnoyers at polymtl dot ca>
- To: linux-kernel at vger dot kernel dot org
- Cc: Andrew Morton <akpm at linux-foundation dot org>, Mathieu Desnoyers <mathieu dot desnoyers at polymtl dot ca>, Christoph Hellwig <hch at infradead dot org>, Ingo Molnar <mingo at redhat dot com>, systemtap at sources dot redhat dot com, ltt-dev at shafik dot org
- Date: Sun, 11 Feb 2007 15:03:25 -0500
- Subject: [PATCH 03/05] Linux Kernel Markers : powerpc optimization
- References: <1171224207118-git-send-email-mathieu.desnoyers@polymtl.ca>
Linux Kernel Markers : powerpc optimization
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
--- /dev/null
+++ b/include/asm-powerpc/marker.h
@@ -0,0 +1,49 @@
+/*
+ * marker.h
+ *
+ * Code markup for dynamic and static tracing. PowerPC architecture
+ * optimisations.
+ *
+ * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+ *
+ * This file is released under the GPLv2.
+ * See the file COPYING for more details.
+ */
+
+#include <asm/asm-compat.h>
+
+#ifdef CONFIG_MARKERS
+
+#define MARK(name, format, args...) \
+ do { \
+ static marker_probe_func *__mark_call_##name = \
+ __mark_empty_function; \
+ static const struct __mark_marker_c __mark_c_##name \
+ __attribute__((section(".markers.c"))) = \
+ { #name, &__mark_call_##name, format, \
+ MARKER_OPTIMIZED } ; \
+ char condition; \
+ asm volatile( ".section .markers, \"a\";\n\t" \
+ PPC_LONG "%1, 0f;\n\t" \
+ ".previous;\n\t" \
+ ".align 4\n\t" \
+ "0:\n\t" \
+ "li %0,0;\n\t" \
+ : "=r" (condition) \
+ : "i" (&__mark_c_##name)); \
+ __mark_check_format(format, ## args); \
+ if (unlikely(condition)) { \
+ preempt_disable(); \
+ (*__mark_call_##name)(format, ## args); \
+ preempt_enable(); \
+ } \
+ } while (0)
+
+
+/* Offset of the immediate value from the start of the addi instruction (result
+ * of the li mnemonic), in bytes. */
+#define MARK_ENABLE_IMMEDIATE_OFFSET 2
+#define MARK_ENABLE_TYPE short
+#define MARK_POLYMORPHIC
+
+#endif