Revert "perf augmented_syscalls: Drop 'write', 'poll' for testing without self pid...
[linux/fpc-iii.git] / tools / perf / util / perf_regs.c
blob2acfcc527caca619e53f15ad53742c0a3869d088
1 // SPDX-License-Identifier: GPL-2.0
2 #include <errno.h>
3 #include "perf_regs.h"
4 #include "event.h"
6 const struct sample_reg __weak sample_reg_masks[] = {
7 SMPL_REG_END
8 };
10 int __weak arch_sdt_arg_parse_op(char *old_op __maybe_unused,
11 char **new_op __maybe_unused)
13 return SDT_ARG_SKIP;
16 #ifdef HAVE_PERF_REGS_SUPPORT
17 int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
19 int i, idx = 0;
20 u64 mask = regs->mask;
22 if (regs->cache_mask & (1ULL << id))
23 goto out;
25 if (!(mask & (1ULL << id)))
26 return -EINVAL;
28 for (i = 0; i < id; i++) {
29 if (mask & (1ULL << i))
30 idx++;
33 regs->cache_mask |= (1ULL << id);
34 regs->cache_regs[id] = regs->regs[idx];
36 out:
37 *valp = regs->cache_regs[id];
38 return 0;
40 #endif