xref: /linux/arch/x86/include/asm/trace/exceptions.h (revision ca55b2fef3a9373fcfc30f82fd26bc7fccbda732)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM exceptions
3 
4 #if !defined(_TRACE_PAGE_FAULT_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_PAGE_FAULT_H
6 
7 #include <linux/tracepoint.h>
8 
9 extern void trace_irq_vector_regfunc(void);
10 extern void trace_irq_vector_unregfunc(void);
11 
12 DECLARE_EVENT_CLASS(x86_exceptions,
13 
14 	TP_PROTO(unsigned long address, struct pt_regs *regs,
15 		 unsigned long error_code),
16 
17 	TP_ARGS(address, regs, error_code),
18 
19 	TP_STRUCT__entry(
20 		__field(		unsigned long, address	)
21 		__field(		unsigned long, ip	)
22 		__field(		unsigned long, error_code )
23 	),
24 
25 	TP_fast_assign(
26 		__entry->address = address;
27 		__entry->ip = regs->ip;
28 		__entry->error_code = error_code;
29 	),
30 
31 	TP_printk("address=%pf ip=%pf error_code=0x%lx",
32 		  (void *)__entry->address, (void *)__entry->ip,
33 		  __entry->error_code) );
34 
35 #define DEFINE_PAGE_FAULT_EVENT(name)				\
36 DEFINE_EVENT_FN(x86_exceptions, name,				\
37 	TP_PROTO(unsigned long address,	struct pt_regs *regs,	\
38 		 unsigned long error_code),			\
39 	TP_ARGS(address, regs, error_code),			\
40 	trace_irq_vector_regfunc,				\
41 	trace_irq_vector_unregfunc);
42 
43 DEFINE_PAGE_FAULT_EVENT(page_fault_user);
44 DEFINE_PAGE_FAULT_EVENT(page_fault_kernel);
45 
46 #undef TRACE_INCLUDE_PATH
47 #define TRACE_INCLUDE_PATH .
48 #define TRACE_INCLUDE_FILE exceptions
49 #endif /*  _TRACE_PAGE_FAULT_H */
50 
51 /* This part must be outside protection */
52 #include <trace/define_trace.h>
53