| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #if !defined(LTTNG_TRACE_EXCEPTIONS_H) || defined(TRACE_HEADER_MULTI_READ) |
| 3 | #define LTTNG_TRACE_EXCEPTIONS_H |
| 4 | |
| 5 | #include <probes/lttng-tracepoint-event.h> |
| 6 | #include <linux/version.h> |
| 7 | |
| 8 | #undef TRACE_SYSTEM |
| 9 | #define TRACE_SYSTEM x86_exceptions |
| 10 | |
| 11 | LTTNG_TRACEPOINT_EVENT_CLASS(x86_exceptions_class, |
| 12 | |
| 13 | TP_PROTO(unsigned long address, struct pt_regs *regs, |
| 14 | unsigned long error_code), |
| 15 | |
| 16 | TP_ARGS(address, regs, error_code), |
| 17 | |
| 18 | TP_FIELDS( |
| 19 | ctf_integer_hex(unsigned long, address, address) |
| 20 | ctf_integer_hex(unsigned long, ip, regs->ip) |
| 21 | /* |
| 22 | * Note: we cast error_code from unsigned long |
| 23 | * to unsigned char to save space in the trace. |
| 24 | * Currently, only 5 low bits are used. Should be made |
| 25 | * larger if error codes are added to the kernel. |
| 26 | */ |
| 27 | ctf_integer_hex(unsigned char, error_code, error_code) |
| 28 | ) |
| 29 | ) |
| 30 | |
| 31 | #define LTTNG_EXCEPTIONS_TRACEPOINT_EVENT_INSTANCE_MAP(name, map) \ |
| 32 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(x86_exceptions_class, \ |
| 33 | name, \ |
| 34 | map, \ |
| 35 | TP_PROTO(unsigned long address, struct pt_regs *regs, \ |
| 36 | unsigned long error_code), \ |
| 37 | TP_ARGS(address, regs, error_code) \ |
| 38 | ) |
| 39 | |
| 40 | LTTNG_EXCEPTIONS_TRACEPOINT_EVENT_INSTANCE_MAP(page_fault_user, |
| 41 | x86_exceptions_page_fault_user) |
| 42 | LTTNG_EXCEPTIONS_TRACEPOINT_EVENT_INSTANCE_MAP(page_fault_kernel, |
| 43 | x86_exceptions_page_fault_kernel) |
| 44 | |
| 45 | #endif /* LTTNG_TRACE_EXCEPTIONS_H */ |
| 46 | |
| 47 | #undef TRACE_INCLUDE_PATH |
| 48 | #define TRACE_INCLUDE_PATH instrumentation/events/lttng-module/arch/x86 |
| 49 | #undef TRACE_INCLUDE_FILE |
| 50 | #define TRACE_INCLUDE_FILE exceptions |
| 51 | |
| 52 | /* This part must be outside protection */ |
| 53 | #include <probes/define_trace.h> |