blob: 2d12e97d5e7bc16a3edf1c9a39e177f7b73e5874 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Jiri Olsac5e63192012-08-07 15:20:36 +02002#ifndef _LINUX_PERF_REGS_H
3#define _LINUX_PERF_REGS_H
4
Ingo Molnar68db0cf2017-02-08 18:51:37 +01005#include <linux/sched/task_stack.h>
6
Andy Lutomirski88a7c262015-01-04 10:36:19 -08007struct perf_regs {
8 __u64 abi;
9 struct pt_regs *regs;
10};
11
Jiri Olsac5e63192012-08-07 15:20:36 +020012#ifdef CONFIG_HAVE_PERF_REGS
13#include <asm/perf_regs.h>
Kan Liange321d022019-05-28 15:08:30 -070014
15#ifndef PERF_REG_EXTENDED_MASK
16#define PERF_REG_EXTENDED_MASK 0
17#endif
18
Jiri Olsac5e63192012-08-07 15:20:36 +020019u64 perf_reg_value(struct pt_regs *regs, int idx);
20int perf_reg_validate(u64 mask);
Jiri Olsa40189942012-08-07 15:20:37 +020021u64 perf_reg_abi(struct task_struct *task);
Andy Lutomirski88a7c262015-01-04 10:36:19 -080022void perf_get_regs_user(struct perf_regs *regs_user,
23 struct pt_regs *regs,
24 struct pt_regs *regs_user_copy);
Jiri Olsac5e63192012-08-07 15:20:36 +020025#else
Kan Liange321d022019-05-28 15:08:30 -070026
27#define PERF_REG_EXTENDED_MASK 0
28
Jiri Olsac5e63192012-08-07 15:20:36 +020029static inline u64 perf_reg_value(struct pt_regs *regs, int idx)
30{
31 return 0;
32}
33
34static inline int perf_reg_validate(u64 mask)
35{
36 return mask ? -ENOSYS : 0;
37}
Jiri Olsa40189942012-08-07 15:20:37 +020038
39static inline u64 perf_reg_abi(struct task_struct *task)
40{
41 return PERF_SAMPLE_REGS_ABI_NONE;
42}
Andy Lutomirski88a7c262015-01-04 10:36:19 -080043
44static 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 Olsac5e63192012-08-07 15:20:36 +020051#endif /* CONFIG_HAVE_PERF_REGS */
52#endif /* _LINUX_PERF_REGS_H */