xref: /openbmc/linux/arch/x86/include/asm/trace/exceptions.h (revision c39f2d9db0fd81ea20bb5cce9b3f082ca63753e2)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2d34603b0SSeiji Aguchi #undef TRACE_SYSTEM
3d34603b0SSeiji Aguchi #define TRACE_SYSTEM exceptions
4d34603b0SSeiji Aguchi 
5d34603b0SSeiji Aguchi #if !defined(_TRACE_PAGE_FAULT_H) || defined(TRACE_HEADER_MULTI_READ)
6d34603b0SSeiji Aguchi #define _TRACE_PAGE_FAULT_H
7d34603b0SSeiji Aguchi 
8d34603b0SSeiji Aguchi #include <linux/tracepoint.h>
92feb1b31SThomas Gleixner #include <asm/trace/common.h>
10d34603b0SSeiji Aguchi 
1180954747SThomas Gleixner extern int trace_pagefault_reg(void);
1280954747SThomas Gleixner extern void trace_pagefault_unreg(void);
1380954747SThomas Gleixner 
14d34603b0SSeiji Aguchi DECLARE_EVENT_CLASS(x86_exceptions,
15d34603b0SSeiji Aguchi 
16d34603b0SSeiji Aguchi 	TP_PROTO(unsigned long address, struct pt_regs *regs,
17d34603b0SSeiji Aguchi 		 unsigned long error_code),
18d34603b0SSeiji Aguchi 
19d34603b0SSeiji Aguchi 	TP_ARGS(address, regs, error_code),
20d34603b0SSeiji Aguchi 
21d34603b0SSeiji Aguchi 	TP_STRUCT__entry(
22d34603b0SSeiji Aguchi 		__field(		unsigned long, address	)
23d34603b0SSeiji Aguchi 		__field(		unsigned long, ip	)
24d34603b0SSeiji Aguchi 		__field(		unsigned long, error_code )
25d34603b0SSeiji Aguchi 	),
26d34603b0SSeiji Aguchi 
27d34603b0SSeiji Aguchi 	TP_fast_assign(
28d34603b0SSeiji Aguchi 		__entry->address = address;
29d34603b0SSeiji Aguchi 		__entry->ip = regs->ip;
30d34603b0SSeiji Aguchi 		__entry->error_code = error_code;
31d34603b0SSeiji Aguchi 	),
32d34603b0SSeiji Aguchi 
33*d75f773cSSakari Ailus 	TP_printk("address=%ps ip=%ps error_code=0x%lx",
34d34603b0SSeiji Aguchi 		  (void *)__entry->address, (void *)__entry->ip,
35d34603b0SSeiji Aguchi 		  __entry->error_code) );
36d34603b0SSeiji Aguchi 
37d34603b0SSeiji Aguchi #define DEFINE_PAGE_FAULT_EVENT(name)				\
38d34603b0SSeiji Aguchi DEFINE_EVENT_FN(x86_exceptions, name,				\
39d34603b0SSeiji Aguchi 	TP_PROTO(unsigned long address,	struct pt_regs *regs,	\
40d34603b0SSeiji Aguchi 		 unsigned long error_code),			\
41d34603b0SSeiji Aguchi 	TP_ARGS(address, regs, error_code),			\
4280954747SThomas Gleixner 	trace_pagefault_reg, trace_pagefault_unreg);
43d34603b0SSeiji Aguchi 
44a4f61decSH. Peter Anvin DEFINE_PAGE_FAULT_EVENT(page_fault_user);
45a4f61decSH. Peter Anvin DEFINE_PAGE_FAULT_EVENT(page_fault_kernel);
46d34603b0SSeiji Aguchi 
47d34603b0SSeiji Aguchi #undef TRACE_INCLUDE_PATH
48ad3bc25aSBorislav Petkov #undef TRACE_INCLUDE_FILE
49d34603b0SSeiji Aguchi #define TRACE_INCLUDE_PATH .
50d34603b0SSeiji Aguchi #define TRACE_INCLUDE_FILE exceptions
51d34603b0SSeiji Aguchi #endif /*  _TRACE_PAGE_FAULT_H */
52d34603b0SSeiji Aguchi 
53d34603b0SSeiji Aguchi /* This part must be outside protection */
54d34603b0SSeiji Aguchi #include <trace/define_trace.h>
55