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