perf_regs.c (5000e7f61a1eb82fed98d5d0c8f19477033f0914) perf_regs.c (34af56afacd82ed585ad9cfc51a3a783ad371b26)
1// SPDX-License-Identifier: GPL-2.0
2#include <errno.h>
3#include <string.h>
4#include "perf_regs.h"
5#include "util/sample.h"
1// SPDX-License-Identifier: GPL-2.0
2#include <errno.h>
3#include <string.h>
4#include "perf_regs.h"
5#include "util/sample.h"
6#include "debug.h"
6
7int __weak arch_sdt_arg_parse_op(char *old_op __maybe_unused,
8 char **new_op __maybe_unused)
9{
10 return SDT_ARG_SKIP;
11}
12
13uint64_t __weak arch__intr_reg_mask(void)

--- 55 unchanged lines hidden (view full) ---

69
70 regs->cache_mask |= (1ULL << id);
71 regs->cache_regs[id] = regs->regs[idx];
72
73out:
74 *valp = regs->cache_regs[id];
75 return 0;
76}
7
8int __weak arch_sdt_arg_parse_op(char *old_op __maybe_unused,
9 char **new_op __maybe_unused)
10{
11 return SDT_ARG_SKIP;
12}
13
14uint64_t __weak arch__intr_reg_mask(void)

--- 55 unchanged lines hidden (view full) ---

70
71 regs->cache_mask |= (1ULL << id);
72 regs->cache_regs[id] = regs->regs[idx];
73
74out:
75 *valp = regs->cache_regs[id];
76 return 0;
77}
78
79uint64_t perf_arch_reg_ip(const char *arch)
80{
81 if (!strcmp(arch, "arm"))
82 return __perf_reg_ip_arm();
83 else if (!strcmp(arch, "arm64"))
84 return __perf_reg_ip_arm64();
85 else if (!strcmp(arch, "csky"))
86 return __perf_reg_ip_csky();
87 else if (!strcmp(arch, "loongarch"))
88 return __perf_reg_ip_loongarch();
89 else if (!strcmp(arch, "mips"))
90 return __perf_reg_ip_mips();
91 else if (!strcmp(arch, "powerpc"))
92 return __perf_reg_ip_powerpc();
93 else if (!strcmp(arch, "riscv"))
94 return __perf_reg_ip_riscv();
95 else if (!strcmp(arch, "s390"))
96 return __perf_reg_ip_s390();
97 else if (!strcmp(arch, "x86"))
98 return __perf_reg_ip_x86();
99
100 pr_err("Fail to find IP register for arch %s, returns 0\n", arch);
101 return 0;
102}
103
104uint64_t perf_arch_reg_sp(const char *arch)
105{
106 if (!strcmp(arch, "arm"))
107 return __perf_reg_sp_arm();
108 else if (!strcmp(arch, "arm64"))
109 return __perf_reg_sp_arm64();
110 else if (!strcmp(arch, "csky"))
111 return __perf_reg_sp_csky();
112 else if (!strcmp(arch, "loongarch"))
113 return __perf_reg_sp_loongarch();
114 else if (!strcmp(arch, "mips"))
115 return __perf_reg_sp_mips();
116 else if (!strcmp(arch, "powerpc"))
117 return __perf_reg_sp_powerpc();
118 else if (!strcmp(arch, "riscv"))
119 return __perf_reg_sp_riscv();
120 else if (!strcmp(arch, "s390"))
121 return __perf_reg_sp_s390();
122 else if (!strcmp(arch, "x86"))
123 return __perf_reg_sp_x86();
124
125 pr_err("Fail to find SP register for arch %s, returns 0\n", arch);
126 return 0;
127}
128
77#endif
129#endif