]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - tools/perf/util/perf_regs.c
Merge tag 'omap-for-v4.8/fixes-rc2' of git://git.kernel.org/pub/scm/linux/kernel...
[mirror_ubuntu-artful-kernel.git] / tools / perf / util / perf_regs.c
CommitLineData
c9b951c4
JO
1#include <errno.h>
2#include "perf_regs.h"
0c4e774f 3#include "event.h"
c9b951c4 4
af4aeadd
SE
5const struct sample_reg __weak sample_reg_masks[] = {
6 SMPL_REG_END
7};
8
9fb47654 9#ifdef HAVE_PERF_REGS_SUPPORT
c9b951c4
JO
10int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
11{
12 int i, idx = 0;
13 u64 mask = regs->mask;
14
f4782207 15 if (regs->cache_mask & (1ULL << id))
0c4e774f
JO
16 goto out;
17
f4782207 18 if (!(mask & (1ULL << id)))
c9b951c4
JO
19 return -EINVAL;
20
21 for (i = 0; i < id; i++) {
f4782207 22 if (mask & (1ULL << i))
c9b951c4
JO
23 idx++;
24 }
25
f4782207 26 regs->cache_mask |= (1ULL << id);
0c4e774f
JO
27 regs->cache_regs[id] = regs->regs[idx];
28
29out:
30 *valp = regs->cache_regs[id];
c9b951c4
JO
31 return 0;
32}
9fb47654 33#endif