1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2012 ARM Ltd.
4  */
5 
6 #ifndef __ASM_PERF_EVENT_H
7 #define __ASM_PERF_EVENT_H
8 
9 #include <asm/stack_pointer.h>
10 #include <asm/ptrace.h>
11 
12 #ifdef CONFIG_PERF_EVENTS
13 struct pt_regs;
14 extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
15 extern unsigned long perf_misc_flags(struct pt_regs *regs);
16 #define perf_misc_flags(regs)	perf_misc_flags(regs)
17 #define perf_arch_bpf_user_pt_regs(regs) &regs->user_regs
18 #endif
19 
20 #define perf_arch_fetch_caller_regs(regs, __ip) { \
21 	(regs)->pc = (__ip);    \
22 	(regs)->regs[29] = (unsigned long) __builtin_frame_address(0); \
23 	(regs)->sp = current_stack_pointer; \
24 	(regs)->pstate = PSR_MODE_EL1h;	\
25 }
26 
27 #endif
28