Jiri Olsa | c5e6319 | 2012-08-07 15:20:36 +0200 | [diff] [blame] | 1 | #ifndef _LINUX_PERF_REGS_H |
| 2 | #define _LINUX_PERF_REGS_H |
| 3 | |
Ingo Molnar | 68db0cf | 2017-02-08 18:51:37 +0100 | [diff] [blame] | 4 | #include <linux/sched/task_stack.h> |
| 5 | |
Andy Lutomirski | 88a7c26 | 2015-01-04 10:36:19 -0800 | [diff] [blame] | 6 | struct perf_regs { |
| 7 | __u64 abi; |
| 8 | struct pt_regs *regs; |
| 9 | }; |
| 10 | |
Jiri Olsa | c5e6319 | 2012-08-07 15:20:36 +0200 | [diff] [blame] | 11 | #ifdef CONFIG_HAVE_PERF_REGS |
| 12 | #include <asm/perf_regs.h> |
| 13 | u64 perf_reg_value(struct pt_regs *regs, int idx); |
| 14 | int perf_reg_validate(u64 mask); |
Jiri Olsa | 4018994 | 2012-08-07 15:20:37 +0200 | [diff] [blame] | 15 | u64 perf_reg_abi(struct task_struct *task); |
Andy Lutomirski | 88a7c26 | 2015-01-04 10:36:19 -0800 | [diff] [blame] | 16 | void perf_get_regs_user(struct perf_regs *regs_user, |
| 17 | struct pt_regs *regs, |
| 18 | struct pt_regs *regs_user_copy); |
Jiri Olsa | c5e6319 | 2012-08-07 15:20:36 +0200 | [diff] [blame] | 19 | #else |
| 20 | static inline u64 perf_reg_value(struct pt_regs *regs, int idx) |
| 21 | { |
| 22 | return 0; |
| 23 | } |
| 24 | |
| 25 | static inline int perf_reg_validate(u64 mask) |
| 26 | { |
| 27 | return mask ? -ENOSYS : 0; |
| 28 | } |
Jiri Olsa | 4018994 | 2012-08-07 15:20:37 +0200 | [diff] [blame] | 29 | |
| 30 | static inline u64 perf_reg_abi(struct task_struct *task) |
| 31 | { |
| 32 | return PERF_SAMPLE_REGS_ABI_NONE; |
| 33 | } |
Andy Lutomirski | 88a7c26 | 2015-01-04 10:36:19 -0800 | [diff] [blame] | 34 | |
| 35 | static 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 Olsa | c5e6319 | 2012-08-07 15:20:36 +0200 | [diff] [blame] | 42 | #endif /* CONFIG_HAVE_PERF_REGS */ |
| 43 | #endif /* _LINUX_PERF_REGS_H */ |