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> |
Kan Liang | e321d02 | 2019-05-28 15:08:30 -0700 | [diff] [blame] | 14 | |
| 15 | #ifndef PERF_REG_EXTENDED_MASK |
| 16 | #define PERF_REG_EXTENDED_MASK 0 |
| 17 | #endif |
| 18 | |
Jiri Olsa | c5e6319 | 2012-08-07 15:20:36 +0200 | [diff] [blame] | 19 | u64 perf_reg_value(struct pt_regs *regs, int idx); |
| 20 | int perf_reg_validate(u64 mask); |
Jiri Olsa | 4018994 | 2012-08-07 15:20:37 +0200 | [diff] [blame] | 21 | u64 perf_reg_abi(struct task_struct *task); |
Andy Lutomirski | 88a7c26 | 2015-01-04 10:36:19 -0800 | [diff] [blame] | 22 | void perf_get_regs_user(struct perf_regs *regs_user, |
| 23 | struct pt_regs *regs, |
| 24 | struct pt_regs *regs_user_copy); |
Jiri Olsa | c5e6319 | 2012-08-07 15:20:36 +0200 | [diff] [blame] | 25 | #else |
Kan Liang | e321d02 | 2019-05-28 15:08:30 -0700 | [diff] [blame] | 26 | |
| 27 | #define PERF_REG_EXTENDED_MASK 0 |
| 28 | |
Jiri Olsa | c5e6319 | 2012-08-07 15:20:36 +0200 | [diff] [blame] | 29 | static inline u64 perf_reg_value(struct pt_regs *regs, int idx) |
| 30 | { |
| 31 | return 0; |
| 32 | } |
| 33 | |
| 34 | static inline int perf_reg_validate(u64 mask) |
| 35 | { |
| 36 | return mask ? -ENOSYS : 0; |
| 37 | } |
Jiri Olsa | 4018994 | 2012-08-07 15:20:37 +0200 | [diff] [blame] | 38 | |
| 39 | static inline u64 perf_reg_abi(struct task_struct *task) |
| 40 | { |
| 41 | return PERF_SAMPLE_REGS_ABI_NONE; |
| 42 | } |
Andy Lutomirski | 88a7c26 | 2015-01-04 10:36:19 -0800 | [diff] [blame] | 43 | |
| 44 | static 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 | } |
Jiri Olsa | c5e6319 | 2012-08-07 15:20:36 +0200 | [diff] [blame] | 51 | #endif /* CONFIG_HAVE_PERF_REGS */ |
| 52 | #endif /* _LINUX_PERF_REGS_H */ |