xref: /linux/include/trace/events/exceptions.h (revision 0aee0617267866555b4e35bd11e1fbb291fa9743)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM exceptions
4 
5 #if !defined(_TRACE_PAGE_FAULT_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_PAGE_FAULT_H
7 
8 #include <linux/tracepoint.h>
9 
10 DECLARE_EVENT_CLASS(exceptions,
11 
12 	TP_PROTO(unsigned long address, struct pt_regs *regs,
13 		 unsigned long error_code),
14 
15 	TP_ARGS(address, regs, error_code),
16 
17 	TP_STRUCT__entry(
18 		__field(		unsigned long, address	)
19 		__field(		unsigned long, ip	)
20 		__field(		unsigned long, error_code )
21 	),
22 
23 	TP_fast_assign(
24 		__entry->address = address;
25 		__entry->ip = instruction_pointer(regs);
26 		__entry->error_code = error_code;
27 	),
28 
29 	TP_printk("address=%ps ip=%ps error_code=0x%lx",
30 		  (void *)__entry->address, (void *)__entry->ip,
31 		  __entry->error_code) );
32 
33 DEFINE_EVENT(exceptions, page_fault_user,
34 	TP_PROTO(unsigned long address,	struct pt_regs *regs, unsigned long error_code),
35 	TP_ARGS(address, regs, error_code));
36 DEFINE_EVENT(exceptions, page_fault_kernel,
37 	TP_PROTO(unsigned long address,	struct pt_regs *regs, unsigned long error_code),
38 	TP_ARGS(address, regs, error_code));
39 
40 #endif /*  _TRACE_PAGE_FAULT_H */
41 
42 /* This part must be outside protection */
43 #include <trace/define_trace.h>
44