Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / include / linux / perf_regs.h
blobf632c5725f162f723fd3536f64c0eaf64b7ae391
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_PERF_REGS_H
3 #define _LINUX_PERF_REGS_H
5 #include <linux/sched/task_stack.h>
7 struct perf_regs {
8 __u64 abi;
9 struct pt_regs *regs;
12 #ifdef CONFIG_HAVE_PERF_REGS
13 #include <asm/perf_regs.h>
15 #ifndef PERF_REG_EXTENDED_MASK
16 #define PERF_REG_EXTENDED_MASK 0
17 #endif
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 #else
26 #define PERF_REG_EXTENDED_MASK 0
28 static inline u64 perf_reg_value(struct pt_regs *regs, int idx)
30 return 0;
33 static inline int perf_reg_validate(u64 mask)
35 return mask ? -ENOSYS : 0;
38 static inline u64 perf_reg_abi(struct task_struct *task)
40 return PERF_SAMPLE_REGS_ABI_NONE;
43 static inline void perf_get_regs_user(struct perf_regs *regs_user,
44 struct pt_regs *regs)
46 regs_user->regs = task_pt_regs(current);
47 regs_user->abi = perf_reg_abi(current);
49 #endif /* CONFIG_HAVE_PERF_REGS */
50 #endif /* _LINUX_PERF_REGS_H */