18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#undef TRACE_SYSTEM
38c2ecf20Sopenharmony_ci#define TRACE_SYSTEM exceptions
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#if !defined(_TRACE_PAGE_FAULT_H) || defined(TRACE_HEADER_MULTI_READ)
68c2ecf20Sopenharmony_ci#define _TRACE_PAGE_FAULT_H
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/tracepoint.h>
98c2ecf20Sopenharmony_ci#include <asm/trace/common.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciextern int trace_pagefault_reg(void);
128c2ecf20Sopenharmony_ciextern void trace_pagefault_unreg(void);
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciDECLARE_EVENT_CLASS(x86_exceptions,
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci	TP_PROTO(unsigned long address, struct pt_regs *regs,
178c2ecf20Sopenharmony_ci		 unsigned long error_code),
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci	TP_ARGS(address, regs, error_code),
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
228c2ecf20Sopenharmony_ci		__field(		unsigned long, address	)
238c2ecf20Sopenharmony_ci		__field(		unsigned long, ip	)
248c2ecf20Sopenharmony_ci		__field(		unsigned long, error_code )
258c2ecf20Sopenharmony_ci	),
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci	TP_fast_assign(
288c2ecf20Sopenharmony_ci		__entry->address = address;
298c2ecf20Sopenharmony_ci		__entry->ip = regs->ip;
308c2ecf20Sopenharmony_ci		__entry->error_code = error_code;
318c2ecf20Sopenharmony_ci	),
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci	TP_printk("address=%ps ip=%ps error_code=0x%lx",
348c2ecf20Sopenharmony_ci		  (void *)__entry->address, (void *)__entry->ip,
358c2ecf20Sopenharmony_ci		  __entry->error_code) );
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define DEFINE_PAGE_FAULT_EVENT(name)				\
388c2ecf20Sopenharmony_ciDEFINE_EVENT_FN(x86_exceptions, name,				\
398c2ecf20Sopenharmony_ci	TP_PROTO(unsigned long address,	struct pt_regs *regs,	\
408c2ecf20Sopenharmony_ci		 unsigned long error_code),			\
418c2ecf20Sopenharmony_ci	TP_ARGS(address, regs, error_code),			\
428c2ecf20Sopenharmony_ci	trace_pagefault_reg, trace_pagefault_unreg);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciDEFINE_PAGE_FAULT_EVENT(page_fault_user);
458c2ecf20Sopenharmony_ciDEFINE_PAGE_FAULT_EVENT(page_fault_kernel);
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_PATH
488c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_FILE
498c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_PATH .
508c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_FILE exceptions
518c2ecf20Sopenharmony_ci#endif /*  _TRACE_PAGE_FAULT_H */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/* This part must be outside protection */
548c2ecf20Sopenharmony_ci#include <trace/define_trace.h>
55