1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LINUX_PERF_REGS_H 3 #define _LINUX_PERF_REGS_H 4 5 #include <linux/sched/task_stack.h> 6 7 struct perf_regs { 8 __u64 abi; 9 struct pt_regs *regs; 10 }; 11 12 #ifdef CONFIG_HAVE_PERF_REGS 13 #include <asm/perf_regs.h> 14 15 #ifndef PERF_REG_EXTENDED_MASK 16 #define PERF_REG_EXTENDED_MASK 0 17 #endif 18 19 u64 perf_reg_value(struct pt_regs *regs, int idx); 20 int perf_reg_validate(u64 mask); 21 u64 perf_reg_abi(struct task_struct *task); 22 void perf_get_regs_user(struct perf_regs *regs_user, 23 struct pt_regs *regs, 24 struct pt_regs *regs_user_copy); 25 #else 26 27 #define PERF_REG_EXTENDED_MASK 0 28 perf_reg_value(struct pt_regs * regs,int idx)29static inline u64 perf_reg_value(struct pt_regs *regs, int idx) 30 { 31 return 0; 32 } 33 perf_reg_validate(u64 mask)34static inline int perf_reg_validate(u64 mask) 35 { 36 return mask ? -ENOSYS : 0; 37 } 38 perf_reg_abi(struct task_struct * task)39static inline u64 perf_reg_abi(struct task_struct *task) 40 { 41 return PERF_SAMPLE_REGS_ABI_NONE; 42 } 43 perf_get_regs_user(struct perf_regs * regs_user,struct pt_regs * regs,struct pt_regs * regs_user_copy)44static inline void perf_get_regs_user(struct perf_regs *regs_user, 45 struct pt_regs *regs, 46 struct pt_regs *regs_user_copy) 47 { 48 regs_user->regs = task_pt_regs(current); 49 regs_user->abi = perf_reg_abi(current); 50 } 51 #endif /* CONFIG_HAVE_PERF_REGS */ 52 #endif /* _LINUX_PERF_REGS_H */ 53