blob: 476747456bca590df158a3ea630aa940597eea02 [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>
14u64 perf_reg_value(struct pt_regs *regs, int idx);
15int perf_reg_validate(u64 mask);
Jiri Olsa40189942012-08-07 15:20:37 +020016u64 perf_reg_abi(struct task_struct *task);
Andy Lutomirski88a7c262015-01-04 10:36:19 -080017void perf_get_regs_user(struct perf_regs *regs_user,
18 struct pt_regs *regs,
19 struct pt_regs *regs_user_copy);
Jiri Olsac5e63192012-08-07 15:20:36 +020020#else
21static inline u64 perf_reg_value(struct pt_regs *regs, int idx)
22{
23 return 0;
24}
25
26static inline int perf_reg_validate(u64 mask)
27{
28 return mask ? -ENOSYS : 0;
29}
Jiri Olsa40189942012-08-07 15:20:37 +020030
31static inline u64 perf_reg_abi(struct task_struct *task)
32{
33 return PERF_SAMPLE_REGS_ABI_NONE;
34}
Andy Lutomirski88a7c262015-01-04 10:36:19 -080035
36static 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 Olsac5e63192012-08-07 15:20:36 +020043#endif /* CONFIG_HAVE_PERF_REGS */
44#endif /* _LINUX_PERF_REGS_H */