Linux Audio

Check our new training course

Linux debugging, profiling, tracing and performance analysis training

Mar 24-27, 2025, special US time zones
Register
Loading...
v5.4
 1// SPDX-License-Identifier: GPL-2.0
 2#include <errno.h>
 3#include "perf_regs.h"
 4#include "event.h"
 5
 6const struct sample_reg __weak sample_reg_masks[] = {
 7	SMPL_REG_END
 8};
 9
10int __weak arch_sdt_arg_parse_op(char *old_op __maybe_unused,
11				 char **new_op __maybe_unused)
12{
13	return SDT_ARG_SKIP;
14}
15
16uint64_t __weak arch__intr_reg_mask(void)
17{
18	return PERF_REGS_MASK;
19}
20
21uint64_t __weak arch__user_reg_mask(void)
22{
23	return PERF_REGS_MASK;
24}
25
26#ifdef HAVE_PERF_REGS_SUPPORT
27int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
28{
29	int i, idx = 0;
30	u64 mask = regs->mask;
31
32	if (regs->cache_mask & (1ULL << id))
33		goto out;
34
35	if (!(mask & (1ULL << id)))
36		return -EINVAL;
37
38	for (i = 0; i < id; i++) {
39		if (mask & (1ULL << i))
40			idx++;
41	}
42
43	regs->cache_mask |= (1ULL << id);
44	regs->cache_regs[id] = regs->regs[idx];
45
46out:
47	*valp = regs->cache_regs[id];
48	return 0;
49}
50#endif
v4.6
 
 1#include <errno.h>
 2#include "perf_regs.h"
 3#include "event.h"
 4
 5const struct sample_reg __weak sample_reg_masks[] = {
 6	SMPL_REG_END
 7};
 8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 9#ifdef HAVE_PERF_REGS_SUPPORT
10int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
11{
12	int i, idx = 0;
13	u64 mask = regs->mask;
14
15	if (regs->cache_mask & (1 << id))
16		goto out;
17
18	if (!(mask & (1 << id)))
19		return -EINVAL;
20
21	for (i = 0; i < id; i++) {
22		if (mask & (1 << i))
23			idx++;
24	}
25
26	regs->cache_mask |= (1 << id);
27	regs->cache_regs[id] = regs->regs[idx];
28
29out:
30	*valp = regs->cache_regs[id];
31	return 0;
32}
33#endif