xref: /linux/arch/arm64/include/asm/perf_event.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1*caab277bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
203089688SWill Deacon /*
303089688SWill Deacon  * Copyright (C) 2012 ARM Ltd.
403089688SWill Deacon  */
503089688SWill Deacon 
603089688SWill Deacon #ifndef __ASM_PERF_EVENT_H
703089688SWill Deacon #define __ASM_PERF_EVENT_H
803089688SWill Deacon 
9a9ea0017SMark Rutland #include <asm/stack_pointer.h>
10a39cada7SHendrik Brueckner #include <asm/ptrace.h>
11a9ea0017SMark Rutland 
1252da443eSMark Rutland #ifdef CONFIG_PERF_EVENTS
1375e42462SMarc Zyngier struct pt_regs;
1475e42462SMarc Zyngier extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
1575e42462SMarc Zyngier extern unsigned long perf_misc_flags(struct pt_regs *regs);
1675e42462SMarc Zyngier #define perf_misc_flags(regs)	perf_misc_flags(regs)
17a39cada7SHendrik Brueckner #define perf_arch_bpf_user_pt_regs(regs) &regs->user_regs
1875e42462SMarc Zyngier #endif
1903089688SWill Deacon 
205b09a094SHou Pengyang #define perf_arch_fetch_caller_regs(regs, __ip) { \
215b09a094SHou Pengyang 	(regs)->pc = (__ip);    \
225b09a094SHou Pengyang 	(regs)->regs[29] = (unsigned long) __builtin_frame_address(0); \
235b09a094SHou Pengyang 	(regs)->sp = current_stack_pointer; \
245b09a094SHou Pengyang 	(regs)->pstate = PSR_MODE_EL1h;	\
255b09a094SHou Pengyang }
265b09a094SHou Pengyang 
2703089688SWill Deacon #endif
28