xref: /linux/tools/perf/util/perf_regs.h (revision 4b660dbd9ee2059850fd30e0df420ca7a38a1856)
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 
15 #define SMPL_REG_MASK(b) (1ULL << (b))
16 #define SMPL_REG(n, b) { .name = #n, .mask = SMPL_REG_MASK(b) }
17 #define SMPL_REG2_MASK(b) (3ULL << (b))
18 #define SMPL_REG2(n, b) { .name = #n, .mask = SMPL_REG2_MASK(b) }
19 #define SMPL_REG_END { .name = NULL }
20 
21 enum {
22 	SDT_ARG_VALID = 0,
23 	SDT_ARG_SKIP,
24 };
25 
26 int arch_sdt_arg_parse_op(char *old_op, char **new_op);
27 uint64_t arch__intr_reg_mask(void);
28 uint64_t arch__user_reg_mask(void);
29 const struct sample_reg *arch__sample_reg_masks(void);
30 
31 const char *perf_reg_name(int id, const char *arch);
32 int perf_reg_value(u64 *valp, struct regs_dump *regs, int id);
33 uint64_t perf_arch_reg_ip(const char *arch);
34 uint64_t perf_arch_reg_sp(const char *arch);
35 const char *__perf_reg_name_arm64(int id);
36 uint64_t __perf_reg_ip_arm64(void);
37 uint64_t __perf_reg_sp_arm64(void);
38 const char *__perf_reg_name_arm(int id);
39 uint64_t __perf_reg_ip_arm(void);
40 uint64_t __perf_reg_sp_arm(void);
41 const char *__perf_reg_name_csky(int id);
42 uint64_t __perf_reg_ip_csky(void);
43 uint64_t __perf_reg_sp_csky(void);
44 const char *__perf_reg_name_loongarch(int id);
45 uint64_t __perf_reg_ip_loongarch(void);
46 uint64_t __perf_reg_sp_loongarch(void);
47 const char *__perf_reg_name_mips(int id);
48 uint64_t __perf_reg_ip_mips(void);
49 uint64_t __perf_reg_sp_mips(void);
50 const char *__perf_reg_name_powerpc(int id);
51 uint64_t __perf_reg_ip_powerpc(void);
52 uint64_t __perf_reg_sp_powerpc(void);
53 const char *__perf_reg_name_riscv(int id);
54 uint64_t __perf_reg_ip_riscv(void);
55 uint64_t __perf_reg_sp_riscv(void);
56 const char *__perf_reg_name_s390(int id);
57 uint64_t __perf_reg_ip_s390(void);
58 uint64_t __perf_reg_sp_s390(void);
59 const char *__perf_reg_name_x86(int id);
60 uint64_t __perf_reg_ip_x86(void);
61 uint64_t __perf_reg_sp_x86(void);
62 
63 static inline uint64_t DWARF_MINIMAL_REGS(const char *arch)
64 {
65 	return (1ULL << perf_arch_reg_ip(arch)) | (1ULL << perf_arch_reg_sp(arch));
66 }
67 
68 #endif /* __PERF_REGS_H */
69