blob: 9b7dd59fe28d5f1cd8636bec98a15552440168da [file] [log] [blame]
Jiri Olsac5e63192012-08-07 15:20:36 +02001#ifndef _LINUX_PERF_REGS_H
2#define _LINUX_PERF_REGS_H
3
Ingo Molnar68db0cf2017-02-08 18:51:37 +01004#include <linux/sched/task_stack.h>
5
Andy Lutomirski88a7c262015-01-04 10:36:19 -08006struct perf_regs {
7 __u64 abi;
8 struct pt_regs *regs;
9};
10
Jiri Olsac5e63192012-08-07 15:20:36 +020011#ifdef CONFIG_HAVE_PERF_REGS
12#include <asm/perf_regs.h>
13u64 perf_reg_value(struct pt_regs *regs, int idx);
14int perf_reg_validate(u64 mask);
Jiri Olsa40189942012-08-07 15:20:37 +020015u64 perf_reg_abi(struct task_struct *task);
Andy Lutomirski88a7c262015-01-04 10:36:19 -080016void perf_get_regs_user(struct perf_regs *regs_user,
17 struct pt_regs *regs,
18 struct pt_regs *regs_user_copy);
Jiri Olsac5e63192012-08-07 15:20:36 +020019#else
20static inline u64 perf_reg_value(struct pt_regs *regs, int idx)
21{
22 return 0;
23}
24
25static inline int perf_reg_validate(u64 mask)
26{
27 return mask ? -ENOSYS : 0;
28}
Jiri Olsa40189942012-08-07 15:20:37 +020029
30static inline u64 perf_reg_abi(struct task_struct *task)
31{
32 return PERF_SAMPLE_REGS_ABI_NONE;
33}
Andy Lutomirski88a7c262015-01-04 10:36:19 -080034
35static inline void perf_get_regs_user(struct perf_regs *regs_user,
36 struct pt_regs *regs,
37 struct pt_regs *regs_user_copy)
38{
39 regs_user->regs = task_pt_regs(current);
40 regs_user->abi = perf_reg_abi(current);
41}
Jiri Olsac5e63192012-08-07 15:20:36 +020042#endif /* CONFIG_HAVE_PERF_REGS */
43#endif /* _LINUX_PERF_REGS_H */