--- /dev/null
+#if !defined(LTTNG_TRACE_EXCEPTIONS_H) || defined(TRACE_HEADER_MULTI_READ)
+#define LTTNG_TRACE_EXCEPTIONS_H
+
+#include "../../../../../probes/lttng-tracepoint-event.h"
+#include <linux/version.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM x86_exceptions
+
+LTTNG_TRACEPOINT_EVENT_CLASS(x86_exceptions_class,
+
+ TP_PROTO(unsigned long address, struct pt_regs *regs,
+ unsigned long error_code),
+
+ TP_ARGS(address, regs, error_code),
+
+ TP_FIELDS(
+ ctf_integer_hex(unsigned long, address, address)
+ ctf_integer_hex(unsigned long, ip, regs->ip)
+ /*
+ * Note: we cast error_code from unsigned long
+ * to unsigned char to save space in the trace.
+ * Currently, only 5 low bits are used. Should be made
+ * larger if error codes are added to the kernel.
+ */
+ ctf_integer_hex(unsigned char, error_code, error_code)
+ )
+)
+
+#define LTTNG_EXCEPTIONS_TRACEPOINT_EVENT_INSTANCE_MAP(name, map) \
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(x86_exceptions_class, \
+ name, \
+ map, \
+ TP_PROTO(unsigned long address, struct pt_regs *regs, \
+ unsigned long error_code), \
+ TP_ARGS(address, regs, error_code) \
+)
+
+LTTNG_EXCEPTIONS_TRACEPOINT_EVENT_INSTANCE_MAP(page_fault_user,
+ x86_exceptions_page_fault_user)
+LTTNG_EXCEPTIONS_TRACEPOINT_EVENT_INSTANCE_MAP(page_fault_kernel,
+ x86_exceptions_page_fault_kernel)
+
+#endif /* LTTNG_TRACE_EXCEPTIONS_H */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module/arch/x86
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE exceptions
+
+/* This part must be outside protection */
+#include "../../../../../probes/define_trace.h"
endif
ifneq ($(CONFIG_X86),)
+
x86_irq_vectors_dep = $(srctree)/arch/x86/include/asm/trace/irq_vectors.h
ifneq ($(wildcard $(x86_irq_vectors_dep)),)
obj-m += lttng-probe-x86-irq-vectors.o
endif
+
+x86_exceptions_dep = $(srctree)/arch/x86/include/asm/trace/exceptions.h
+ifneq ($(wildcard $(x86_exceptions_dep)),)
+obj-m += lttng-probe-x86-exceptions.o
+endif
+
endif
obj-m += $(shell \
--- /dev/null
+/*
+ * probes/lttng-probe-x86-exceptions.c
+ *
+ * LTTng x86 exceptions probes.
+ *
+ * Copyright (C) 2010-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; only
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <linux/module.h>
+#include "../lttng-tracer.h"
+
+/*
+ * Create the tracepoint static inlines from the kernel to validate that our
+ * trace event macros match the kernel we run on.
+ */
+#include <asm/trace/exceptions.h>
+
+#include "../wrapper/tracepoint.h"
+
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+/*
+ * Create LTTng tracepoint probes.
+ */
+#define LTTNG_PACKAGE_BUILD
+#define CREATE_TRACE_POINTS
+#define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module/arch/x86
+
+#include "../instrumentation/events/lttng-module/arch/x86/exceptions.h"
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
+MODULE_DESCRIPTION("LTTng x86 exceptions probes");
+MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
+ __stringify(LTTNG_MODULES_MINOR_VERSION) "."
+ __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
+ LTTNG_MODULES_EXTRAVERSION);