1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_REGS_H
3 #define __PERF_REGS_H
4
5 #include <linux/types.h>
6 #include <linux/compiler.h>
7
8 struct regs_dump;
9
10 struct sample_reg {
11 const char *name;
12 uint64_t mask;
13 };
14 #define SMPL_REG(n, b) { .name = #n, .mask = 1ULL << (b) }
15 #define SMPL_REG2(n, b) { .name = #n, .mask = 3ULL << (b) }
16 #define SMPL_REG_END { .name = NULL }
17
18 enum {
19 SDT_ARG_VALID = 0,
20 SDT_ARG_SKIP,
21 };
22
23 int arch_sdt_arg_parse_op(char *old_op, char **new_op);
24 uint64_t arch__intr_reg_mask(void);
25 uint64_t arch__user_reg_mask(void);
26
27 #ifdef HAVE_PERF_REGS_SUPPORT
28 extern const struct sample_reg sample_reg_masks[];
29
30 #include <perf_regs.h>
31
32 #define DWARF_MINIMAL_REGS ((1ULL << PERF_REG_IP) | (1ULL << PERF_REG_SP))
33
34 int perf_reg_value(u64 *valp, struct regs_dump *regs, int id);
35
perf_reg_name(int id)36 static inline const char *perf_reg_name(int id)
37 {
38 const char *reg_name = __perf_reg_name(id);
39
40 return reg_name ?: "unknown";
41 }
42
43 #else
44 #define PERF_REGS_MASK 0
45 #define PERF_REGS_MAX 0
46
47 #define DWARF_MINIMAL_REGS PERF_REGS_MASK
48
perf_reg_name(int id __maybe_unused)49 static inline const char *perf_reg_name(int id __maybe_unused)
50 {
51 return "unknown";
52 }
53
perf_reg_value(u64 * valp __maybe_unused,struct regs_dump * regs __maybe_unused,int id __maybe_unused)54 static inline int perf_reg_value(u64 *valp __maybe_unused,
55 struct regs_dump *regs __maybe_unused,
56 int id __maybe_unused)
57 {
58 return 0;
59 }
60 #endif /* HAVE_PERF_REGS_SUPPORT */
61 #endif /* __PERF_REGS_H */
62