Commit | Line | Data |
---|---|---|
c9b951c4 JO |
1 | #include <errno.h> |
2 | #include "perf_regs.h" | |
3 | ||
4 | int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) | |
5 | { | |
6 | int i, idx = 0; | |
7 | u64 mask = regs->mask; | |
8 | ||
9 | if (!(mask & (1 << id))) | |
10 | return -EINVAL; | |
11 | ||
12 | for (i = 0; i < id; i++) { | |
13 | if (mask & (1 << i)) | |
14 | idx++; | |
15 | } | |
16 | ||
17 | *valp = regs->regs[idx]; | |
18 | return 0; | |
19 | } |