Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / tools / perf / util / perf_regs.c
blob43168fb0d9a28a1151721cd3379b1d3234fef0ab
1 #include <errno.h>
2 #include "perf_regs.h"
3 #include "event.h"
5 int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
7 int i, idx = 0;
8 u64 mask = regs->mask;
10 if (regs->cache_mask & (1 << id))
11 goto out;
13 if (!(mask & (1 << id)))
14 return -EINVAL;
16 for (i = 0; i < id; i++) {
17 if (mask & (1 << i))
18 idx++;
21 regs->cache_mask |= (1 << id);
22 regs->cache_regs[id] = regs->regs[idx];
24 out:
25 *valp = regs->cache_regs[id];
26 return 0;