Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[deliverable/linux.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
JO
4
5int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
6{
7 int i, idx = 0;
8 u64 mask = regs->mask;
9
0c4e774f
JO
10 if (regs->cache_mask & (1 << id))
11 goto out;
12
c9b951c4
JO
13 if (!(mask & (1 << id)))
14 return -EINVAL;
15
16 for (i = 0; i < id; i++) {
17 if (mask & (1 << i))
18 idx++;
19 }
20
0c4e774f
JO
21 regs->cache_mask |= (1 << id);
22 regs->cache_regs[id] = regs->regs[idx];
23
24out:
25 *valp = regs->cache_regs[id];
c9b951c4
JO
26 return 0;
27}
This page took 0.040864 seconds and 5 git commands to generate.