]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
c9b951c4 JO |
2 | #include <errno.h> |
3 | #include "perf_regs.h" | |
0c4e774f | 4 | #include "event.h" |
c9b951c4 | 5 | |
af4aeadd SE |
6 | const struct sample_reg __weak sample_reg_masks[] = { |
7 | SMPL_REG_END | |
8 | }; | |
9 | ||
d451a205 RB |
10 | int __weak arch_sdt_arg_parse_op(char *old_op __maybe_unused, |
11 | char **new_op __maybe_unused) | |
3b1f8311 | 12 | { |
d451a205 | 13 | return SDT_ARG_SKIP; |
3b1f8311 AB |
14 | } |
15 | ||
9fb47654 | 16 | #ifdef HAVE_PERF_REGS_SUPPORT |
c9b951c4 JO |
17 | int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) |
18 | { | |
19 | int i, idx = 0; | |
20 | u64 mask = regs->mask; | |
21 | ||
f4782207 | 22 | if (regs->cache_mask & (1ULL << id)) |
0c4e774f JO |
23 | goto out; |
24 | ||
f4782207 | 25 | if (!(mask & (1ULL << id))) |
c9b951c4 JO |
26 | return -EINVAL; |
27 | ||
28 | for (i = 0; i < id; i++) { | |
f4782207 | 29 | if (mask & (1ULL << i)) |
c9b951c4 JO |
30 | idx++; |
31 | } | |
32 | ||
f4782207 | 33 | regs->cache_mask |= (1ULL << id); |
0c4e774f JO |
34 | regs->cache_regs[id] = regs->regs[idx]; |
35 | ||
36 | out: | |
37 | *valp = regs->cache_regs[id]; | |
c9b951c4 JO |
38 | return 0; |
39 | } | |
9fb47654 | 40 | #endif |